The Effective Use of VIM Series...



» Effective Use of VIM - Part 1



» » Effective Use of VIM - Part 2



» Effective Use of VIM - Part 3



» Effective Use of VIM - Part 4



» Effective Use of VIM - Part 5



== PART 2 ==

gg

:0

G

[number]

+[number]

-[number]

%

zf[modifier]

zo

zo

:e [file]

vim [file list]

buffers

b[number]

:[TAB]

:s[TAB]

set all

!!

!!

:.!

.

:%! [command]

!! cat [filename]

:r [filename]

There are ways to point to a particular location in a file...- Start of file. Can also use- End of file- Line number [number]- [number] lines down- [number] lines up- Matching pair (already explained in Part 1 There are times when you have a large file with lot of functions. You need to compare two functions which are at different locations in the file, with some functions in between. You would like to see the two functions on the screen. This is where folds comes in :)You can just fold (hide) a part of the file.Create fold:This will fold according to the modifier ([number] will fold that much lines; % will fold till matching pair ...). It will show as a banner telling how much lines are there.Unfold:Point cursor at the fold andwill open (unfold) the fold.Use can edit multiple files in the same VIM.- will open the [file] in another buffer.- will open vim with all the files in the list (you can use *.c)- will show the details of the buffers including the filename and line at cursor.- will go to buffer [number] (only if there are no unsaved changes)You can cut, copy, paste between buffers.- will iterate through all the vim commands, just like in a shell.- will show commands starting with s.- will show all the options available to you.Just type “bang bang” and any linux commands. The command will be executed and the output is pasted at the cursor location.will be expanded tomeans current cursor position. If we give, the whole file contents is send as input to the command and the output is substituted for.To include the contents of another file into this file, just doOr you can use -

To be continued...

Like it? Subscribe via RSS