From 3e0c8208ccbead65cd434fe730223a7ab854c377 Mon Sep 17 00:00:00 2001 From: Alec Goncharow Date: Sun, 20 Feb 2022 11:45:32 -0500 Subject: Sync --- .config/nvim/init.vim | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to '.config') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 2042b4d..7998e15 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -36,6 +36,8 @@ call plug#begin('~/.config/nvim/plugged') Plug 'neoclide/coc.nvim', {'branch': 'release'} " rust lang Plug 'rust-lang/rust.vim' +" go +Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } " syntastic Plug 'vim-syntastic/syntastic' "C++ Highlighting @@ -71,6 +73,8 @@ function! HasPaste() return '' endfunction +let mapleader = " " " map leader to Space + " Applying codeAction to the selected region. " Example: \`aap\` for current paragraph @@ -78,6 +82,31 @@ endfunction xmap a (coc-codeaction-selected) nmap a (coc-codeaction-selected) +" +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window. +nnoremap K :call show_documentation() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming. +nmap rn (coc-rename) " My config @@ -125,6 +154,9 @@ inoremap \ check_back_space() ? "\" : \ coc#refresh() +" use for trigger completion +inoremap coc#refresh() + set laststatus=2 "set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c @@ -198,12 +230,21 @@ hi User5 ctermfg=238 ctermbg=233 "------------Start Python PEP 8 stuff---------------- " Number of spaces that a pre-existing tab is equal to. -au BufRead,BufNewFile *.html,*py,*pyw,*.c,*.h,*.js,*.tex,*.glsl,*.java,*.ts,*.tsx,*.c,*.cpp,*.h,*.hpp set tabstop=4 +"au BufRead,BufNewFile *.go,*.html,*py,*pyw,*.c,*.h,*.js,*.tex,*.glsl,*.java,*.ts,*.tsx,*.c,*.cpp,*.h,*.hpp set tabstop=4 "spaces for indents -au BufRead,BufNewFile *.html,*.py,*.pyw,*.js,*.tex,*.glsl,*.java,*.ts,*.tsx,*.c,*.cpp,*.h,*.hpp set shiftwidth=4 -au BufRead,BufNewFile *.html,*.py,*.pyw,*.js,*.tex,*.glsl,*.java,*.ts,*.tsx,*.c,*.cpp,*.h,*.hpp set expandtab -au BufRead,BufNewFile *.html,*.py,*.js,*.tex,*.glsl,*.java,*.ts,*.tsx,*.c,*.cpp,*.h,*.hpp set softtabstop=4 +"au BufRead,BufNewFile *.go,*.html,*.py,*.pyw,*.js,*.tex,*.glsl,*.java,*.ts,*.tsx,*.c,*.cpp,*.h,*.hpp set shiftwidth=4 +"au BufRead,BufNewFile *.go,*.html,*.py,*.pyw,*.js,*.tex,*.glsl,*.java,*.ts,*.tsx,*.c,*.cpp,*.h,*.hpp set expandtab +"au BufRead,BufNewFile *.go,*.html,*.py,*.js,*.tex,*.glsl,*.java,*.ts,*.tsx,*.c,*.cpp,*.h,*.hpp set softtabstop=4 + +au BufRead,BufNewFile * set tabstop=4 +au BufRead,BufNewFile * set shiftwidth=4 +au BufRead,BufNewFile * set expandtab +au BufRead,BufNewFile * set softtabstop=4 + +au BufRead,BufNewFile *.yaml set tabstop=2 +au BufRead,BufNewFile *.yaml set shiftwidth=2 +au BufRead,BufNewFile *.yaml set softtabstop=2 " Use the below highlight group when displaying bad whitespace is desired. highlight BadWhitespace ctermbg=red guibg=red -- cgit v1.2.3-70-g09d2