Category Archives: Vim

vim tips: arg & buf

Arg

Buffer

Operate command over multiple files

 

Vim search and replace in multiple files

1. Open vim

2. Add files into argument list

3. Search and Replace

 

:argdo: Apply following commands to all the files

%s:  Search and replace all lines in the file

g: Change all occurences in each line

e: No error if the pattern is not found

c: need confirm to save changes

|: Separator between commands

update: Save (write file only if changes were made)

vim tips: Show tab number in tab line

Here we’re going to use tabline.vim and pathogen.vim to show tab number in your tab line.

Install pathogen.vim

Add following codes into ~/.vimrc

Install tabline.vim

if no git

Add following codes into ~/.vimrc