Index | Diary

*Color Schemes* you can type :colorscheme <newcolorscheme>. You can use tab to cycle through the installed colorschemes.

*Autocomplete*

CTL-p in insert mode

*Ctrl-P toggles paste mode when in Insert mode do not include the two /*

set pastetoggle=/<C-P/> "Ctrl-P toggles paste mode when in Insert"

:set paste

:set nopaste

If something has double linespaced your text then this command will remove the double spacing and merge pre-existing repeating blank lines into a single blank line. It uses a temporary delimiter of ^^^ at the start of a line so if this clashes with your content choose something else. Lines containing only whitespace are treated as blank.

%s/\s*\n\n\+/^\r/g | g/\s*$/d | %s/^^^^.*

set pdev=printer_name

HP_Deskjet_930C

Printing from Vim is not like any other application since it has both console (Vim) and desktop (GVim) versions running off the same backend. On Linux, it does not show a Print Dialog, where I can pick the printer and other print options like number of pages per side, orientation and duplex. So, I print to a PDF file, open it in a PDF viewer and print from there.

To print to a PDF file from Vim: :hardcopy > out.pdf

To print to a PS file from Vim: :hardcopy > out.ps

nmap <F3> i<C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR><Esc>

imap <F3> <C-R>=strftime("%Y-%m-%d %a %I:%M %p")<CR>

Now you can just press F3 any time inside Vi/Vim and you'll get a timestamp like 2016-01-25 Mo 12:44 inserted at the cursor.

For a complete description of the available parameters check the documentation of the C function strftime

:%norm A*

This is what it means: % = for every line norm = type the following commands A* = append '*' to the end of current line