[20200107]vim的特殊功能g命令.txt

lfree發表於2020-01-07

[20200107]vim的特殊功能g命令.txt

--//今天我要使用vim定位一個sql語句某行在整個sql語句偏移位置(與開始位置),這個命令不大常用。
--//我僅僅記憶理命令使用g開頭,我查詢文件發現:

g CTRL-G    Prints the current position of the cursor in five
            ways: Column, Line, Word, Character and Byte.  If the
            number of Characters and Bytes is the same then the
            Character position is omitted.
            If there are characters in the line that take more
            than one position on the screen (<Tab> or special
            character), both the "real" column and the screen
            column are shown, separated with a dash.
            See also 'ruler' option.  {not in Vi}

--//這樣移到到定位的位置,在輸入g ctrl-g ,在提示行顯示如下。
Col 15 of 201; Line 21 of 21; Word 135 of 160; Char 1427 of 1615; Byte 1429 of 1617

--//這樣可以知道偏移在1429處。
--//開頭是g的命令還有許多特殊功能,比如ga看ascii碼等等。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2672223/,如需轉載,請註明出處,否則將追究法律責任。