" to reload the vimrc after editing without restarting vim type" :source $MYVIMRC" lauch pathogen plugin manager
execute pathogen#infect()let mapleader =","let maplocalleader ="-"" configure external plugins" Ctrl-Pnnoremap<leader>f :CtrlP<cr>nnoremap<leader>b :CtrlPBuffer<cr>letg:ctrlp_extensions = ['dir','line','bookmarkdir']
" NERDTreennoremap nt :NERDTreeToggle<CR>let NERDTreeShowBookmarks=1" quick savingnnoremap<leader>w :w!<cr>" maximize window in all directons, pipe needs escapingnnoremap<C-w># <C-w>_<C-w>\|nnoremap<leader># <C-w>_<C-w>\|nnoremap<leader>=<C-w>=" Breaks 'J' ... combine lines"nnoremap H ^"nnoremap L $"nnoremap J H"nnoremap K L" two column mode" URL: http://vim.wikia.com/wiki/View_text_file_in_two_columnsnoremap<silent><Leader>vs :<C-u>let @z=&so<CR>:setso=0noscb<CR>:bovs<CR>Ljzt:setlscb<CR><C-w>p:setlscb<CR>:let &so=@z<CR>" Enable filetype pluginfiletypeonfiletype indent onfiletype plugin on" Filetypes and encodingsetfileformats=unix,dos,mac
setencoding=utf-8fileencoding=utf-8termencoding=utf-8setwildignore+=.svn,CVS,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif
" diversesetnocompatible" ViM settings instead of Visetnobackupnowritebackupnoswapfileautoread" no backup or swap" Coloringsyntax enable
colorscheme desert
setbackground=darksett_Co=256" 256 colors in terminalsetcursorlinesetcursorcolumnif exists('+colorcolumn')
:highlight ColorColumn ctermbg=235 guibg=#2c2d27setcolorcolumn=80,120 "let &colorcolumn="80,".join(range(120,500),",") "au FileType * let &colorcolumn="80,".join(range(120,500),",") "au FileType sql let &colorcolumn=join(range(75,500),",")endifif has ('clipboard')setclipboard=unnamed " use the system clipboard for yank/put/delete " necessary for Vi Improved Touch (Android)if has('X11')setclipboard+=unnamedplus
endifendifsetantialias" Pretty fontssett_Co=256" 256-color palletessetlinespace=0" Don't insert any extra pixel linessetlazyredraw" Don't redraw while running macros" Search optionssethlsearchsetincsearchsetignorecasesetshowmatchsetsmartcasesethistory=500settw=1000" clean search highlighting (until again invoking a search command)"nnoremap <esc> :noh<cr>" make backspace a more flexible" backspace over linebreakssetbackspace=indent,eol,start" Disable soundssetvbt_vb="
setnoerrorbellssetvisualbell" indentingsetautoindentsetsmartindentsetshiftwidth=4setsofttabstop=4settabstop=4setsmarttabsetexpandtab" status line etc.setrulersetlaststatus=2" add [encoding] to status barsetstatusline=%<%f\ %h%m%r%=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"}%k\ %-14.(%l,%c%V%)\ %P
"set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]" | | | | | | | | | | |" | | | | | | | | | | + current" | | | | | | | | | | column" | | | | | | | | | +-- current line" | | | | | | | | +-- current % into file" | | | | | | | +-- current syntax in" | | | | | | | square brackets" | | | | | | +-- current fileformat" | | | | | +-- number of lines" | | | | +-- preview flag in square brackets" | | | +-- help flag in square brackets" | | +-- readonly flag in square brackets" | +-- rodified flag in square brackets" +-- full path to file in the buffersetshowmodesetshowcmdsetnumbersetrelativenumbersetswitchbuf=useopen,usetab,newtab
" switch buffer without savingsethidden" foldingsetfoldmethod=indent
setnofoldenablesetscrolloff=3setsidescroll=5" Screen Size" This is console Vim.if exists("+lines")setlines=50endifif exists("+columns")setcolumns=100endif" make certain white spaces visiblesetlistsetlistlistchars=nbsp:¬,precedes:<,extends:>,tab:>-,trail:.,eol:$
" inverse moving by display/actual linennoremapk gk
nnoremapj gj
nnoremap gk knnoremap gj j" Tabs - short keys" managennoremaptn :tabnew<CR>nnoremap td :tabclose<CR>" movennoremapth :tabfirst<CR>nnoremaptj :tabnext<CR>nnoremap tk :tabprev<CR>nnoremaptl :tablast<CR>" Windows - short keys" create new windows right/belowsetsplitrightsetsplitbelow" movennoremapwh<C-w>hnnoremap wj <C-w>jnnoremap wk <C-w>knnoremap wl <C-w>l" Session management" - do not store 'options' as this would overrule vimrc"set sessionoptions=buffers,curdir,folds,help,localoptions,tabpagessetsessionoptions-=optionsnnoremapss :mksession!~/default.vimsession<cr>nnoremapls :source ~/default.vimsession<cr>" automatic session store/reload ... currently disabled"autocmd VimLeave * execute ':mksession! ~/default.vimsession'"autocmd VimEnter * execute ':source ~/default.vimsession'" HEX mode" http://vim.wikia.com/wiki/Improved_hex_editing" ex command for toggling hex mode
command -bar Hexmode call ToggleHex()" helper function to toggle hex modefunction ToggleHex() " hex mode should be considered a read-only operation " save values for modified and read-only for restoration later, " and clear the read-only flag for nowletl:modified=&modletl:oldreadonly=&readonlylet &readonly=0letl:oldmodifiable=&modifiablelet &modifiable=1if!exists("b:editHex")||!b:editHex
" save old optionsletb:oldft=&ftletb:oldbin=&bin " set new optionssetlocalbinary" make sure it overrides any textwidth, etc.let &ft="xxd" " set statusletb:editHex=1 " switch to hex editor
%!xxd
else " restore old optionslet &ft=b:oldft
if!b:oldbin
setlocalnobinaryendif " set statusletb:editHex=0 " return to normal editing
%!xxd -rendif " restore values for modified and read only statelet &mod=l:modifiedlet &readonly=l:oldreadonly
let &modifiable=l:oldmodifiable
endfunction"""""""""""""""""""" Custom commands """"""""""""""""""""" Pretty print json (requires python support)
command PPjson %! python -m json.tool
gvimrc
" to reload the gvimrc after editing without restarting vim type" :source $MYGVIMRC" windows specific" http://mkrmr.wordpress.com/2010/05/30/vim-tip-platform-specific-settings-in-your-vimrc/if has('win16')|| has('win32')|| has('win64')|| has('win95')setguifont=Consolas:h10 " looks good in windows (7), bad in linux (ubuntu 14.04/gnome3)setguifontwide=MingLiU:h10 " for windows to display mixed character setssetfileformats=dos,unix,mac
" http://vim.wikia.com/wiki/Maximize_or_set_initial_window_sizeauGUIEnter * simalt~x" Maximize gvim window (<windows>+<up> keys)endif"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Screen Size """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Maximize gvim window." set lines=999 columns=999setguioptions+=c" Console messages in gVIMsetguioptions-=m" disable menusetguioptions-=T " disable toolbarsetguioptions-=r" disable right scrollbar