From c5d3dc7fa1c7f04f2149ab04718f542de05be2ee Mon Sep 17 00:00:00 2001 From: "jakob.stendahl" Date: Tue, 11 Oct 2022 12:26:59 +0200 Subject: Add vim config --- Common/nvim/lua/basic.lua | 38 +++++++++++++++------- Common/nvim/lua/helper_functions.lua | 0 Common/nvim/lua/plugins-conf.lua | 63 ++++++++++++++++++++++++++++++++++++ Common/nvim/lua/plugins.lua | 51 +++++++++++++++++++++++++++-- 4 files changed, 139 insertions(+), 13 deletions(-) mode change 100644 => 100755 Common/nvim/lua/basic.lua mode change 100644 => 100755 Common/nvim/lua/helper_functions.lua create mode 100644 Common/nvim/lua/plugins-conf.lua mode change 100644 => 100755 Common/nvim/lua/plugins.lua (limited to 'Common/nvim/lua') diff --git a/Common/nvim/lua/basic.lua b/Common/nvim/lua/basic.lua old mode 100644 new mode 100755 index 16e9a62..a5aec23 --- a/Common/nvim/lua/basic.lua +++ b/Common/nvim/lua/basic.lua @@ -44,7 +44,7 @@ vim.opt.wildignore = '*.o,*~,*.pyc' vim.opt.wildignore:append('*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store') -- Always show current position -vim.opt.ruler = true +--vim.opt.ruler = true -- Hide buffers when they are abandoned vim.opt.hid = true @@ -87,11 +87,27 @@ vim.opt.showcmd = true -- Show colour column vim.opt.colorcolumn = '80,120' +vim.cmd [[ highlight ColorColumn ctermbg=16 ]] -- => Colors and Fonts -- Enable syntac highlighting -vim.opt.syntax = 'enable' +--vim.opt.syntax = 'enable' + +-- Colorscheme +-- default + +-- Workaround for gutter color +vim.cmd [[ +highlight! link SignColumn LineNr +autocmd ColorScheme * highlight! link SignColumn LineNr +]] + +-- Change git colors +--vim.api.nvim_set_hl(0, "DiffAdd", {fg = "#bada9f", bg = "None"}) +--vim.api.nvim_set_hl(0, "DiffChange", {fg = "Purple", bg = "None"}) +--vim.api.nvim_set_hl(0, "DiffDelete", {fg = "Red", bg = "None"}) +--vim.api.nvim_set_hl(0, "DiffText", {fg = "Yellow", bg = "None"}) -- Set utf8 as standard encoding vim.opt.encoding = 'utf8' @@ -143,10 +159,10 @@ Moving around, tabs, windows and buffers map('n', '', ':noh', silentnoremap) -- Smart way to move between windows -map('n', '', 'j', silentnoremap) -map('n', '', 'k', silentnoremap) -map('n', '', 'h', silentnoremap) -map('n', '', 'l', silentnoremap) +map('', '', 'j', silentnoremap) +map('', '', 'k', silentnoremap) +map('', '', 'h', silentnoremap) +map('', '', 'l', silentnoremap) -- Close current buffer map('n', 'bd', ':Bclose:tabclosegT', silentnoremap) @@ -206,10 +222,10 @@ if vim.fn.has("mac") or vim.fn.has("macunix") then end -- Delete trailing whitespace on save -vim.api.nvim_create_autocmd("BufWritePre", { - pattern = { "*" }, - command = [[%s/\s\+$//e]] -}) +--vim.api.nvim_create_autocmd("BufWritePre", { +-- pattern = { "*" }, +-- command = [[%s/\s\+$//e]] +--}) --[[ Misc @@ -233,7 +249,7 @@ map('n', 'sm', ':mksession! vim_session.vim', silentnoremap) map('n', 'sl', ':source vim_session.vim', silentnoremap) -- Dont't close window when deleting buffer ---vim.api.nvim_create_user_command("Bclose", +--vim.api.nvim_create_user_command("Bclose", -- "BufcloseCloseIt()", -- {bang = true} --) diff --git a/Common/nvim/lua/helper_functions.lua b/Common/nvim/lua/helper_functions.lua old mode 100644 new mode 100755 diff --git a/Common/nvim/lua/plugins-conf.lua b/Common/nvim/lua/plugins-conf.lua new file mode 100644 index 0000000..e2a8f66 --- /dev/null +++ b/Common/nvim/lua/plugins-conf.lua @@ -0,0 +1,63 @@ +-- lualine +require('lualine').setup { + options = { theme = 'onedark' }, + sections = { + lualine_x = {'filetype'}, + lualine_y = {} + }, + tabline = { + lualine_a = {'buffers'}, + lualine_b = {'branch'}, + lualine_z = {'tabs'} + } +} + +-- lsp +require("nvim-lsp-installer").setup() +local lspconfig = require'lspconfig' +local coq = require "coq" + +-- setup language servers here +local lsp_flags = { + -- This is the default in Nvim 0.7+ + debounce_text_changes = 150, +} + +local lspconfig = require('lspconfig') +lspconfig['pyright'].setup{ + on_attach = on_attach, + flags = lsp_flags, +} +lspconfig.ccls.setup { + single_file_support = true; + init_options = { + compilationDatabaseDirectory = "build"; + index = { + threads = 0; + }; + clang = { + excludeArgs = { "-frounding-math"} ; + }; + } +} + +lspconfig.ccls.setup{} +lspconfig.intelephense.setup{} +lspconfig.cssls.setup{} +lspconfig.html.setup{} +lspconfig.bashls.setup{} + +-- nvim-tree +require("nvim-tree").setup() +map("n", "", ":NvimTreeToggle", silentnoremap) + +-- TagBar +map("n", "", ":TagbarToggle", silentnoremap) + +-- gitsigns +require('gitsigns').setup() +map("n", "s", ":Gitsigns toggle_current_line_blame", silentnoremap) + +-- fzf-lua +map("n", ";", ":FzfLua files", silentnoremap) + diff --git a/Common/nvim/lua/plugins.lua b/Common/nvim/lua/plugins.lua old mode 100644 new mode 100755 index 43f63a7..4161b4f --- a/Common/nvim/lua/plugins.lua +++ b/Common/nvim/lua/plugins.lua @@ -14,8 +14,54 @@ vim.cmd([[ ]]) return require('packer').startup(function(use) - use 'neovim/nvim-lspconfig' -- Easy LSP configuration - use 'kabouzeid/nvim-lspinstall' -- Install LSP servers on demand with :LSPInstall + use 'wbthomason/packer.nvim' + use 'lewis6991/gitsigns.nvim' + --use {'tjdevries/colorbuddy.vim', {'nvim-treesitter/nvim-treesitter', opt = true}} + use 'preservim/tagbar' + use { + 'tpope/vim-dadbod', + config = function() + vim.cmd [[ + xnoremap (DBExe) db#op_exec() + nnoremap (DBExe) db#op_exec() + nnoremap (DBExeLine) db#op_exec() . '_' + + xmap db (DBExe) + nmap db (DBExe) + omap db (DBExe) + nmap dbb (DBExeLine) + + autocmd FileType dbout setlocal nofoldenable + + if !empty(glob("~/.env.vim")) + source ~/.env.vim + endif + ]] + end, + } + use { + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true } + } + use { + 'kyazdani42/nvim-tree.lua', + requires = { 'kyazdani42/nvim-web-devicons' }, + tag = 'nightly' -- optional, updated every week. (see issue #1193) + } + use 'christoomey/vim-tmux-navigator' + use { + 'ibhagwan/fzf-lua', requires = { 'kyazdani42/nvim-web-devicons' } + } + -- terryma/vim-multiple-cursors + -- preservim/nerdcommenter + + use 'neovim/nvim-lsp' + use 'neovim/nvim-lspconfig' + --use 'kabouzeid/nvim-lspinstall' + use 'williamboman/nvim-lsp-installer' + use 'ms-jpq/coq_nvim' + + use 'mfussenegger/nvim-jdtls' -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins @@ -23,3 +69,4 @@ return require('packer').startup(function(use) require('packer').sync() end end) + -- cgit v1.2.3