标签:end share Searching XXXX file sheet using data se
https://stackoverflow.com/questions/12867573/searching-from-end-of-file-using-vim
Searching from end of file using VIM
Ask Question Asked 9 years, 8 months ago Modified 3 years, 11 months ago Viewed 64k times 43How do I search from the end of file using VIM? I want to search for the last occurrence of XXXX in the open file.
vim Share Improve this question edited Jun 7, 2013 at 11:49 Mat 196k4040 gold badges382382 silver badges396396 bronze badges asked Oct 12, 2012 at 21:48 Ransom Briggs 2,99533 gold badges3131 silver badges4646 bronze badges Add a comment5 Answers
57Type G$?XXXX
G
to go to the end of the file$
to go to the end of the line?
to search backwardsXXXX
being what you want to search for
You could also do gg?XXXX
which goes to the start of the file, then searches backwards, wrapping around to the end of the file. However for large files it can be slow to seek to the start of the file and then immediately to the end of the file.
40
My suggestion is to use a range combined with searching backwards via ?
.
:1?XXXX
Overview:
1?XXXX
is the range.- The
1
means first line of the file. ?XXXX
means search backwards from the first line (wrapping around) until you find the patternXXXX
As ZyX mentioned this relies on wrapscan
to be set, which it is by default. See :h 'wrapscan'
for more information.
标签:end,share,Searching,XXXX,file,sheet,using,data,se 来源: https://www.cnblogs.com/kungfupanda/p/16385332.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。