跨过支架、圆括号等,并在Vim中插入凸耳

跨过支架、圆括号等,并在Vim中插入凸耳,vim,vi,Vim,Vi,我希望能够在Vim中点击tab并使其跨过/移动到结束标记之外 inoremap A 到my.vimrc,但这只能通过按Ctrl+e来工作(并且它移动到行的末尾,而不是在结束标记之外)。我更喜欢用tab 我在Sublime Text 2中使用以下方法设置了此选项: [ { "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "

我希望能够在Vim中点击tab并使其跨过/移动到结束标记之外

inoremap A
到my.vimrc,但这只能通过按Ctrl+e来工作(并且它移动到行的末尾,而不是在结束标记之外)。我更喜欢用tab

我在Sublime Text 2中使用以下方法设置了此选项:

[
  { "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
    [
        { "key": "following_text", "operator": "regex_contains", "operand": "^[;=><',)\"\\]]", "match_all": true },
        { "key": "auto_complete_visible", "operator": "equal", "operand": false }
    ]
  }
]
[
{“keys”:[“tab”],“command”:“move”,“args”:{“by”:“characters”,“forward”:true},“context”:
[

{“key”:“following_text”,“operator”:“regex_contains”,“operator”:“^[;=>不久前,我写了一个小vimscript,我认为它能满足您的需要。希望它能有所帮助

if !exists( "g:out_of_expression_quick_key" )
    let g:out_of_expression_quick_key = "<Tab>"
endif

execute "imap " . g:out_of_expression_quick_key . " <C-r>=IncreaseColNumber()<CR>"
execute "imap " . g:out_of_expression_quick_key[0] . 'S-' . g:out_of_expression_quick_key[1:] . ' <C-r>=DecreaseColNumber()<CR>'

let s:delimiters_exp = '[\[\]{}())"' . "'" . '<>]'

fun! IncreaseColNumber()
    let l:colnum = col('.')
    let l:line = getline('.')
    if l:line[col('.') - 1:l:colnum] =~# s:delimiters_exp
        return "\<Right>"
    endif
    if g:out_of_expression_quick_key =~# "<Return>"
        return "\<CR>"
    endif
    if g:out_of_expression_quick_key =~# "<Tab>"
        return "\<Tab>"
    endif
endfunction

fun! DecreaseColNumber()
    let l:line = getline('.')
    if l:line[col('.') - 2] =~# s:delimiters_exp
        return "\<Left>"
    endif
    if g:out_of_expression_quick_key =~# "<Return>"
        return "\<S-CR>"
    endif
    if g:out_of_expression_quick_key =~# "<Tab>"
        return "\<S-Tab>"
    endif
endfunction
if!存在(“g:out\u of\u expression\u quick\u key”)
让g:out_of_expression_quick_key=“”
恩迪夫
执行“imap”.g:out\u of_expression\u quick\u key.=IncreaseColNumber()
执行“imap”.g:out\u of_expression\u quick\u key[0]。'S-'。g:out\u of_expression\u quick\u key[1:][.=DecreaseColNumber()'
让s:delimiters\u exp='[\[\]{}())“.”
有趣!增加ColNumber()
设l:colnum=col('.'))
让l:line=getline('.'))
如果l:line[col('.')-1:l:colnum]=~#s:delimiters\u exp
返回“\”
恩迪夫
如果g:out_of_expression_quick_key=~#“
返回“\”
恩迪夫
如果g:out_of_expression_quick_key=~#“
返回“\”
恩迪夫
端功能
有趣!减少colnumber()
让l:line=getline('.'))
如果l:line[col('.')-2]=~#s:delimiters\u exp
返回“\”
恩迪夫
如果g:out_of_expression_quick_key=~#“
返回“\”
恩迪夫
如果g:out_of_expression_quick_key=~#“
返回“\”
恩迪夫
端功能
那怎么办

<Esc>va(<Esc>`<
在本段末尾,您还需要:

<C-o>}
}
将“}”替换为“)”以转到当前句子的末尾

要转到next()或{}或[]的末尾,可以键入

<C-o>%
%
谢谢你的帮助:)。我将另一个答案保留为“如果它没有坏,就不要修理它”。
<C-o>}
<C-o>%