Modify Vim section jumping with [[ and ]]?

huangapple go评论92阅读模式
英文:

Modify Vim section jumping with [[ and ]]?

问题

可以将[[和]]更改为跳到第一列的最近的{或}(默认行为),或者在若干个制表符之后的第一列吗?例如,我希望它对以下两种情况都有效:

function a()
{
}
<tab><tab>*function b()
<tab><tab>*{
<tab><tab>*}
英文:

Is it possible to change [[ and ]] to jump to the nearest { or } in the first column (as it does by default), or in the first column after some number of tabs?

For example, I'd like it to work for both of these:

function a()
{
}
&lt;tab&gt;&lt;tab&gt;*function b()
&lt;tab&gt;&lt;tab&gt;*{
&lt;tab&gt;&lt;tab&gt;*}

答案1

得分: 0

不是真的,文档甚至建议创建自定义映射,就像这样:

nnoremap ]] :call search('^\s*}', 'e')<CR>
nnoremap [[ :call search('^\s*{', 'eb')<CR>

请参阅:help search()

英文:

Not really and the doc even suggests making custom mappings, like these:

nnoremap ]] :call search(&#39;^\s*}&#39;, &#39;e&#39;)&lt;CR&gt;
nnoremap [[ :call search(&#39;^\s*{&#39;, &#39;eb&#39;)&lt;CR&gt;

See :help search().

huangapple
  • 本文由 发表于 2023年4月20日 00:50:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76057030.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定