Toggle paste mode in Vim

I added the following lines to my ~/.vimrc file to map the :set paste command to the F9 key and the :set nopaste command to the F10 key. This allows for quickly toggling the paste mode in vim.

map <F9> :set paste<CR>
map <F10> :set nopaste<CR>
imap <F9> <C-O>:set paste<CR>
imap <F10> <nop>
set pastetoggle=<F10>

more Vim posts