vim – 切换错误位置面板在合成

如何设置键盘快捷键以在vim中切换“合成错误位置列表”面板。

错误显示位置面板

:lclose – 隐藏位置面板

我对VimScript很新,如果有办法检查位置列表面板的可见性。这应该是相当容易做到的。

我不知道如何区分* quickfix和位置列表,但代替检查位置列表是否显示,我建议只是关闭它,并检查显示的窗口数是否已更改:
function! ToggleErrors()
    let old_last_winnr = winnr('$')
    lclose
    if old_last_winnr == winnr('$')
        " Nothing was closed,open syntastic error location panel
        Errors
    endif
endfunction

*如果您的解决方案将尝试lclose,如果任何活动检查使用buftype quickfix显示的缓冲区:

function! ToggleErrors()
    if empty(filter(tabpagebuflist(),'getbufvar(v:val,"&buftype") is# "quickfix"'))
         " No location/quickfix list shown,open syntastic error location panel
         Errors
    else
        lclose
    endif
endfunction

。请注意,lclose不会关闭quickfix列表。

要使用Ctrl-e切换错误面板,您可以使用以下映射

nnoremap <silent> <C-e> :<C-u>call ToggleErrors()<CR>

相关文章

普通模式 >G 增加当前行到文档末尾处的缩紧层级 $ 移动到本行的末尾 . 相当于一个...
原文连接: https://spacevim.org/cn/layers/lang/elixir/ 模块简介 功能特性 启用模块 快捷键 语言专属...
原文连接: https://spacevim.org/cn/layers/lang/dart/ 模块简介 功能特性 依赖安装及启用模块 启用模...
 =   赋值操作符,可以用于算术和字符串赋值 +        加法计算     -        减法运算...
1.根据包名来查看指定的APP指定数据 adb shell "top | grep com.xxx.xxx" 由于这样打印出来的数...
ctrl+F 向下翻页 ctrl+B 向下翻页 u 取消最近一次操作 U 取消当前行的操作 ZZ 保存当前内容并退出 gg 跳...