摘要:基礎(chǔ)篇提醒你一下,可以打開多個(gè)文件,切換方法為再提醒你一下,可以看看當(dāng)前目錄有哪些東西在文件中移動(dòng)提醒你一下,都可以試一試哦剪切復(fù)制和粘貼提醒你一下,還可以復(fù)制行再提醒一下,使用標(biāo)記可以復(fù)制一個(gè)范圍的,比如挪到某行另外一行然后可復(fù)制到直接的
基礎(chǔ)篇
:e filename Open filename for edition
:w Save file
:q Exit Vim
:q! Quit without saving
:x Write file (if changes has been made) and exit
:sav filename Saves file as filename
. Repeats the last change made in normal mode
5. Repeats 5 times the last change made in normal mode
提醒你一下, :e filename 可以打開多個(gè)文件,切換方法為 ctrl+shift+^ 再提醒你一下, :e . 可以看看當(dāng)前目錄有哪些東西在文件中移動(dòng)
k or Up Arrow move the cursor up one line
j or Down Arrow move the cursor down one line
e move the cursor to the end of the word
b move the cursor to the begining of the word
0 move the cursor to the begining of the line
G move the cursor to the end of the line
gg move the cursor to the begining of the file
L move the cursor to the end of the file
:59 move cursor to line 59. Replace 59 by the desired line number.
20| move cursor to column 20.
% Move cursor to matching parenthesis
[[ Jump to function start
[{ Jump to block start
提醒你一下, ctrl+b,ctrl+e,ctrl+f 都可以試一試哦剪切、復(fù)制和粘貼
y Copy the selected text to clipboard
p Paste clipboard contents
dd Cut current line
yy Copy current line
y$ Copy to end of line
D Cut to end of line
提醒你一下, 還可以 3yy,復(fù)制 3 行 再提醒一下,使用標(biāo)記可以復(fù)制一個(gè)范圍的,比如挪到某行 ma 另外一行 mb 然后:"a,"by 可復(fù)制 a 到 b 直接的內(nèi)容搜索
/word Search word from top to bottom
?word Search word from bottom to top
* Search the word under cursor
/cstring Search STRING or string, case insensitive
/jo[ha]n Search john or joan
/< the Search the, theatre or then
/the> Search the or breathe
/< the> Search the
/< |.> Search all words of 4 letters
// Search fred but not alfred or frederick
/fred|joe Search fred or joe
/
/^n{3} Find 3 empty lines
:bufdo /searchstr/ Search in all open files
bufdo %s/something/somethingelse/g Search something in all the open - -buffers and replace it with somethingelse
沒看明白? /替換只選 the 這個(gè)單詞
:%s/old/new/g Replace all occurences of old by new in file
:%s/onward/forward/gi Replace onward by forward, case unsensitive
:%s/old/new/gc Replace all occurences with confirmation
:2,35s/old/new/g Replace all occurences between lines 2 and 35
:5,$s/old/new/g Replace all occurences from line 5 to EOF
:%s/^/hello/g Replace the begining of each line by hello
:%s/$/Harry/g Replace the end of each line by HarryI
:%s/onward/forward/gi Replace onward by forward, case unsensitive
:%s/ *$//g Delete all white spaces
:g/string/d Delete all lines containing string
:v/string/d Delete all lines containing which didn ’ t contain string
:s/Bill/Steve/ Replace the first occurence of Bill by Steve in current line
:s/Bill/Steve/g Replace Bill by Steve in current line
:%s/Bill/Steve/g Replace Bill by Steve in all the file
:%s/^M//g Delete DOS carriage returns (^M)
:%s/r/r/g Transform DOS carriage returns in returns
可能有的人找這種刪除命令很久了 :g/string/d
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://specialneedsforspecialkids.com/yun/24909.html
摘要:點(diǎn)擊原文鏈接體驗(yàn)更佳哦優(yōu)測(cè)優(yōu)社區(qū)干貨精選老司機(jī)亂談編輯器之神騰訊優(yōu)測(cè)騰訊優(yōu)測(cè)是專業(yè)的移動(dòng)云測(cè)試平臺(tái),為應(yīng)用游戲,混合應(yīng)用的研發(fā)團(tuán)隊(duì)提供產(chǎn)品質(zhì)量檢測(cè)與問題解決服務(wù)。 文 / 騰訊 吳雙 前言 優(yōu)測(cè)小優(yōu) 有話說: 騰訊優(yōu)測(cè)只有應(yīng)用測(cè)試大神?不不不,我們還有各種研發(fā)大牛! vim 是一種信仰,我自從2004年有了這個(gè)信仰,已經(jīng)12個(gè)年頭了。本文介紹了學(xué)習(xí)vim的方法以及一些vim常用的插件...
摘要:為什么要有模式呢以上其實(shí)已經(jīng)講述了一些原因,但真正的價(jià)值還在于接下來要講到的哲學(xué)。鼠標(biāo)與快捷鍵的操作治標(biāo)不治本,它們沒能從根本上解決這個(gè)問題。 學(xué)會(huì)用不同的角度去看待和理解這個(gè)世界,你收獲的永遠(yuǎn)會(huì)比你想象的更多。 上回我分享了如何掌握基礎(chǔ)移動(dòng)的心得體會(huì),而對(duì)于很重要的模式卻只是一帶而過,這其實(shí)是有原因的。過去我有過幾次教新手 Vim 的經(jīng)歷,按照慣常的方式先告訴他們模式切換,...
摘要:年底了,故事總是會(huì)有很多。因其輕便,擴(kuò)展性,可定制化,一直很受開發(fā)者追捧。高階大神,袖中必有深藏。本文僅對(duì)常用的一些命令做了匯總,的玩法還有很多。參考文檔和的區(qū)別常用命令總結(jié)使用進(jìn)階作者以樂之名本文原創(chuàng),有不當(dāng)?shù)牡胤綒g迎指出。 年底了,故事總是會(huì)有很多。 showImg(https://segmentfault.com/img/bVblBht?w=500&h=400); 剛了一波通宵加...
閱讀 1537·2023-04-25 18:56
閱讀 1484·2021-09-29 09:34
閱讀 1710·2021-09-22 15:51
閱讀 3483·2021-09-14 18:03
閱讀 1160·2021-07-23 17:54
閱讀 2018·2019-08-29 18:38
閱讀 2900·2019-08-29 12:38
閱讀 610·2019-08-26 13:41