From 8b9e0f2a9fa5552311b39f64f6c274b4ec660075 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Sat, 1 Apr 2023 20:33:53 -0700 Subject: [PATCH] A bunch of nvim stuff --- .config/nvim/init.vim | 103 +++++++++++++++++++++++++++++++++++------- 1 file changed, 86 insertions(+), 17 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 03abf94..e6aa16c 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -17,10 +17,12 @@ Plug 'ncm2/ncm2-tmux' Plug 'ncm2/ncm2-path' " Language-aware fancy things. Needs lang server config. Used, but what for? -Plug 'autozimu/LanguageClient-neovim', { - \ 'branch': 'next', - \ 'do': 'bash install.sh', - \ } +" Migrating to nvim-lspconfig +"Plug 'autozimu/LanguageClient-neovim', { +" \ 'branch': 'next', +" \ 'do': 'bash install.sh', +" \ } +Plug 'neovim/nvim-lspconfig' " Fancy tab completion; did I ever use it? I think it needs other plugins "Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } @@ -80,13 +82,17 @@ Plug 'keith/swift.vim' Plug 'darfink/vim-plist' Plug 'vim-ruby/vim-ruby' Plug 'thoughtbot/vim-rspec' -Plug 'jvirtanen/vim-hcl' +Plug 'hashivim/vim-terraform' +Plug 'vim-syntastic/syntastic' +Plug 'juliosueiras/vim-terraform-completion' Plug 'chrisbra/csv.vim' Plug 'wlangstroth/vim-racket' Plug 'kchmck/vim-coffee-script' Plug 'jceb/vim-orgmode' Plug 'bfontaine/Brewfile.vim' Plug 'pprovost/vim-ps1' +" This needs nodejs 14.14 or greater +Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'mdempsky/gocode', { 'rtp': 'nvim', 'do': '~/.config/nvim/plugged/gocode/nvim/symlink.sh' } Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " For vim-orgmode @@ -271,13 +277,13 @@ autocmd QuickFixCmdPost * botright cwindow 6 "nmap cwo :botright copen 5p "nmap cn :cnext "nmap cp :cprevious -nmap - :cnext -nmap _ :cprev +"nmap - :cnext +"nmap _ :cprev "nmap :colder "nmap :cnewer " neomake uses the location window rather than quickfix window -"noremap - :lnext -"noremap _ :lprev +noremap - :lnext +noremap _ :lprev " See ToggleLocationList below " Only lint when leaving insert or changing text in command mode @@ -434,14 +440,14 @@ set list listchars=tab:»·,trail:·,extends:…,nbsp:‗ " Languageserver settings from the solargraph readme " Tell the language client to use the default IP and port " that Solargraph runs on -let g:LanguageClient_serverCommands = { - \ 'go': ['gopls'], - \ 'ruby': ['~/.rbenv/shims/solargraph', 'stdio'], - \ 'python': ['pyls'], - \ } +"let g:LanguageClient_serverCommands = { +" \ 'go': ['gopls'], +" \ 'ruby': ['~/.rbenv/shims/solargraph', 'stdio'], +" \ 'python': ['pyls'], +" \ } " note that if you are using Plug mapping you should not use `noremap` mappings. -nmap (lcn-menu) +"nmap (lcn-menu) " Delete a buffer but keep layout with ^w! if has("eval") @@ -455,7 +461,70 @@ endif "let g:LanguageClient_autoStop = 0 " Configure ruby omni-completion to use the language client: -autocmd FileType ruby setlocal omnifunc=LanguageClient#complete +"autocmd FileType ruby setlocal omnifunc=LanguageClient#complete " Run gofmt on save -autocmd BufWritePre *.go :call LanguageClient#textDocument_formatting_sync() +"autocmd BufWritePre *.go :call LanguageClient#textDocument_formatting_sync() + + +" {{{ Adding some terraform stuff +" Syntastic Config +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 + +" (Optional)Remove Info(Preview) window +set completeopt-=preview + +" (Optional)Hide Info(Preview) window after completions +autocmd CursorMovedI * if pumvisible() == 0|pclose|endif +autocmd InsertLeave * if pumvisible() == 0|pclose|endif + +" (Optional) Enable terraform plan to be include in filter +let g:syntastic_terraform_tffilter_plan = 1 + +" (Optional) Default: 0, enable(1)/disable(0) plugin's keymapping +let g:terraform_completion_keys = 1 + +" (Optional) Default: 1, enable(1)/disable(0) terraform module registry completion +let g:terraform_registry_module_completion = 0 + +"let g:deoplete#omni_patterns = {} +"let g:deoplete#omni_patterns.terraform = '[^ *\t"{=$]\w*' +"let g:deoplete#enable_at_startup = 1 +"call deoplete#initialize() +" }}} end terraform +source ~/.config/nvim/tf.lua + +" CoC stuff +set updatetime=300 " faster than 4000ms +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction +let g:copilot_no_tab_map = v:true +imap