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

agolangf · 2016-12-25 14:00:22 · 612 次点击    
这是一个分享于 2016-12-25 14:00:22 的资源,其中的信息可能已经有所发展或是发生改变。

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:

Why not just:

nnoremap <silent> <leader>a :cclose<CR>:lclose<CR>
nesigma:

Thanks! This seems to be working fine. Can you tell me the reason why you added <silent> in front?

sihnon:

Suppresses non-error messages and doesn't add them to the message history. See :help silent for more info.

Swimbo:

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.

nesigma:

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>

zekzekus:

there are plugins for this. of course not related to vim-go.

it is a vim issue to close less important or supporting type of buffers.

my personal preference is https://github.com/szw/vim-smartclose

nesigma:

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.


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

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