vim tips
Vim

format file: :%!fmt

format range of lines :5,40!fmt

format a paragraph: :!}fmt

delete a line w/ regex: :g/[regex]/d

ctrl-a increments the next number it finds by one

convert capital words (HTML tags) to lowercase :%s/[A-Z][A-Z][A-Z]*/\L&/g

to record macro: qq, type commands to be recorded to the q buffer,
hit q again to end the recording of commands, then use @q to run the macro.

set expandtab and run :retab to convert all tabs to spaces

to see the ascii, hex and octal value of a character, move over the character and type 'ga'

to see the command history (useful for complex commands that you want to alter)
type 'q:'

to open another file within the current vim, use :edit [filename]

convert text to upper case with gU, lowercase with gu and swap case with g~
for example, to convert the rest of the line to upper case, use gU$
Or, to convert an entire line use gU, gu or g~

View your search history:
/ Ctrl-F (:q to exit)

Restore the cursor to the file position in previous editing session (vim.org tip)
Put this line in .vimrc:

au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

On FreeBSD, to get syntax color highlighting add this to .vimrc
set ttytype=xterm-color

I remember seeing a way to search and replace for a range (like a paragraph)
but I can't find it now.

To convert line endings between Windows and Linux, use fileformat (ff)
set ff=unix
set ff=dos

To paste text into a terminal window without having it autoindented or having to turn off autoindent, smartindent, indentexpr, etc, use :set paste. Turn it off with :set nopaste

Updated Mar 07, 2024