diff options
| author | Marc Vertes <mvertes@free.fr> | 2025-02-04 14:24:25 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2025-02-04 14:24:25 +0100 |
| commit | 4565bf0e5b60fa1ce1db83bd5ca2c93857d542ca (patch) | |
| tree | d56199324dcf4a473fe6009293f980020b004328 | |
| parent | 25455770b692d30daa30de36eab5ca257d0ad169 (diff) | |
vim: improve quickfix
| -rw-r--r-- | .bashrc | 6 | ||||
| -rw-r--r-- | .vimrc | 54 |
2 files changed, 31 insertions, 29 deletions
@@ -18,25 +18,23 @@ stty -ixon # disable Ctrl-S # Save and reload the history after each command finishes #export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" +# export GNUTERM='sixelgd enhanced truecolor font "arial,9"' +# OS=${OS:-$(~/bin/os)} # Support different operating system environments case $OS in (arch|alpine) - export GNUTERM='sixelgd enhanced truecolor font "arial,9"' alias ls='ls --color=auto -v' ll='ls -AlFhv' [ "$OS" = arch ] || trap 'printf "\e]2;${PWD/~/\~} ${BASH_COMMAND%ps1}\a"' DEBUG ;; (Darwin) - export GNUTERM='sixelgd enhanced truecolor size 1600,1200 font "arial,9"' alias ls='ls -GF' ll='ls -AlGFhv' alias ldd='otool -L' alias ibrew='arch -x86_64 /usr/local/bin/brew' - trap 'printf "\e]2;${PWD/~/\~} ${BASH_COMMAND%update_terminal_cwd}\a"' DEBUG ;; (termux) PATH=~/bin:${HOME%/*}/usr/bin:~/go/bin - export GNUTERM='sixelgd enhanced truecolor font "arial,9"' type eza >/dev/null && alias ls='eza' ll='eza -lao --no-user --no-permissions' || alias ls='ls --color=auto -v' ll='ls -AlFhv' ;; @@ -10,6 +10,7 @@ filetype on filetype plugin on filetype plugin indent on let mapleader = "," +set autochdir " Save all files at the same place set backupdir=~/.vim/backup// @@ -18,7 +19,6 @@ set undodir=~/.vim/backup// set undofile set backup -" set autochdir " ignore case when searching, except mixing upper and lower set ignorecase @@ -52,6 +52,11 @@ autocmd filetype vimki nmap <leader>z :FZF ~/Wiki<CR> autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 +autocmd BufNewFile,BufRead *.gno setlocal noexpandtab tabstop=4 shiftwidth=4 +autocmd BufNewFile,BufRead *.gno set filetype=gno + +autocmd Filetype go set mp=go\ build + let g:netrw_browsex_viewer = "xdg-open" let g:netrw_gx = "<cWORD>" let g:netrw_banner = 0 @@ -67,20 +72,9 @@ autocmd filetype python,yaml setlocal ts=2 sts=2 sw=2 et " noremap <M-a> :!cscope -0 <cword>
" noremap <M-f> :!cscope -7 <cfile>
-" Paragraph format / unformat -" An alternate way is to use "gqip" to format. -" noremap <leader>f !}fmt -72 -s -p
-" noremap <leader>F !}fmt -c -w 2048
+" Paragraph format noremap <leader>f gqip -" noremap <buffer> K :s,^,//,
-" noremap <buffer> <C-K> :s,^//,,
-" noremap <buffer> # :s,^,#,
-" noremap <buffer> @ :s,^#,,
-"hi MatchParen term=reverse ctermbg=magenta ctermfg=none -" hi MatchParen cterm=reverse term=reverse ctermfg=white -" - " Fix spell highlighting hi clear SpellBad hi SpellBad cterm=underline @@ -92,21 +86,29 @@ noremap <leader>o :!open <cWORD>&<cr><cr> noremap <C-g> :tag <c-r><c-w><cr> noremap <C-p> :Files<cr> +noremap <leader>e :cn<cr> " go to quickfix next error +noremap <leader>E :cp<cr> " go to quickfix previous error +noremap <leader>m :make<cr><cr> " make + +" Quickfix window opens automatically if not empty +autocmd QuickFixCmdPost [^l]* nested cwindow +autocmd QuickFixCmdPost l* nested lwindow + " MacOS: Open QuickLook on current file (for markdown preview mainly) noremap <leader>w :!ql %<CR><CR> function! CloseOnLast() -let cnt = 0 -for i in range(0, bufnr("$")) -if buflisted(i) - let cnt += 1 + let cnt = 0 + for i in range(0, bufnr("$")) + if buflisted(i) + let cnt += 1 + endif + endfor + if cnt <= 1 + q + else + bd endif -endfor - if cnt <= 1 - q -else - bd -endif endfunction noremap <leader><leader> :call CloseOnLast()<cr> @@ -115,6 +117,8 @@ noremap <leader><leader> :call CloseOnLast()<cr> let g:lsp_diagnostics_enabled = 0 let g:lsp_document_code_action_signs_enabled = 0 let g:lsp_document_highlight_enabled = 0 +"let g:lsp_log_verbose = 1 +"let g:lsp_log_file = expand('~/vim-lsp.log') if executable('gopls') au User lsp_setup call lsp#register_server({ @@ -130,8 +134,8 @@ endif if executable('gnopls') au User lsp_setup call lsp#register_server({ \ 'name': 'gnopls', - \ 'cmd': {server_info->['gnopls', '-remote=auto']}, - \ 'allowlist': ['gno', 'gnomod'], + \ 'cmd': {server_info->['gnopls']}, + \ 'allowlist': ['gno'], \ }) autocmd BufWritePre *.gno \ call execute('LspDocumentFormatSync') | |
