GVIM EDITOR
In Gvim Editor we have three modes
- Command mode
- Insert mode
- Visual mode
i Insert mode
ESC Command mode
yy Copy
10yy To copy 10 lines
p Paste
dd Delete
10dd To delete 10 lines
u Undo
J Joint back the line
gf to the file
:bd Back to the file
:vsp Vertical split
:sp Horizontal split
ctrl+ww To go the next file
ctrl+a Increasing the number
ctrl+x Decreasing the number
:wq! Save and close
a Insert mode after the cursor
shift+a Insert mode at the end of line
/pattern Search the pattern
:$ Cursor will to the last line
:~ Converting from lower case to upper case
:R Replace the file name
:csh Entering into Linux shell
gg To go to the top of the file
shift+gg To go to end of the file
100 gg To got to 100 line
:set nu To set/ Enable the line numbers to view
:set nonu To Hide the line numbers /disable the line no view
? Back search
^ It indicate the begging of the line
$ It indicates the ending of the line
:n To move the nth line from current line
h To back side of the current cursor position
l To go to right of the current cursor position
j To go to Down line of the current cursor position line
k To go to the up side of the current position line
:123,321s/old name/new name To change the old name by new name from starting number(123) to ending number (321)
a Insert mode after the cursor
shift+a Insert mode at the end of line
/pattern Search the pattern
:$ Cursor will to the last line
:~ Converting from lower case to upper case
:R Replace the file name
:csh Entering into Linux shell
gg To go to the top of the file
shift+gg To go to end of the file
100 gg To got to 100 line
:set nu To set/ Enable the line numbers to view
:set nonu To Hide the line numbers /disable the line no view
? Back search
^ It indicate the begging of the line
$ It indicates the ending of the line
:n To move the nth line from current line
h To back side of the current cursor position
l To go to right of the current cursor position
j To go to Down line of the current cursor position line
k To go to the up side of the current position line
:123,321s/old name/new name To change the old name by new name from starting number(123) to ending number (321)
Ctrl +v visual mode
Shift+i and select the number of lines to insert the pattern at the begging of the lines
write the pattern
ESC
:s/old name/new name/gc To change the pattern in the current cursor Position
:%S/old name/new name/g It will change the every occurrence of the old name by new name
:%S/$/old pattern/new pattern/gc To replace the new pattern at the end of the lines in a file
:%S/^/raju/gc Add raju in beginning of all the lines
:g//d This will delete the lines wich contains previous searched pattern
:g!//d This will deletes the other lines which doesn't contains previous pattern
:g/^$/d to delete the empty lines
write the pattern
ESC
:s/old name/new name/gc To change the pattern in the current cursor Position
:%S/old name/new name/g It will change the every occurrence of the old name by new name
:%S/$/old pattern/new pattern/gc To replace the new pattern at the end of the lines in a file
:%S/^/raju/gc Add raju in beginning of all the lines
:g//d This will delete the lines wich contains previous searched pattern
:g!//d This will deletes the other lines which doesn't contains previous pattern
:g/^$/d to delete the empty lines
:%s///n -->if you search for a pattern in a file that pattern will highlight, how many times that pattern was there that info it will give (count number)
:%s/\ /\r/g it will show one by one line
:%s/\ /\r/g it will show one by one line
ctrl+v GJJ to combined all lines to single
%s/\n/pattern\r/g : to print the pattern at the end of the line
:n to examine the file , quickly open and close
:tabnew filename
:%S/\n/pattern\r/g to print the pattern at the end of the every line
:12 , 40 w filename.txt saved it in the file from 12 to 40 lines
:e to update the log file
:args to know the name of the file which we are opened
:1s/\//\\\//gc --> to replace the / with \/
:2s/_pattern_/\//gc
:54 r filename.txt from line number 54 it will replace current file content with the filename.txt data
:g:pattern:d if the pattern is matched on a line it will delete
:e# , (ctrl+6 or bd) back to directory
:ls ${cwd}/* it will give the path
readlink -f file name it will give the abspath
No comments:
Post a Comment