加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Vim Powerline与Syntastic段

发布时间:2020-12-15 21:32:54 所属栏目:安全 来源:网络整理
导读:如何为Vim的 powerline页脚添加 syntastic段? (新的powerline,而不是vim-powerline)Syntastic docs只说如何将它添加到标准的Vim页脚,我找不到如何在 powerline docs中添加它. 解决方法 这些指令大部分来自 this pull request (451)电力线. 此拉取请求会向电
如何为Vim的 powerline页脚添加 syntastic段? (新的powerline,而不是vim-powerline)Syntastic docs只说如何将它添加到标准的Vim页脚,我找不到如何在 powerline docs中添加它.

解决方法

这些指令大部分来自 this pull request (451)电力线.

此拉取请求会向电力线添加语法段.由于该段未合并到主电力线树中,因此您需要手动预先形成补丁.值得庆幸的是,您只需要修改三个文件. (表示添加行/ – 表示删除行).查看彩色差异的拉取请求.

文件:powerline / config_files / colorschemes / vim / default.json(第28行)

"line_current_symbol": { "fg": "gray1","bg": "gray10" },"virtcol_current_gradient": { "fg": "dark_GREEN_Orange_red","col_current": { "fg": "gray6",-    "modified_buffers": { "fg": "brightyellow","bg": "gray2" }
+    "modified_buffers": { "fg": "brightyellow","bg": "gray2" },+    "syntastic_segment": { "fg": "brightestred","bg": "gray2","attr": ["bold"] }
   },"mode_translations": {
     "nc": {

文件:powerline / config_files / colorschemes / vim / default.json(第68行)

"groups": {
         "mode": { "fg": "darkestcyan","bg": "white","attr": ["bold"] },"background:divider": { "fg": "darkcyan","bg": "darkestblue" },-        "branch:divider": { "fg": "darkcyan","bg": "darkblue" }
+        "branch:divider": { "fg": "darkcyan","bg": "darkblue" },+        "syntastic_segment": { "fg": "white","bg": "darkestblue","attr": ["bold"] }
       }
     },"v": {

文件:powerline / config_files / colorschemes / vim / solarized.json(第27行)

"line_current":             { "fg": "gray13","bg": "lightyellow","line_current_symbol":      { "fg": "gray13","bg": "lightyellow" },"virtcol_current_gradient": { "fg": "GREEN_Orange_red",-    "col_current":              { "fg": "azure4","bg": "lightyellow" }
+    "col_current":              { "fg": "azure4",+    "syntastic_segment":        { "fg": "red","bg": "royalblue5","mode_translations": {
     "nc": {

文件:powerline / config_files / colorschemes / vim / solarized.json(第65行)

"line_percent_gradient":  { "fg": "oldlace","bg": "gray61" },"line_current":           { "fg": "gray13","bg": "oldlace","line_current_symbol":    { "fg": "gray13","bg": "oldlace" },-        "col_current":            { "fg": "azure4","bg": "oldlace" }
+        "col_current":            { "fg": "azure4",+        "syntastic_segment":      { "fg": "lightyellow","bg": "darkgreencopper","v": {

文件:powerline / segments / vim.py(第23行)

'expand': vim_get_func('expand',rettype=str),'bufnr': vim_get_func('bufnr',rettype=int),'line2byte': vim_get_func('line2byte',+  'exists': vim_get_func('exists',}

 vim_modes = {

在powerline / segments / vim.py的末尾添加以下功能. (确保使用制表符缩进该函数.您正在修改python文件缩进事项)

@window_cached
def syntastic_segment(pl):
    '''Return the syntastic statusline flag
    '''
    if int(vim_funcs['exists']('*SyntasticStatuslineFlag')) > 0:
        syntastic_flag_func = vim_get_func('SyntasticStatuslineFlag',rettype=str)
        return [{
            'contents': str(syntastic_flag_func()),}]
    else:
        return None

完成所有这些更改后,您需要现在打开该段.一种方法是编辑配置文件?/ .config / powerline / themes / vim / default.json

在节段中:将以下部分放在右侧或左侧部分中.

{
    "name": "syntastic_segment","before": " "
},

完成所有这些更改后,您现在应该能够在电源线段上看到合成错误输出.

故障排除:

>如果你将解析错误引入json,你就可以开始使用vim –noplugin来启动vim而没有插件到powerline也不会尝试解析文件.>确保json的逗号位于正确的位置.>编辑时,确保在python文件中使用了制表符而不是空格.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读