set number " Show: Line numbers set cursorline " Hilight current curser line set noshowmode " Hide: -- INSERT -- set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,space:·,trail:· set list " Show white space set tabstop=2 set shiftwidth=2 set expandtab set nowrap set colorcolumn=80,120 set mouse=a " set clipboard+=unnamedplus set nobackup set noswapfile set undodir=~/.config/nvim/undo set undofile set conceallevel=0 autocmd BufEnter * if &filetype != 'nerdtree' && &filetype != 'help' | set conceallevel=0 | endif set cmdheight=1 set shortmess+=c set signcolumn=yes set updatetime=300 set hidden set spell spelllang=en_us,de_de set splitbelow set splitright highlight clear CocHighlightText highlight CocHighlightText cterm=underline gui=underline set hlsearch " Highlight search results. set ignorecase " Make searching case insensitive set smartcase " ... unless the query has capital letters. set incsearch " Incremental search. set gdefault " Use 'g' flag by default with :s/foo/bar/. set magic " Use 'magic' patterns (extended regular expressions). set nofoldenable " Never fold (by defauld, override for sim languages) set inccommand=split exec 'set wildignore=' . join([ \ '.sass-cache', \ '\.DS_Store', \ '\.git$', \ '\~$', \ '\.swp$', \ 'gin-bin', \ '*/node_modules/*', \ ], ',') set noautochdir set signcolumn=yes set autoread let &scrolloff = 4 if exists('##CompleteChanged') && exists('*nvim_open_win') set pumblend=10 set wildoptions=pum endif let mapleader="," let maplocalleader = "-" " " select tabs nnoremap :tabnext nnoremap :tabprevious " move tabs nnoremap m :tabm +1 nnoremap m :tabm -1 " open and close tabs " nnoremap :tabnew nnoremap :quit nnoremap :split term://zshi " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by " other plugin before putting this into your config. inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. inoremap coc#refresh() " Use to confirm completion, `u` means break undo chain at current " position. Coc only does snippet and additional edit on confirm. " could be remapped by other vim plugin, try `:verbose imap `. if exists('*complete_info') inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" else inoremap pumvisible() ? "\" : "\u\" endif " Use `[g` and `]g` to navigate diagnostics nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) " 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('') else call CocAction('doHover') endif endfunction " Highlight the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') augroup mygroup autocmd! " Setup formatexpr specified filetype(s). autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') " Update signature help on jump placeholder. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end " Applying codeAction to the selected region. " Example: `aap` for current paragraph xmap a (coc-codeaction-selected) nmap a (coc-codeaction-selected) " Remap keys for applying codeAction to the current line. nmap ac (coc-codeaction-line) " Apply AutoFix to problem on the current line. nmap qf (coc-fix-current) " Introduce function text object " NOTE: Requires 'textDocument.documentSymbol' support from the language server. xmap if (coc-funcobj-i) xmap af (coc-funcobj-a) omap if (coc-funcobj-i) omap af (coc-funcobj-a) " Use for selections ranges. " NOTE: Requires 'textDocument/selectionRange' support from the language server. " coc-tsserver, coc-python are the examples of servers that support it. " nmap (coc-range-select) xmap (coc-range-select) " Add `:Format` command to format current buffer. command! -nargs=0 Format :call CocAction('format') " Add `:Fold` command to fold current buffer. command! -nargs=? Fold :call CocAction('fold', ) " Add `:OR` command for organize imports of the current buffer. command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') " Mappings using CoCList: " Symbol renaming. nmap rn (coc-rename) " Formatting selected code. xmap f (coc-format-selected) nmap f (coc-format-selected) nnoremap d :CocFzfList diagnostics --current-buf nnoremap c :CocFzfList commands nnoremap o :CocFzfList outline nnoremap s :CocFzfList symbols " nnoremap j :CocNext " nnoremap k :CocPrev autocmd BufWritePre *.go :call CocAction('organizeImport') autocmd FileType go nmap gta :call CocAction('runCommand', 'go.tags.add') autocmd FileType go nmap gtl :call CocAction('runCommand', 'go.tags.add.line') autocmd FileType go nmap gtr :call CocAction('runCommand', 'go.tags.remove') autocmd FileType go nmap gtj :call CocAction('runCommand', 'go.tags.add', 'json') autocmd FileType go nmap gty :call CocAction('runCommand', 'go.tags.add', 'yaml') autocmd FileType go nmap gtx :call CocAction('runCommand', 'go.tags.clear')