diff options
author | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2022-10-11 12:26:59 +0200 |
---|---|---|
committer | jakobst1n <jakob.stendahl@outlook.com> | 2022-10-11 12:26:59 +0200 |
commit | c5d3dc7fa1c7f04f2149ab04718f542de05be2ee (patch) | |
tree | afda5c799a84ab730415ccab6e176785f6d0984a /Common/nvim/lua | |
parent | 37ac127214d212fb867ea165d7ace225ee040813 (diff) | |
download | dotfiles-c5d3dc7fa1c7f04f2149ab04718f542de05be2ee.tar.gz dotfiles-c5d3dc7fa1c7f04f2149ab04718f542de05be2ee.zip |
Add vim config
Diffstat (limited to 'Common/nvim/lua')
-rwxr-xr-x[-rw-r--r--] | Common/nvim/lua/basic.lua | 38 | ||||
-rwxr-xr-x[-rw-r--r--] | Common/nvim/lua/helper_functions.lua | 0 | ||||
-rw-r--r-- | Common/nvim/lua/plugins-conf.lua | 63 | ||||
-rwxr-xr-x[-rw-r--r--] | Common/nvim/lua/plugins.lua | 51 |
4 files changed, 139 insertions, 13 deletions
diff --git a/Common/nvim/lua/basic.lua b/Common/nvim/lua/basic.lua index 16e9a62..a5aec23 100644..100755 --- 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', '<leader><cr>', ':noh<cr>', silentnoremap) -- Smart way to move between windows -map('n', '<C-j>', '<C-W>j', silentnoremap) -map('n', '<C-k>', '<C-W>k', silentnoremap) -map('n', '<C-h>', '<C-W>h', silentnoremap) -map('n', '<C-l>', '<C-W>l', silentnoremap) +map('', '<C-j>', '<C-W>j', silentnoremap) +map('', '<C-k>', '<C-W>k', silentnoremap) +map('', '<C-h>', '<C-W>h', silentnoremap) +map('', '<C-l>', '<C-W>l', silentnoremap) -- Close current buffer map('n', '<leader>bd', ':Bclose<cr>:tabclose<cr>gT', 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', '<leader>sm', ':mksession! vim_session.vim<cr>', silentnoremap) map('n', '<leader>sl', ':source vim_session.vim<cr>', silentnoremap) -- Dont't close window when deleting buffer ---vim.api.nvim_create_user_command("Bclose", +--vim.api.nvim_create_user_command("Bclose", -- "<SID>BufcloseCloseIt()", -- {bang = true} --) diff --git a/Common/nvim/lua/helper_functions.lua b/Common/nvim/lua/helper_functions.lua index cac6c00..cac6c00 100644..100755 --- a/Common/nvim/lua/helper_functions.lua +++ b/Common/nvim/lua/helper_functions.lua 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", "<F3>", ":NvimTreeToggle<cr>", silentnoremap) + +-- TagBar +map("n", "<F2>", ":TagbarToggle<cr>", silentnoremap) + +-- gitsigns +require('gitsigns').setup() +map("n", "<leader>s", ":Gitsigns toggle_current_line_blame<cr>", silentnoremap) + +-- fzf-lua +map("n", ";", ":FzfLua files<cr>", silentnoremap) + diff --git a/Common/nvim/lua/plugins.lua b/Common/nvim/lua/plugins.lua index 43f63a7..4161b4f 100644..100755 --- 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 <name_of_language> + 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 <expr> <Plug>(DBExe) db#op_exec() + nnoremap <expr> <Plug>(DBExe) db#op_exec() + nnoremap <expr> <Plug>(DBExeLine) db#op_exec() . '_' + + xmap <leader>db <Plug>(DBExe) + nmap <leader>db <Plug>(DBExe) + omap <leader>db <Plug>(DBExe) + nmap <leader>dbb <Plug>(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) + |