vim-go: Anyone knows a good way to close both quickfix and location list with one shortcut?

agolangf · · 502 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<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&#39;s .vimrc</a> like this:</p> <pre><code>let mapleader = &#34;,&#34; &#34; Some useful quickfix shortcuts for quickfix map &lt;C-n&gt; :cn&lt;CR&gt; map &lt;C-m&gt; :cp&lt;CR&gt; nnoremap &lt;leader&gt;a :cclose&lt;CR&gt; </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 &lt;silent&gt; &lt;leader&gt;a :cclose&lt;CR&gt;:lclose&lt;CR&gt; </code></pre></pre>nesigma: <pre><p>Thanks! This seems to be working fine. Can you tell me the reason why you added &lt;silent&gt; in front?</p></pre>sihnon: <pre><p>Suppresses non-error messages and doesn&#39;t add them to the message history. See <code>:help silent</code> for more info.</p></pre>Swimbo: <pre><p>I&#39;m on mobile so I can&#39;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&#39;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 &lt;silent&gt; &lt;leader&gt;a :cclose&lt;CR&gt;:lclose&lt;CR&gt;</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&#39;t solve the problem:</p> <blockquote> <p>nnoremap &lt;silent&gt; &lt;leader&gt;a :cclose&lt;CR&gt;:lclose&lt;CR&gt;</p> </blockquote> <p>Thanks for the reply.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

502 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传