Forgot your password?

typodupeerror

Comment: Re:Need a way to un-highlight (Score 1) 702

by Mr Bill (#25669655) Attached to: (Useful) Stupid Vim Tricks?

When pasting I always find myself in insert mode when I remember I need to :set paste. So I have some hooks that allow me to turn it on while in insert mode:

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

F10 to turn on paste mode and F11 to turn it off, and it works in command mode and insert mode. That is straight out of the vim help files if you type :help pastetoggle.

Comment: Re:Filter Lines (Score 1) 702

by Mr Bill (#25669533) Attached to: (Useful) Stupid Vim Tricks?

You can easily create shortcuts for these as well, if you use them often

nnoremap <silent> ,t :%!perltidy -q<Enter>
vnoremap <silent> ,t :!perltidy -q<Enter>

That hooks the command ,t to perltidy. If you don't highlight anything and type ,t in command mode it will filter the whole file. If you highlight some lines and hit ,t it will only filter the selected lines.

And if you put that in .vim/ftplugin/perl.vim then those commands will only work when editing perl files.

I'll turn over a new leaf. -- Miguel de Cervantes

Working...