Move everything to coc.vim (snippets, yank, ale, prettier etc. all obsolete)

main
Steffen Rademacker 4 years ago
parent ed4fbdd889
commit ee06a5f4c5

@ -18,19 +18,5 @@ augroup init
autocmd FileType mail setlocal comments+=nb:>
autocmd FileType mail setlocal formatoptions+=awq
autocmd BufNewFile,BufRead neomutt-* set ft=mail
" add the dash to keywords -- makes better css/js/html search
" do this for specific files only (not in php/rb e.g.) where dashes are
" not used in variable names (use camelCase instead here)
autocmd BufNewFile,BufRead *.{js,css,scss,html} set iskeyword+=-
autocmd BufNewFile,BufRead *.{js,css,scss,html} set iskeyword-=_
autocmd BufNewFile,BufRead *.php set iskeyword-=-
" omnicompletion for some filetypes
autocmd FileType css,scss setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,php,twig setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
augroup END

@ -32,6 +32,7 @@ set scrolljump=5
set scrolloff=3
set shiftround
set shiftwidth=2
set shortmess+=c
set showbreak=\\\\\
set showmatch
set sidescroll=10
@ -39,7 +40,7 @@ set sidescrolloff=5
set smartcase
set softtabstop=2
set tabstop=2
set termguicolors
set updatetime=300
set virtualedit=all
set visualbell
set wildmode=list:longest,list:full

@ -8,12 +8,9 @@ call dein#begin(expand('~/.config/nvim/dein'))
call dein#add('editorconfig/editorconfig-vim')
call dein#add('junegunn/fzf', { 'merged': 0 })
call dein#add('junegunn/fzf.vim', { 'depends': 'fzf' })
call dein#add('maxbrunsfeld/vim-yankstack')
call dein#add('neoclide/coc.nvim', { 'merged': 0, 'rev': 'release' })
call dein#add('rrethy/vim-hexokinase', { 'build': 'make hexokinase' })
call dein#add('sheerun/vim-polyglot')
call dein#add('shougo/dein.vim')
call dein#add('shougo/neosnippet')
call dein#add('tpope/vim-commentary')
call dein#add('tpope/vim-eunuch')
call dein#add('tpope/vim-ragtag')
@ -22,10 +19,8 @@ call dein#begin(expand('~/.config/nvim/dein'))
call dein#add('tpope/vim-unimpaired')
call dein#add('tpope/vim-vinegar')
call dein#add('w0ng/vim-hybrid')
call dein#add('w0rp/ale')
call dein#add('wellle/targets.vim')
call dein#add('wellle/tmux-complete.vim')
call dein#add('wincent/ferret')
call dein#add('wincent/terminus')
" group these, since vim-twiggy/GV requires fugitive

@ -14,27 +14,9 @@ function! s:ToggleZoom() abort
endif
endfunction
function! s:TogglePrettier()
if g:ale_fix_on_save == 0
let g:ale_fix_on_save = 1
echomsg "Prettier fixing is now enabled!"
else
let g:ale_fix_on_save = 0
echomsg "Prettier fixing is now disabled!"
endif
endfunction
" shortcust for functions
command! ToggleZoom call s:ToggleZoom()
command! TogglePrettier call s:TogglePrettier()
" zoomwindow
nnoremap <leader>z :ToggleZoom<CR>
" ale
nnoremap <leader>e :ALENext<CR>
nnoremap <leader>f :TogglePrettier<CR>
" open new vertical split and change to split
nnoremap <leader>\ <C-w>v<C-w>l
nnoremap <leader>- <C-w>s<C-w>j

@ -1,13 +1,3 @@
" colors
let g:Hexokinase_highlighters = ['backgroundfull']
let g:Hexokinase_optInPatterns = ['full_hex', 'triple_hex', 'rgb', 'rgba', 'hsl', 'hsla']
let g:Hexokinase_ftEnabled = ['css', 'scss', 'html', 'javascript', 'php', 'json', 'json5']
" ferret multifile search
let g:FerretExecutable='rg'
let g:FerretMaxResults=1000000
let g:FerretNvim=1
" fugitive
nnoremap <silent> <leader>gs :G<CR><C-w>20+
nnoremap <silent> <leader>gd :Gvdiff<CR><C-w>20+
@ -15,47 +5,6 @@ nnoremap <silent> <leader>gc :Gcommit<CR><C-w>20+
nnoremap <silent> <leader>gw :Gwrite<CR><C-w>20+
nnoremap <silent> <leader>gb :Gblame<CR><C-w>20+
" neosnippet
let g:neosnippet#disable_runtime_snippets={ "_": 1 }
let g:neosnippet#scope_aliases={}
let g:neosnippet#scope_aliases['scss']='scss,css'
let g:neosnippet#scope_aliases['php']='php,html'
let g:neosnippet#snippets_directory='~/.config/nvim/snippets'
imap <C-j> <Plug>(neosnippet_expand_or_jump)
smap <C-j> <Plug>(neosnippet_expand_or_jump)
xmap <C-j> <Plug>(neosnippet_expand_target)
" ale
let g:ale_fix_on_save=0
let g:ale_lint_on_enter=1
let g:ale_lint_on_insert_leave=0
let g:ale_lint_on_save=1
let g:ale_lint_on_text_changed=0
let g:ale_linters_explicit=1
let g:ale_linters = {
\ 'css': ['stylelint'],
\ 'html': ['htmllint'],
\ 'javascript': ['eslint'],
\ 'javascriptreact': ['eslint'],
\ 'json': ['jsonlint'],
\ 'jsx': ['eslint'],
\ 'php': ['php'],
\ 'scss': ['stylelint'],
\ 'typescript': ['tslint'],
\}
let g:ale_fixers = {
\ 'css': ['prettier'],
\ 'javascript': ['prettier'],
\ 'javascriptreact': ['prettier'],
\ 'json': ['prettier'],
\ 'jsx': ['prettier'],
\ 'markdown': ['prettier'],
\ 'scss': ['prettier'],
\ 'typescript': ['prettier'],
\ 'yaml': ['prettier'],
\}
" fzf
nnoremap <silent> <space>, :Files<cr>
nnoremap <silent> <space>. :Buffers<cr>
@ -63,12 +12,80 @@ nnoremap <silent> <space>l :Lines<cr>
nnoremap <silent> <space>a :Rg<cr>
nnoremap <silent> <space>h :History:<cr>
" yankstack, use alt + p, alt + P
nmap π <Plug>yankstack_substitute_older_paste
nmap<Plug>yankstack_substitute_newer_paste
" EasyMotion
let g:EasyMotion_do_mapping=0
let g:EasyMotion_smartcase=1
nmap <leader>s <Plug>(easymotion-overwin-f)
nmap <leader>S <Plug>(easymotion-overwin-f2)
" COC.vim
inoremap <silent><expr> <C-j>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<C-j>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<c-j>'
" 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
" 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
" Leader mappings
nmap <leader>c <Plug>(coc-rename)
nmap <leader>e <Plug>(coc-diagnostic-next)
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" Selection ranges
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" coc-yank, replaces yankstack, use alt + p
nnoremap π :<C-u>CocList -A --normal yank<cr>
" coc multiple cursors (very helpful for when in CocSearch)
hi CocCursorRange ctermbg=139 ctermfg=234
nmap <silent> <c-n> <Plug>(coc-cursors-word)*
xmap <silent> <c-n> y/\V<C-r>=escape(@",'/\')<CR><CR>gN<Plug>(coc-cursors-range)gn

@ -21,10 +21,13 @@ function! MyStatusLine(mode)
else
let statusline .= "%#NoStatusLineColor#"
endif
let statusline .= "\ %f\ %m%r %{StatuslineGitInfo()}\ "
let statusline .= "\ %f\ %m%r"
let statusline .= "%= "
let statusline .= "%{toupper(mode())}"
let statusline .= "\ %{StatusLinePaste()}"
let statusline .= "\ %{fugitive#head()}"
let statusline .= "%= "
let statusline .= "%{coc#status()}"
let statusline .= "%= "
let statusline .= "%{toupper(mode())}\ %{StatusLinePaste()}"
let statusline .= "%= "
let statusline .= "\ %y\ %{&fileencoding?&fileencoding:&encoding}\/\%{&fileformat}\ \|\ %l:%c\ "
return statusline

Loading…
Cancel
Save