196 lines
6.3 KiB
VimL
196 lines
6.3 KiB
VimL
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 <silent><Tab> :tabnext<CR>
|
||
nnoremap <silent><S-Tab> :tabprevious<CR>
|
||
|
||
" move tabs
|
||
nnoremap <silent>m<Tab> :tabm +1<CR>
|
||
nnoremap <silent>m<S-Tab> :tabm -1<CR>
|
||
" open and close tabs
|
||
" nnoremap <silent><C-t> :tabnew<CR>
|
||
nnoremap <silent><C-q> :quit<CR>
|
||
|
||
nnoremap <silent><C-t> :split term://zsh<CR>i
|
||
|
||
|
||
|
||
|
||
" Use tab for trigger completion with characters ahead and navigate.
|
||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||
" other plugin before putting this into your config.
|
||
inoremap <silent><expr> <TAB>
|
||
\ pumvisible() ? "\<C-n>" :
|
||
\ <SID>check_back_space() ? "\<TAB>" :
|
||
\ coc#refresh()
|
||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||
|
||
function! s:check_back_space() abort
|
||
let col = col('.') - 1
|
||
return !col || getline('.')[col - 1] =~# '\s'
|
||
endfunction
|
||
|
||
" Use <c-space> to trigger completion.
|
||
inoremap <silent><expr> <c-space> coc#refresh()
|
||
|
||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
|
||
" position. Coc only does snippet and additional edit on confirm.
|
||
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
|
||
if exists('*complete_info')
|
||
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||
else
|
||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||
endif
|
||
|
||
" Use `[g` and `]g` to navigate diagnostics
|
||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||
|
||
" GoTo code navigation.
|
||
nmap <silent> gd <Plug>(coc-definition)
|
||
nmap <silent> gy <Plug>(coc-type-definition)
|
||
nmap <silent> gi <Plug>(coc-implementation)
|
||
nmap <silent> gr <Plug>(coc-references)
|
||
|
||
" Use K to show documentation in preview window.
|
||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||
|
||
function! s:show_documentation()
|
||
if (index(['vim','help'], &filetype) >= 0)
|
||
execute 'h '.expand('<cword>')
|
||
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: `<leader>aap` for current paragraph
|
||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||
|
||
" Remap keys for applying codeAction to the current line.
|
||
nmap <leader>ac <Plug>(coc-codeaction-line)
|
||
" Apply AutoFix to problem on the current line.
|
||
nmap <leader>qf <Plug>(coc-fix-current)
|
||
|
||
" Introduce function text object
|
||
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
|
||
xmap if <Plug>(coc-funcobj-i)
|
||
xmap af <Plug>(coc-funcobj-a)
|
||
omap if <Plug>(coc-funcobj-i)
|
||
omap af <Plug>(coc-funcobj-a)
|
||
|
||
" Use <TAB> 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 <silent> <TAB> <Plug>(coc-range-select)
|
||
xmap <silent> <TAB> <Plug>(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', <f-args>)
|
||
|
||
" 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 <leader>rn <Plug>(coc-rename)
|
||
|
||
" Formatting selected code.
|
||
xmap <leader>f <Plug>(coc-format-selected)
|
||
nmap <leader>f <Plug>(coc-format-selected)
|
||
|
||
nnoremap <leader>d :CocFzfList diagnostics --current-buf<cr>
|
||
nnoremap <leader>c :CocFzfList commands<cr>
|
||
nnoremap <leader>o :CocFzfList outline<cr>
|
||
nnoremap <leader>s :CocFzfList symbols<cr>
|
||
|
||
|
||
|
||
" nnoremap <leader>j :<C-u>CocNext<CR>
|
||
" nnoremap <leader>k :<C-u>CocPrev<CR>
|
||
|
||
|
||
autocmd BufWritePre *.go :call CocAction('organizeImport')
|
||
|
||
autocmd FileType go nmap <buffer> gta :call CocAction('runCommand', 'go.tags.add')<cr>
|
||
autocmd FileType go nmap <buffer> gtl :call CocAction('runCommand', 'go.tags.add.line')<cr>
|
||
autocmd FileType go nmap <buffer> gtr :call CocAction('runCommand', 'go.tags.remove')<cr>
|
||
autocmd FileType go nmap <buffer> gtj :call CocAction('runCommand', 'go.tags.add', 'json')<cr>
|
||
autocmd FileType go nmap <buffer> gty :call CocAction('runCommand', 'go.tags.add', 'yaml')<cr>
|
||
autocmd FileType go nmap <buffer> gtx :call CocAction('runCommand', 'go.tags.clear')<cr>
|
||
|