vim中是否有方法(或插件)突出显示当前范围。
说,我在内部功能。 VIM应该使用明亮的背景功能和深色背景。
当我进入函数内部的循环内部时,只有循环应该有明亮的背景,其他一切都变得稍暗。
答案 0 :(得分:0)
junegunn有一个非常好的插件,可以完全按照你想要的那样进行操作
https://github.com/junegunn/limelight.vim
我定制了一些东西,以使其表现得更好:
"--------------------------------------------------------------------------------
"MAPPINGS{{{
"--------------------------------------------------------------------------------
" limelight works on ranges. Declare limelight to bein on content of current line
nnoremap <space>lb :let g:limelight_bop='^'.getline('.').'$'<cr>
" limelight works on ranges. Declare limelight to end on contents of current line
nnoremap <space>le :let g:limelight_eop='^'.getline('.').'$'<cr>
"decrement
nnoremap <space>ld :call SetLimeLightIndent(g:limelightindent - 4)<cr>
"increment
nnoremap <space>li :call SetLimeLightIndent(g:limelightindent + 4)<cr>
"reset indent to default 4
nnoremap <space>lr :call SetLimeLightIndent(4)<cr>
" set limelight toggle
noremap <space>ls :call SetLimeLightIndent(8)
nnoremap <space>lt :Limelight!!<cr>
"-----------------------------------------------------------------------------}}}
"FUNCTIONS{{{
"--------------------------------------------------------------------------------
let g:limelightindent=4
function! LimeLightExtremeties()
let limelight_start_stop='^\s\{0,'.g:limelightindent.'\}\S'
let g:limelight_eop=limelight_start_stop
let g:limelight_bop=limelight_start_stop
Limelight!!
Limelight!!
echo 'limelightindent = '.g:limelightindent
endfunction
function! SetLimeLightIndent(count)
let g:limelightindent = a:count
if(g:limelightindent < 0)
g:limelightindent = 0
endif
call LimeLightExtremeties()
endfunction
"-----------------------------------------------------------------------------}}}
command! -nargs=* SetLimeLightIndent call SetLimeLightIndent(<args>)