From 8e02fdea1e800cbf6ce5fe89373f890abe3aa40a Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Fri, 8 Nov 2024 09:15:36 +0200 Subject: [PATCH] Rewrote init.vim, added lsp things for elixir --- config/nvim/init.vim | 146 +++++++++++++++++++++++++++++++++---------- 1 file changed, 114 insertions(+), 32 deletions(-) diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 0c890ce..12ae038 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -1,12 +1,34 @@ " Load plugins call plug#begin() +" CodeStats and Airline +Plug 'https://gitlab.com/code-stats/code-stats-vim.git' +Plug 'vim-airline/vim-airline' + +" Syntax highlighters +Plug 'tikhomirov/vim-glsl' + +" Treesitter things Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} -Plug 'https://gitlab.com/code-stats/code-stats-vim.git', {'do': ':TSUpdate'} -Plug 'vim-airline/vim-airline', {'do': ':TSUpdate'} + +" Language server protocol +Plug 'neovim/nvim-lspconfig' + +" Autocompletion shenanigans +Plug 'hrsh7th/cmp-nvim-lsp' +Plug 'hrsh7th/cmp-buffer' +Plug 'hrsh7th/cmp-path' +Plug 'hrsh7th/cmp-cmdline' +Plug 'hrsh7th/nvim-cmp' +Plug 'hrsh7th/cmp-vsnip' +Plug 'hrsh7th/vim-vsnip' +Plug 'petertriho/cmp-git' call plug#end() +" Set custom glsl extensions +autocmd! BufNewFile,BufRead *.effect set ft=glsl + " Python plugins, needed for CodeStats let g:python3_host_prog = '/usr/bin/python' @@ -20,38 +42,98 @@ set laststatus=2 set t_Co=256 lua <'] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, + { name = 'buffer' }, + }) + }) + + -- filetype specific setup + -- gitconfig + cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' }, + { name = 'buffer' }, + }) + }) + + -- / andd ? completion + cmp.setup.cmdline({'/', '?'}, { + mapping = cmp.mapping.preset.cmdline(), + sources = { { name = 'buffer' } }, + }) + + -- : completion + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'path' }, + { name = 'cmdline' }, + }, + matching = { disallow_symbol_nonprefix_matching = false }, + }) + + -- Elixir LSP configuration + local capabilities = require('cmp_nvim_lsp').default_capabilities() + require'lspconfig'.elixirls.setup { + capabilities = capabilities, + cmd = { '~/.local/share/lsp-servers/elixir-ls/language_server.sh' } + } EOF " disable dfraw for text files