"vi" is not an ordinary editor. it is a popular among programmers.
in our lab most of them struggle to do copy, paste like simple things in it..
it's hard to get for the first time, but later only we can realize how
awesome the "vi" is.
my fav. commands:
vi has two modes:
1. command mode (press esc)
in command mode our cursor will point at the bottom followed by :
2. edit mode (press i)
normal edit mode we can type whatever we want
in command mode:
vi filename.cc -> to create a new file
h -> left
j -> down
k -> up
l -> right
:w -> to save
:q -> to quit
:q! -> quit without saving
dw -> delete a single word from cursor
dd -> delete whole line
:!g++ file.cc -o file -> this one will compile our code without closing our file. actual syntax is :!command
where we can execute terminal commands in it. like ls, date, cal etc.
:set autoindent -> automatically indent our source code
:set number -> set line numbers
:set hlsearch -> enable highlight search
in our lab most of them struggle to do copy, paste like simple things in it..
it's hard to get for the first time, but later only we can realize how
awesome the "vi" is.
my fav. commands:
vi has two modes:
1. command mode (press esc)
in command mode our cursor will point at the bottom followed by :
2. edit mode (press i)
normal edit mode we can type whatever we want
in command mode:
vi filename.cc -> to create a new file
h -> left
j -> down
k -> up
l -> right
:w -> to save
:q -> to quit
:q! -> quit without saving
dw -> delete a single word from cursor
dd -> delete whole line
:!g++ file.cc -o file -> this one will compile our code without closing our file. actual syntax is :!command
where we can execute terminal commands in it. like ls, date, cal etc.
:set autoindent -> automatically indent our source code
:set number -> set line numbers
:set hlsearch -> enable highlight search
Comments
Post a Comment