Dec 6, 2016

Vi command tutorial

Leave a Comment
Vi commands


:%s/pattern/replace/

:%s/""},"param_init/"aaaaaaaa"},"param_init
:set number
/searchpattern
?search patern
i,a : chen truoc sau
x: xoa
yyp: copy va dan 1 dong
:number => go to Line number
u: Undo
GG move to bottom
A append at end of line

:sp ./ split                    
:vs ./ vertical split
Ctrl+W move to next windows

Command :!command
Compile :!gcc 


:set ai auto indent
gg=G auto indent toan bo file
ctrl-t, ctrl-d  - indent current line forward, backwards

ctags -R *
ktags -R *
sudo apt-get install exuberant-ctags
sudo ln -s /usr/bin/ctags-exuberant ktags (tranh conflict with default ctags of emacs)

ctags --version => not GNU

Ctrl+] : đi đến định nghĩa của một hàm
Ctrl+t : quay trở lại nơi trước khi gõ lệnh trên.
:ta tên_hàm : đi đến hàm được chỉ định
:ts [expression] : Liệt kê tất cả các hàm match với expression

Go to definition:  Ctrl + ]
Go Forward: Ctrl + i
Go Backward: ctrl + o


:help tags để xem thêm những cách sử dụng khác


find . -name "*.c" -o -name "*.h" >cfile.list



If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment