Basic "vi" features

转载 2012年03月22日 08:42:42

To see the original article please refer to link: http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html


One edits a file in vi by issuing the command: vi file-to-edit.txt

The vi editor has three modes, command mode, insert mode and command line mode.

  1. Command mode: letters or sequence of letters interactively command vi. Commands are case sensitive. The ESC key can end a command.
  2. Insert mode: Text is inserted. The ESC key ends insert mode and returns you to command mode. One can enter insert mode with the "i" (insert), "a" (insert after), "A" (insert at end of line), "o" (open new line after current line) or "O" (Open line above current line) commands.
  3. Command line mode: One enters this mode by typing ":" which puts the command line entry at the foot of the screen.

Partial list of interactive commands:

Cursor movement:
Keystrokes Action
h/j/k/l Move cursor left/down/up/right
spacebar Move cursor right one space
-/+ Move cursor down/up in first column
ctrl-d Scroll down one half of a page
ctrl-u Scroll up one half of a page
ctrl-f Scroll forward one page
ctrl-b Scroll back one page
M (shift-h) Move cursor to middle of page
H Move cursor to top of page
L Move cursor to bottom of page
W
w
5w
Move cursor a word at a time
Move cursor ahead 5 words
B
b
5b
Move cursor back a word at a time
Move cursor back a word at a time
Move cursor back 5 words
e
5e
Move cursor to end of word
Move cursor ahead to the end of the 5th word
0 (zero) Move cursor to beginning of line
$ Move cursor to end of line
) Move cursor to beginning of next sentence
( Move cursor to beginning of current sentence
G Move cursor to end of file
% Move cursor to the matching bracket.
Place cursor on {}[]() and type "%".
Use the matchit or xmledit plug-in to extend this capability to XML/XHTML tags.
'. Move cursor to previously modified line.
'a Move cursor to line mark "a" generated by marking with keystroke "ma"
'A Move cursor to line mark "a" (global between buffers) generated by marking with keystroke "mA"
]' Move cursor to next lower case mark.
[' Move cursor to previous lower case mark.

Editing commands:

Keystrokes Action
i Insert at cursor
a Append after cursor
A Append at end of line
ESC Terminate insert mode
u Undo last change
U Undo all changes to entire line
o Open a new line
dd
3dd
Delete line
Delete 3 lines.
D Delete contents of line after cursor
C Delete contents of line after cursor and insert new text. Press esc key to end insertion.
dw
4dw
Delete word
Delete 4 words
cw Change word
x Delete character at cursor
r Replace character
R Overwrite characters from cursor onward
s Substitute one character under cursor continue to insert
S Substitute entire line and begin to insert at beginning of line
~ Change case of individual character
ctrl-a
ctrl-x
Increment number under the cursor.
Decrement number under the cursor.
/search_string{CR} Search for search_string
?search_string{CR} Search backwards (up in file) for search_string
/\<search_string\>{CR} Search for search_word
Ex: /\<s\>
Search for variable "s" but ignore declaration "string" or words containing "s". This will find "string s;", "s = fn(x);", "x = fn(s);", etc
n Find next occurrence of search_word
N Find previous occurrence of search_word
. repeat last command action.

Terminate session:

  • Use command: ZZ
    Save changes and quit.
  • Use command line: ":wq"
    Save (write) changes and quit.
  • Use command line: ":w"
    Save (write) changes without quitting.
  • Use command line: ":q!"
    Ignore changes and quit. No changes from last write will be saved.
  • Use command line: ":qa"
    Quit all files opened.

C++ Basic Features List

1. typename Here, in excruciating detail, are the rules for the use of typename. Unfortunately, due...
  • Kevin__lin
  • Kevin__lin
  • 2012年10月25日 15:21
  • 174

Basic vi Commands

What is vi?The default editor that comes with the UNIX operating system is called vi (visual editor)...
  • adermxl
  • adermxl
  • 2010年08月29日 11:49
  • 341

Basic vi Commands [zz]

Basic vi Commands What is vi ?The default editor that comes with the UNIX operating system is ca...
  • para1314
  • para1314
  • 2011年03月30日 14:28
  • 250

Linux vi and vim editor: Tutorial and advanced features

原文来自http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html 本来打算翻译的,但是发现都是比较基本的语句,翻译了反而没不翻译的...
  • cdjlove
  • cdjlove
  • 2013年04月07日 22:12
  • 1513

securecrt安装中的features(leave blank if license has........)

securecrt安装中的features(leave blank if license has........),如果没有以管理员身份运行KG_ttrar.exe,feature的留白是不能破解成功...
  • hjqsuccess
  • hjqsuccess
  • 2016年04月12日 20:40
  • 2697

Basic表示一个简单的属性

5、@Basic(fetch=FetchType,optional=true)   可选   @Basic表示一个简单的属性到数据库表的字段的映射,对于没有任何标注的getXxxx()方法,默认 ...
  • u014131893
  • u014131893
  • 2014年03月25日 23:19
  • 2074

自己动手写basic解释器(一)

自己动手写basic解释器刺猬@http://blog.csdn.net/littlehedgehog注: 文章basic解释源码摘自梁肇新先生的《编程高手箴言》(据他所说这个代码也是网上摘录的),源...
  • littlehedgehog
  • littlehedgehog
  • 2008年09月14日 16:14
  • 9242

HTTP basic Authorization

来源:http://blog.csdn.net/libaineu2004/article/details/38384487 POST /goform/ser2netconfigAT ...
  • u011430225
  • u011430225
  • 2016年07月08日 13:05
  • 1463

R-CNN regions with CNN features for detection and segmentation

分析paper:Ross Girshick Jeff Donahue Trevor Darrell Jitendra Malik
  • yihaizhiyan
  • yihaizhiyan
  • 2014年05月21日 16:22
  • 7962

JPA的Basic注解

在默认的情况下,Entity中的属性加载方式都是即时加载(EAGER)的,当Entity对象实例化时,就加载了实体中相应的属性值。但对于一些特殊的属性,比如长文本型text、字节流型blob型的数据,...
  • crazy_pan
  • crazy_pan
  • 2010年10月21日 23:15
  • 9648
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Basic "vi" features
举报原因:
原因补充:

(最多只允许输入30个字)