VIM突出显示当前范围

问题描述 投票:0回答:1

是否有一种方式(或插件)在vim中突出显示当前范围。

说,我在里面功能。 VIM应该使用明亮的背景功能和深色背景。

当我在函数内部的一个循环内移动时,只有循环应该有明亮的背景,其他一切都变得稍暗。

editor syntax-highlighting vim-plugin vim-syntax-highlighting
1个回答
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>)
© www.soinside.com 2019 - 2024. All rights reserved.