<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>
vim-go: Anyone knows a good way to close both quickfix and location list with one shortcut?
agolangf · · 502 次点击这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传