From 4964ae0d119b876c9e1c87fa0f645c3587eee7ea Mon Sep 17 00:00:00 2001 From: navewindre Date: Wed, 23 Oct 2024 07:40:17 +0200 Subject: a --- vimrc | 59 +++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 14 deletions(-) (limited to 'vimrc') diff --git a/vimrc b/vimrc index cc545a7..2a55d8e 100644 --- a/vimrc +++ b/vimrc @@ -394,6 +394,22 @@ function! SW() endfunction function! Q() + let float_visible = 0 + let winid = 0 + for win in range(1, winnr('$')) + let config = nvim_win_get_config(win_getid(win)) + if has_key(config, 'relative') && config.relative != '' + let float_visible = 1 + let winid = win_getid(win) + break + endif + endfor + if float_visible + call nvim_win_close(winid, v:true) + return + endif + + if exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1 NERDTreeClose else @@ -444,42 +460,54 @@ function! OpenLsp() endif endfor - if !float_visible - lua vim.lsp.buf.hover() + if float_visible + call Q() endif + + call feedkeys('K') endfunction function! OpenFloat() let float_visible = 0 + let g:float_winid = 0 for win in range(1, winnr('$')) let config = nvim_win_get_config(win_getid(win)) if has_key(config, 'relative') && config.relative != '' let float_visible = 1 + let g:float_winid = win_getid(win) break endif endfor - if !float_visible - lua vim.diagnostic.open_float(nil, {focus=false}) - endif - for win in range(1, winnr('$')) - let config = nvim_win_get_config(win_getid(win)) - if has_key(config, 'relative') && config.relative != '' - let float_visible = 1 - break - endif - endfor +lua <') + let parts = split(file_line, '#L') + if len(parts) > 1 + execute 'e +' . parts[1] . ' ' . parts[0] | sleep 200m + execute('call lightline#bufferline#go_next()') + set number + else + normal! gf endif endfunction +nnoremap gf :call GFLine() vnoremap ap :call AddSpacesToParentheses() autocmd BufReadPost * call TurnOffDiag() +nnoremap :noh + nnoremap :NERDTree inoremap :NERDTree vnoremap :NERDTree @@ -528,6 +556,9 @@ nnoremap t :call OpenFloat() nnoremap T :call OpenLsp() nnoremap gd +nnoremap gd :Telescope diagnostics + +nnoremap gr :Telescope lsp_references nnoremap [[ ?{:nohl nnoremap ]] /}:nohl -- cgit v1.2.3