Folding Shell Style Comments with Vim
I often experience with people new to Unix or even people who have been using it for a while, that they tend to brush off vi/emacs editors quickly and then use simpler editors like pico, nano, gedit and the like.
They then never see why a lot of old time Unix system administrators and developers use these tools. vi for example was designed to edit files over a very slow connection (300bps). It's still very useful now, as lag still exists. It's very painful for me to see young developers use the mouse and scroll up, scroll down, when without lifting your hands from the keyboard you can jump to different functions, mark locations and jump back.
If you need to comment out some lines over a laggy ssh connection you can simple type :4,12s/^/#/ instead of type # and using cursor keys over the next 8 lines.
Speaking of comments, here's a common scenario. Sometimes configuration files are huge, because they're well commented with examples. You want to edit it, but sometimes you just want to see your modifications and only comments for the section you're looking at and not scroll through everything. You can hide the # comments with vim's folding feature.
So let's define a function to do this in our ~/.vimrc:
function! FoldShellComments()
let &foldexpr = 'getline(v:lnum)[0]=="#"'
g/.*/ if foldlevel(line(".")) > 0 | s/$/ !!!/ | endif
set foldmethod=expr
endfunction
We then want to call this up easily so we define a user command:
command! -nargs=0 FoldShellComments :call FoldShellComments()
With this whenever we want to fold commented lines, we simple type :FoldShellComments This will tab complete by the way, you just need to type :Fo<tab>
That huge squid.conf file now looks like this:

