1
0
Fork 0

Improve vim config

This commit is contained in:
Malte Brandy 2021-01-19 05:09:48 +01:00
parent b42b0ae6ff
commit 2e769d92a3
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
3 changed files with 28 additions and 5 deletions

View file

@ -9,13 +9,13 @@ let
# coc-tabnine (TODO: Why doesnt it work?)
# TODO: tabnine config in home-manager
# TODO: tabnine lsp: nix, rust, pandoc/latex lsp? was noch?
# TODO: coc-explorer, coc-markdownlints are installed statefully right now
# ===
# Basic IDE plugins
coc-nvim airline
# same word highlighting when not supported by language
coc-highlight
coc-explorer
# searches
coc-fzf fzf-vim
@ -38,6 +38,7 @@ let
haskell-vim vim-hoogle
# nix syntax highlighting
vim-nix
vim-markdown
# latex
vimtex coc-vimtex # not sure if I need two
# ledger
@ -64,6 +65,7 @@ let
"diagnostic.maxWindowHeight" = 60;
"diagnostic.virtualText" = true;
"diagnostic.virtualTextCurrentLineOnly" = false;
"coc.preferences.hoverTarget" = "preview";
"codeLens.enable" = true;
languageserver = {
markdown = {

View file

@ -34,7 +34,7 @@ augroup focus
au BufLeave * silent! wall
augroup END
nnoremap <silent><cr> :nohlsearch<CR>
nnoremap <silent><cr> :pc<CR>:nohlsearch<CR>
vnoremap < <gv
vnoremap > >gv
nnoremap <c-down> <c-w><c-j>
@ -136,13 +136,32 @@ nmap <silent> gc :Gcommit<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
call CocAction('doHover')
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
nmap <silent> <space>i :call <SID>show_documentation()<CR>
"nmap <silent> <space>i :call <SID>show_documentation()<CR>
autocmd CursorHold * silent call s:show_documentation()
function! Preview_func()
if &pvw
setlocal foldcolumn=0
setlocal signcolumn=no
setlocal nonumber
let idealheight=line('$')+2
let width=min([&columns-40])
let left=&columns-width
let height=min([idealheight,&lines-3,60])
let top=&lines-2-height
call nvim_win_set_config(0,{'relative': 'editor','width':width,'height':height,'row':top,'col':left})
endif
endfunction
autocmd BufWinEnter * call Preview_func()
" Remap for rename current word
nmap <space>r <Plug>(coc-rename)

View file

@ -9,4 +9,6 @@ let
in {
laminar = laminarPkgs.laminar;
syncthingNext = unstable.syncthing;
vimPlugins = unstable.vimPlugins;
fzf = unstable.fzf;
}