小编jpo*_*ppe的帖子

如何在调用自定义VIM(Python)函数后将状态发送到VIM状态行

我刚刚创建了我的第一个VIM脚本,我是用Python编写的.这是一个从目录(/ vim/etc/colors)切换颜色方案的简单脚本.我想知道如何在使用所选颜色方案的名称将颜色方案更改为vim'statusline'之后发送通知.

rson给出了我的问题的答案,这里是一个更新(和调试)的脚本版本,感兴趣的人(尽我所能测试)

实施(有点)AI和Caleb的建议,谢谢!:

" toggleColorScheme 0.9 (l) 2009 by Jasper Poppe <jpoppe@ebay.com>

" cycle through colorschemes with F8 and Shift+F8
nnoremap <silent><F8> :call ToggleColorScheme("1")<CR>
nnoremap <silent><s-F8> :call ToggleColorScheme("-1")<CR>

" set directory with color schemes to cycle through
let g:Toggle_Color_Scheme_Path = "/etc/vim/colors"


function! ToggleColorScheme(paramater)
python << endpython
import vim
import os

paramater = (vim.eval('a:paramater'))
scheme_path = vim.eval('g:Toggle_Color_Scheme_Path')

colorschemes = [color.split('.')[0] for color in os.listdir(scheme_path) if color.endswith('.vim')]
colorschemes.sort()

if not vars().has_key('position'):
    start_scheme = vim.eval('g:colors_name') + '.vim'
    if start_scheme in colorschemes:
        position …
Run Code Online (Sandbox Code Playgroud)

python vim scripting color-scheme

2
推荐指数
1
解决办法
1315
查看次数

标签 统计

color-scheme ×1

python ×1

scripting ×1

vim ×1