set nocompatible set t_Co=256 set background=dark "set background=light "colorscheme molokai "colorscheme darkspectrum colorscheme chela_light set guifont=Envy_Code_B:h9 "----------------------------------------------------------------" set autochdir set fileformat=unix set fileformats=unix,dos set nocompatible set backspace=indent,eol,start syntax on "----------------------------------------------------------------" filetyp plugin indent on "----------------------------------------------------------------" set ruler " show the cursor position all the time set showcmd " display incomplete commands set incsearch nohlsearch " do incremental searching set autoindent " always set autoindenting on "----------------------------------------------------------------" set go-=T " disable tabs set go-=m " disable menu set go-=L " disable left scrollbar "set go-=r " disable right scrollbar "----------------------------------------------------------------" set encoding=utf8 try lang en_US catch endtry "----------------------------------------------------------------" au BufRead,BufNewFile,BufNew,BufCreate set fileformat=unix "----------------------------------------------------------------" set foldcolumn=1 set nonu set nohls "----------------------------------------------------------------" command! Bclose call BufcloseCloseIt() function! BufcloseCloseIt() let l:currentBufNum = bufnr("%") let l:alternateBufNum = bufnr("#") if buflisted(l:alternateBufNum) buffer # else bnexc endif if bufnr("%") == l:currentBufNum new endif if buflisted(l:currentBufNum) execute("bdelete! ".l:currentBufNum) endif endfunction "----------------------------------------------------------------" " Specify the behavior when switching between buffers try set switchbuf=usetab set stal=1 catch endtry set nocp "----------------------------------------------------------------" " => General "----------------------------------------------------------------" set history=2000 set autoread let mapleader = "," let g:mapleader = "," "----------------------------------------------------------------" nmap r gg=Gg; nmap u zc nmap m zo nmap J oi "----------------------------------------------------------------" imap "----------------------------------------------------------------" map e :e! $VIM/_vimrc autocmd! bufwritepost _vimrc source $VIM/_vimrc "----------------------------------------------------------------" " => VIM user interface "----------------------------------------------------------------" " Set 7 lines to the curors - when moving vertical.. set so=10 set wildmenu " Turn on WiLd menu set ruler " Always show current position set cmdheight=1 " The commandbar height set hid " Change buffer - without saving "----------------------------------------------------------------" " Set backspace config set backspace=eol,start,indent set whichwrap+=<,>,h,l set ignorecase " Ignore case when searching set smartcase set incsearch " Make search act like search in modern browsers set nolazyredraw " Don't redraw while executing macros set magic " Set magic on, for regular expressions set showmatch " Show matching bracets when text indicator is over them set mat=2 " How many tenths of a second to blink "----------------------------------------------------------------" " No sound on errors set noerrorbells set novisualbell set t_vb= set tm=500 "----------------------------------------------------------------" " => Files, backups and undo "----------------------------------------------------------------" " Turn backup off, since most stuff is in SVN, git anyway... set nobackup set nowb set noswapfile "----------------------------------------------------------------" "Persistent undo try if MySys() == "windows" set undodir=C:\Windows\Temp else set undodir=~/.vim_runtime/undodir endif set undofile catch endtry "----------------------------------------------------------------" " => Text, tab and indent related "----------------------------------------------------------------" set expandtab set shiftwidth=2 set tabstop=2 set smarttab set lbr set tw=500 set ai " Auto indent set si " Smart indet set wrap " Wrap lines set linebreak set nolist set textwidth=0 set wrapmargin=0 "----------------------------------------------------------------" " => Visual mode related "----------------------------------------------------------------" " Really useful! " In visual mode when you press * or # to search for the current selection vnoremap * :call VisualSearch('f') vnoremap # :call VisualSearch('b') "----------------------------------------------------------------" " When you press gv you vimgrep after the selected text vnoremap gv :call VisualSearch('gv') "map 2 :vimgrep // **/*. "----------------------------------------------------------------" function! CmdLine(str) exe "menu Foo.Bar :" . a:str emenu Foo.Bar unmenu Foo endfunction "----------------------------------------------------------------" " From an idea by Michael Naumann function! VisualSearch(direction) range let l:saved_reg = @" execute "normal! vgvy" let l:pattern = escape(@", '\\/.*$^~[]') let l:pattern = substitute(l:pattern, "\n$", "", "") if a:direction == 'b' execute "normal ?" . l:pattern . "^M" elseif a:direction == 'gv' call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.') elseif a:direction == 'f' execute "normal /" . l:pattern . "^M" endif let @/ = l:pattern let @" = l:saved_reg endfunction "----------------------------------------------------------------" " => Moving around, tabs and buffers "----------------------------------------------------------------" " Map space to / (search) and c-space to ? (backwards search) map / map ? map :noh "----------------------------------------------------------------" " Smart way to move btw. windows map j map k map h map l "----------------------------------------------------------------" " Close the current buffer map bd :bd "----------------------------------------------------------------" " Use the arrows to something usefull map f :bn map d :bp "----------------------------------------------------------------" " When pressing cd switch to the directory of the open buffer map cd :cd %:p:h "----------------------------------------------------------------" " => Statusline "----------------------------------------------------------------" " Always hide the statusline set laststatus=2 "----------------------------------------------------------------" " Format the statusline set statusline=\ Format:\ %{FileFormat()}\ \ %F%m%r%h\ %w\ \ CWD:\ %r%%h\ \ \ Line:\ %l/%L:%c function! FileFormat() return &fileformat endfunction "----------------------------------------------------------------" function! HasPaste() if &paste return 'PASTE MODE ' else return '' endif endfunction "----------------------------------------------------------------" if has('wildmenu') set wildmenu if has('menu') if !has('gui_running') runtime! menu.vim endif " override Ctrl-Z (minimize) by a text-mode menu " we can still use :suspend for the original meaning " of the key set wildcharm= map :emenu imap :emenu endif endif "----------------------------------------------------------------" let g:user_zen_expandabbr_key = '' let g:use_zen_complete_tag = 1 "----------------------------------------------------------------" set guicursor=a:blinkon0 "----------------------------------------------------------------" " Tabularize Settings if exists(":Tabularize") nmap t vi}OOvi}:Tabularize /:\zsdd vmap t vi}OOvi}:Tabularize /:\zsdd endif "----------------------------------------------------------------" " Colorscheming " Show syntax highlighting groups for word under cursor nmap :call SynStack() function! SynStack() if !exists("*synstack") return endif echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') endfunc "----------------------------------------------------------------" " Fix Movement Keys nnoremap j gj nnoremap k gk vnoremap j gj vnoremap k gk "----------------------------------------------------------------" " NERDTree controls map t :NERDTreeToggle D:\Development\ let NERDTreeHijackNetrw = 0 let NERDTreeMouseMode = 2 let NERDTreeQuitOnOpen = 1 "----------------------------------------------------------------" " Set Line To Title Case map T :s/\<\(\w\)\(\w*\)\>/\u\1\L\2/g "----------------------------------------------------------------" " Splitting Commands map vs :vsp map s :sp "----------------------------------------------------------------" " Toggle spelling with the F7 key nn :setlocal spell! spelllang=en_us imap :setlocal spell! spelllang=en_us "----------------------------------------------------------------" " Set up spelling maps map sf ]s map sd [s map sa zg map ss z= "----------------------------------------------------------------" " Toggle menubar map :set guioptions+=m:set guioptions+=T map :set guioptions-=m:set guioptions-=T "----------------------------------------------------------------" " Insert time / date nmap a=strftime("%Y-%m-%d %a %I:%M %p")oo imap =strftime("%Y-%m-%d %a %I:%M %p")oo "----------------------------------------------------------------" " Open dialog map g :bro e "----------------------------------------------------------------" " Save dialog map b :bro w! "----------------------------------------------------------------" function! FoldColumn() if &foldcolumn == 1 set foldcolumn=0 set nu "normal mxggVG>g'x elseif &foldcolumn == 0 set foldcolumn=1 set nonu "normal mxggVG5 :call FoldColumn() "----------------------------------------------------------------" let g:html_indent_inctags = "html,body,head,tbody" "----------------------------------------------------------------" function PrintDate() let l:date = strftime('%m.%d.%Y') exe "normal i".l:date return '' endfunction function PrintTime() let l:date = strftime('%I:%M %p') exe "normal i".l:date return '' endfunction map 4 :call PrintDate()i imap 4 =PrintDate() map 3 :call PrintTime()i imap 3 =PrintTime() "----------------------------------------------------------------" map / NERDCommenterToggle au BufRead,BufNewFile *.txt set nonu au BufNewFile,BufRead *.chklst setf chklst "----------------------------------------------------------------" map we :BlogList map wr :BlogOpen map ww :BlogNew map ws :BlogSave publish "----------------------------------------------------------------" map td :e $HOME\My\ Documents\todo.chklst let g:checklist_use_timestamps = 0 set virtualedit=block "----------------------------------------------------------------- function! MakeStamp() let time = strftime("%Y-%m-%d at %H:%M:%S") let line = getline(1) let match = '\d\{4}\-\d\{2}\-\d\{2} at \d\{2}:\d\{2}:\d\{2}' if line =~ match exe '1,1s/Last Modified: \zs'.match.'/'.time.'/i' else exe "normal ggOLast Modified: ".time endif return "" endfunction map :call MakeStamp() "----------------------------------------------------------------- set runtimepath+=$VIMRUNTIME/Ultisnips "----------------------------------------------------------------- function! ToggleColors() if g:colors_name == "chela_light" colo darkspectrum elseif g:colors_name == "darkspectrum" colo chela_light endif endfunction map :call ToggleColors() "----------------------------------------------------------------- function! MyToHtml(line1, line2) " delete unneeded lines exec a:line1.','.a:line2.'TOhtml' %g@@d %g@@d %g@@d %g@@d %g@@d %g@<meta@d %g@<head>@d %g@</head>@d %g@body {@d %s/pre { /pre { padding:2px 6px; /g endfunction command! -range=% MyToHtml :call MyToHtml(<line1>,<line2>) "----------------------------------------------------------------" call pathogen#runtime_append_all_bundles() "----------------------------------------------------------------"