<p>Hey vim users. I am trying to find a good way to close both quickfix and location list with one shortcut.</p>
<p>I am currently using some parts of the <a href="https://github.com/fatih/dotfiles/blob/master/vimrc">vim-go author's .vimrc</a> like this:</p>
<pre><code>let mapleader = ","
" Some useful quickfix shortcuts for quickfix
map <C-n> :cn<CR>
map <C-m> :cp<CR>
nnoremap <leader>a :cclose<CR>
</code></pre>
<p>Which is great for quickly closing the quickfix window. But what about location list? Can both be closed with 1 shortcut? </p>
<p>If not, care to share your favorite 2 shortcuts for closing each one of them?</p>
<hr/>**评论:**<br/><br/>sihnon: <pre><p>Why not just:</p>
<pre><code>nnoremap <silent> <leader>a :cclose<CR>:lclose<CR>
</code></pre></pre>nesigma: <pre><p>Thanks! This seems to be working fine. Can you tell me the reason why you added <silent> in front?</p></pre>sihnon: <pre><p>Suppresses non-error messages and doesn't add them to the message history. See <code>:help silent</code> for more info.</p></pre>Swimbo: <pre><p>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. </p></pre>nesigma: <pre><blockquote>
<p>you can configure the vim-go plugin to open everything in a quickfix window.</p>
</blockquote>
<p>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.</p>
<p>I am going with this command for now as it seems to be solving the problem:</p>
<blockquote>
<p>nnoremap <silent> <leader>a :cclose<CR>:lclose<CR></p>
</blockquote></pre>zekzekus: <pre><p>there are plugins for this. of course not related to vim-go. </p>
<p>it is a vim issue to close <code>less important</code> or <code>supporting</code> type of buffers. </p>
<p>my personal preference is <a href="https://github.com/szw/vim-smartclose" rel="nofollow">https://github.com/szw/vim-smartclose</a></p></pre>nesigma: <pre><blockquote>
<p>there are plugins for this.</p>
</blockquote>
<p>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:</p>
<blockquote>
<p>nnoremap <silent> <leader>a :cclose<CR>:lclose<CR></p>
</blockquote>
<p>Thanks for the reply.</p></pre>
![](https://static.golangjob.cn/static/img/banner.png)