Customize your Vim editor using .vimrc

Quick notes:
– imap is for when you are in insert mode
– map is when your are in command mode

Thus when you are in the insert mode, sometime you need to exit to the command mode first using the esc key.
The i is for going back to the inser mode. The cr key is the Enter key.

The script below will make vim to:
– Find and Replace when I hit F3
– Undo when I hit F9
– Saves when I hit F10
– Quit when I hit F12
– Prints a debugging statement for PHP when I press F8
– Also disables the REPLACE mode


""""""""""""""""""""""""""""""""""""""
" Quick commands using F keys
"""""""""""""""""""""""""""""""""""""""
:imap :%s/search/replace/gc
:map :%s/search/replace/gc

:imap :ui
:map :ui

:imap :w!i
:map :w!i

:imap :q!
:map :q!

:imap error_log("\n".__FILE__ . ' ['. __LINE__. '] ' . __CLASS__.'::'.__FUNCTION__.'() D>'. print_r(, true));
:map ierror_log("\n".__FILE__ . ' ['. __LINE__. '] ' . __CLASS__.'::'.__FUNCTION__.'() D>'. print_r(, true));

"""""""""""""""""""""""""""""""""""""""
" Disable REPLACE mode
"""""""""""""""""""""""""""""""""""""""
function s:ForbidReplace()
if v:insertmode isnot# 'i'
call feedkeys("\", "n")
endif
endfunction
augroup ForbidReplaceMode
autocmd!
autocmd InsertEnter * call s:ForbidReplace()
autocmd InsertChange * call s:ForbidReplace()
augroup END