sponsor Vim development Vim logo Vim Book Ad

basic Tip #820: VimTip is a one-stop resource to vim. Keep it in your $VIM directory

 tip karma   Rating 56/23, Viewed by 2661 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   November 11, 2004 6:50      complexity:   basic
author:   Staale Flock      as of Vim:   6.0

The VimTip textfile and database has become one of my favorite ways to learn
new tricks in vim. So I keep it easy available at all times and have applied
some of the nice tricks I have learned to the file to make it easier to read.

1: Get the text file (wget is a external tool, you can get a windows version)
    Download the text version with a browser or use wget like this.
    On the vim commandline: (It's all on one line)
:!wget http://www.vim.org/tips/tip_download.php?download=download -O
~/.vim/vimtips.txt

2: Open it and apply foldmarks.
:e ~/.vim/vimtips.txt
:%s/\(^VimTip\)/\1\t{{{1/g
:set foldmethod=marker

3: Now you should have a nice index of all the vimtip's provided. Open a fold
by placing the cursor on a line and hit za. Open all folds with zR. Close them
again with zM

4: After some vimtip's reading you shoul be able to make a automatic process of it to update your vimtips.txt file regularly.

Happy vim'ing
Best Regards
Staale Flock

 rate this tip  Life Changing Helpful Unfulfilling 

<< Quick (Re-)starting and Iconizing gvim with keystrokes for Windows | Simplest buffer explorer ever >>

Additional Notes

Anonymous, November 11, 2004 23:09
Nice tip for beginners, thanks.

After the substitution, add the set command to the file e.g. in 2nd line:
'vim:foldmethod=marker:'
and save it e.g. in $HOME/vimfiles/after/doc/vimtips\[1\].txt

In _gvimrc  (.gvimrc on Unix) I added the tips to the helpmenu:
" additions to help menu
an 9999.90 &Help.-sep3- <Nop>
an 9999.91 &Help.&VimTips :e $HOME/vimfiles/after/doc/vimtips\[1\].txt <CR><CR>

Thomas
seanm@despammed.com, November 24, 2004 10:21
You can also use grep instead of folding.

:grep ^VimTip %
syd@plug.ca, July 22, 2005 8:27
Also, it would be good to mention that you also close an individual fold using za
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo