vim – 昏暗的非活动分割窗格
发布时间:2020-12-15 18:54:53 所属栏目:安全 来源:网络整理
导读:如果您熟悉iTerm2应用程序,您将知道您可以拆分类似于vim的视图,而不活动的视图会变暗. 我通常使用vim进行三个垂直分割视图,例如通过将背景颜色设置为较暗的色调来调暗不活动的图像. 有没有办法做到这一点? 我想出了以下解决方案(使用’colorcolumn’和取消
如果您熟悉iTerm2应用程序,您将知道您可以拆分类似于vim的视图,而不活动的视图会变暗.
我通常使用vim进行三个垂直分割视图,例如通过将背景颜色设置为较暗的色调来调暗不活动的图像. 有没有办法做到这一点?
我想出了以下解决方案(使用’colorcolumn’和取消设置’cursorline’):
" 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 更新 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |