Hey vim users. I am trying to find a good way to close both quickfix and location list with one shortcut.
I am currently using some parts of the vim-go author's .vimrc like this:
let mapleader = ","
" Some useful quickfix shortcuts for quickfix
map <C-n> :cn<CR>
map <C-m> :cp<CR>
nnoremap <leader>a :cclose<CR>
Which is great for quickly closing the quickfix window. But what about location list? Can both be closed with 1 shortcut?
If not, care to share your favorite 2 shortcuts for closing each one of them?
评论:
sihnon:
nesigma:Why not just:
nnoremap <silent> <leader>a :cclose<CR>:lclose<CR>
sihnon:Thanks! This seems to be working fine. Can you tell me the reason why you added <silent> in front?
Swimbo:Suppresses non-error messages and doesn't add them to the message history. See
:help silent
for more info.
nesigma:I'm on mobile so I can't link to the documentation , but you can configure the vim-go plugin to open everything in a quickfix window.
zekzekus:you can configure the vim-go plugin to open everything in a quickfix window.
Thanks for the reply. I'd rather not do that. I am pretty sure there is a very good reason some commands choose what they choose.
I am going with this command for now as it seems to be solving the problem:
nnoremap <silent> <leader>a :cclose<CR>:lclose<CR>
nesigma:there are plugins for this. of course not related to vim-go.
it is a vim issue to close
less important
orsupporting
type of buffers.my personal preference is https://github.com/szw/vim-smartclose
there are plugins for this.
I try to use as less plugins as possible but I would probably use something like that if this command didn't solve the problem:
nnoremap <silent> <leader>a :cclose<CR>:lclose<CR>
Thanks for the reply.
