標籤:vimUse Counts to Do Simple Arithmetic在vim中,執行<C-a>和<C-x>命令可以對文本中的數字直接進行加或減。 如果不提供數字而直接執行上面的命令的話,預設對游標所在的數字值進行加1或減1。 如果在命令前面加一個數字,就會對游標所在的數字加或減這個數。 如果游標所在位置不是數字,就會自動在當前行後面尋找數字然後定位到該數字上。 如下面的測試檔案
標籤:vimFind and Replace by Hand 在上面文本中,我們打算把content 更改為單詞copy 也許我們可以用如下命令:%s/content/copy/g上面命令把文本中所有的content單詞換為copy,但是我們卻不希望第二行中的content被替換掉。 我們可以執行下面命令搜尋content我們可以使用/content也可以把游標放在content單詞上,然後按*,vim將自動搜尋游標所在的單詞。 cw命令刪除當前單詞,然後進入insert
標籤:vimDelete Around, or Change InsideVim ’s text objects fall into two categories: those that interact with pairs of delimiters, such as i) , i” , and it , and those that interact with chunks of text, such as words, sentences, and paragraphs.Vim
標籤:search vim Search to Navigate在Vim中快速定位到某處的另外方法就是搜尋word,使用方法就是符號/後跟要搜尋的word,如下: 由可以看出執行命令後會顯示多個匹配項,我們可以使用n或N命令將游標移動到前一個或後一個匹配項上。Operate with a Search
標籤:vimTrace Your Selection with Precision Text Objects對於括弧,引號,以及例如html,xml中的標籤<a> </a>等,都是成對出現,Vim能夠理解這種結構方式,對它們限定的地區文本進行選擇。 對於如下js代碼 執行如下命令 最開始游標在url的r上,然後輸入v命令,進入
標籤:global vim pattern Delete Lines Containing a PatternCombining the :global and :delete commands allows us to cut down the size of a file rapidly. We can either keep or discard all lines that match
標籤:vim real-lines Distinguish Between Real Lines and Display LinesUnlike many text editors, Vim makes a distinction between real lines and display lines. When the ‘wrap’ setting is enabled (and it’s on by default),
標籤:append vim 選擇 Move Word-Wise在Vim中以word為單位更加快速的左右移動快速鍵為: 直觀的展示如下 這些快速鍵可以和其他命令結合使用,快速選擇一個word。 Taken together, the ea commands can be read as “Append at the end of the current word. ” I use ea