Vim Tips

25 Dec 2020

This page is indeed a great source of inspirations for useful vim tips; please do visit this page often.

Here is my own curated vim tips:

Inserting Command Output Into Currently Editting File

" inserts text from a specified file into the current buffer
:r textfile

" read in sorted order of file names
:r ! ls -1 /home/user/directory | sort -r

Execute External Commands Without Quiting Vim

" execute an NON-INTERACITVE command by Bang (!)
" below: count the number of words for current editing file (%)
:! wc %

" execute INTERACTIVE commands by dropping to interactive 
" shell; you can always go back to vim by 'CTRL-D' or 'exit'
:sh

Line Completion

" Line complete SUPER USEFUL
<C-X><C-L>

Search Words Completion

" Pull <cword> onto search/command line
/<C-R><C-W>

" Pull <CWORD> onto search/command line
/<C-R><C-A>

Window Size Adjustment

" Adjust height of splitted windows
<C-W><+|->

" Adjust width of splitted windows
<C-W><lessthan(<)|greaterthan(>)>

Jump Among Functions By Function Browsers

By using Taglist plugin? Or some other better tools/plugins?