gpt4 book ai didi

vim - vim位置列表: how to go to first location if at last location

转载 作者:行者123 更新时间:2023-12-04 16:39:25 25 4
gpt4 key购买 nike

我已经将gn映射到:lnext<cr>;我如何持续按它来循环浏览位置列表,即如果位于最后一个位置,则转到第一个位置?

谢谢

最佳答案

秘诀是使用:try:catch的方式与使用其他语言一样。您正在寻找以下错误E553E42

nnoremap ]l :try<bar>lnext<bar>catch /^Vim\%((\a\+)\)\=:E\%(553\<bar>42\):/<bar>lfirst<bar>endtry<cr>

该命令的灵感来自Tim Pope的 unimpaired.vim插件。

我也建议不要映射 gngn命令非常方便,可对搜索模式进行操作。参见 :h gn

有关更多信息,请参见:
:h :try
:h E553
:h E42
:h :lnext
:h :lfirst

关于vim - vim位置列表: how to go to first location if at last location,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27198612/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com