如果您熟悉iTerm2应用程序,您将知道您可以拆分类似于vim的视图,而不活动的视图会变暗.
我通常使用vim进行三个垂直分割视图,例如通过将背景颜色设置为较暗的色调来调暗不活动的图像.
有没有办法做到这一点?
我想出了以下解决方案(使用’colorcolumn’和取消设置’cursorline’):
原文链接:https://www.f2er.com/bash/386745.html" Dim inactive windows using 'colorcolumn' setting " This tends to slow down redrawing,but is very useful. " Based on https://groups.google.com/d/msg/vim_use/IJU-Vk-QLJE/xz4hjPjCRBUJ " XXX: this will only work with lines containing text (i.e. not '~') function! s:DimInactiveWindows() for i in range(1,tabpagewinnr(tabpagenr(),'$')) let l:range = "" if i != winnr() if &wrap " HACK: when wrapping lines is enabled,we use the maximum number " of columns getting highlighted. This might get calculated by " looking for the longest visible line and using a multiple of " winwidth(). let l:width=256 " max else let l:width=winwidth(i) endif let l:range = join(range(1,l:width),',') endif call setwinvar(i,'&colorcolumn',l:range) endfor endfunction augroup DimInactiveWindows au! au WinEnter * call s:DimInactiveWindows() au WinEnter * set cursorline au WinLeave * set nocursorline augroup END
查看我的(当前)dotfiles:https://github.com/blueyed/dotfiles/blob/master/vimrc#L351
更新
我已经创建了一个插件:https://github.com/blueyed/vim-diminactive