Add these to your
vimrc to add to your already epic productivity!
Instead of hitting
<Esc> :w <Enter> to save when in insert mode, why not map
jj to do it for you? I find
ZZ awkward to type whereas
jj is lightning fast!
noremap jj <Esc>:w<CR>
As an added bonus to doing this, you can disable Vims auto-save feature if you haven't already as you'll be saving your work pretty much every time you exit insert mode. Nice!
If you're a PHP developer, most lines will end with
;, why not remap
;; to append a
; to the end of the line, save the file and exit insert mode?
inoremap ;; <End>;<Esc>:w<CR>
Tired of wasting split seconds hitting shift every time you want to enter a command with
:? Swap your
: around - takes about a day to get used to, but makes every command super fast.
nnoremap ; : nnoremap : ;
Changing focus of split panes can be a bit of a pain (
<C-w>[direction]), let's drop the middle man!
noremap <C-j> <C-w>j noremap <C-k> <C-w>k noremap <C-l> <C-w>l noremap <C-h> <C-w>h
And here's a bonus for Python developers - remove trailing space on file save for pep8-ified goodness:
autocmd BufWritePre *.py :%s/\s\+$//e