?? l4.3
字號:
#print More Movement - Searching in the File The last, but certainly not least, method we'll look at for moving aroundin the file is searching. The command to search for a particular word orphrase or whatever is '/'. When you type a /, vi will move the cursor to the bottom of the screen, echo the / and wait. You then type in the textyou want to search for and hit return. If the text exists anywhere in thefile, vi will move the cursor forward to the next occurence. If it getsto the end of the file without finding it, vi will wrap around to the frontof the file and continue searching. If you want vi to start searching in the backward direction, i.e, towardthe beginning of the file, use ? instead of /. Note that ? is just a shifted/ on most terminals. To repeat a previous search with the same text, just hit 'n', for 'next'.To repeat the search in the opposite direction, hit 'N'. Type 'ready' now to try out the search commands.#user#create Search Searching uses these commands: / = To search forward for some text ? = To search backward for some text n = To repeat the previous search (i.e. go on to the 'next' occurance) N = To repeat the previous search but in the opposite direction We'll see later how to specify a pattern to search for, rather thanjust straight text. This will make a lot of searches much easier. Oftentimes, you will do a search and then want to go back to where youwere previously. The '' command (that's two single quotes) will move youback to the last place you were. This is a special case of a command we'lllook at in more detail later, in the section on marking.--------------------------------------------------------------------------#cat /usr/lib/learn/vi/longtext >> Searchvi Search#next5.1 10
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -