Text Editors
Console Based Text Editors:
1. Emacs
2. Nano
3. Vim/vi
Graphical (GUI) Editors:
1. Gedit
2. Gvim
3. Sublime (have to install
separately)
Now we are going to discuss about vi/vim editor.
Vim is a highly configurable text editor built to
enable efficient text editing. It is an improved version of the VI editor
distributed with most UNIX systems. It is a tool, the use of which you must be
learned. Program is written by Bram Moolenaar et al.
Usage of vi/vim, it has three modes
1. Command mode
2. Insert Mode
3. Ex-mode
Command mode: this mode is the default mode following things we can do
Yank/copy
(yy) - copying the single line
(nyy) n number of lines at a time you can copy.
p - Paste a content bellow the cursor
P - Paste content above the cursor
dd - Delete a single line
ndd n number of line delete yet a time
x - Deleting a single character
dw - Deleting a single word
. - redo
u - Undo
J - Joining the line
r - Replace the character
Arrow Keys
h - Left
j - Down
k - Up
l - Right
Ctrl+d - Scroll
Down
Ctrl+u - Scroll
UP
Insert Mode: This mode is used to insert the text into the file
i - Inserting
the content before the cursor position
I - it
will insert the character starting of the line
a - it
will insert the character of the cursor append
A - It
will append the character from end of the line
O - It
will insert a new line above the cursor
o - It
will insert a new line below the cursor
s - Substitute
the stream
EX-Mode: Esc is used to change the mode. Press Escape key to enter EX-Mode
:w - save
the modifications
:q - quit
:wq - save
& quit
:w! - save
forcefully
:q! - Quit
forcefully
:set nu - setting
the line numbers
:set nonu - Remove
line numbers
:<number> - it
will goes to particular line
:%s/find
string name/replace string/g - to
replace the string group of lines
:r -
reading the another file from here
:!<command> - command
will execute from here
:r !date - output
will save in current file
No comments:
Post a Comment