Vim allows you to extend its internal help documentation. As I read ThePythonCookbook, the code snippets go
into my own personal help file for python algorithms. This allows me to run :help patrick<TAB> to scan
through the snippet titles ( like patrick-python-unicode ). My ~/etc/vim/doc/patrick.txt looks like:
*patrick-python-unicode*
old = sys.stdout
sys.stdout = codecs.lookup('utf-8')[-1](sys.stdout)
print u"\N{GREEK CAPITAL LETTER GAMMA}"
*patrick-python-permutations*
a = [1,2,3,4]
b = [5,6,7,8]
[ "%s %s" % (x,y) for x in a for y in b ]
*patrick-python-sort*
decorate, sort, undecorate
def stable_sort(alist, indices=xrange(sys.maxint)):
decorated = zip(alist, indices)
decorated.sort()
return [ item for item, index in decorated ]
While the relevant vimrc snippet looks like:
if has("autocmd")
autocmd BufWrite */etc/vim/doc/*.txt :helptags ~/etc/vim/doc/
autocmd BufWrite */etc/vim/doc/*.txt setlocal filetype=helpfile noreadonly modifiable
endif
I purloined this idea from http://djcraven.blogspot.com/2006/10/mastering-vim-help-system.html.