" vim: fdm=marker ts=2 sts=2 sw=2 " detect OS {{{ let s:is_windows = has('win32') || has('win64') let s:is_cygwin = has('win32unix') let s:is_macvim = has('gui_macvim') "}}} " dotvim settings {{{ if !exists('g:dotvim_settings') let g:dotvim_settings = {} endif " initialize default settings let s:settings = {} let s:settings.default_indent = 2 let s:settings.max_column = 120 let s:settings.autocomplete_method = 'neocomplcache' let s:settings.enable_cursorcolumn = 0 if has('patch885') && has('lua') let s:settings.autocomplete_method = 'neocomplete' elseif has('patch584') && filereadable(expand("~/.vim/bundle/YouCompleteMe/python/ycm_core.*")) let s:settings.autocomplete_method = 'ycm' endif let s:settings.plugin_groups = [] call add(s:settings.plugin_groups, 'core') call add(s:settings.plugin_groups, 'web') call add(s:settings.plugin_groups, 'javascript') call add(s:settings.plugin_groups, 'ruby') call add(s:settings.plugin_groups, 'python') call add(s:settings.plugin_groups, 'go') call add(s:settings.plugin_groups, 'scm') call add(s:settings.plugin_groups, 'editing') call add(s:settings.plugin_groups, 'visual') call add(s:settings.plugin_groups, 'indents') call add(s:settings.plugin_groups, 'navigation') call add(s:settings.plugin_groups, 'unite') call add(s:settings.plugin_groups, 'autocomplete') call add(s:settings.plugin_groups, 'misc') if s:is_windows call add(s:settings.plugin_groups, 'windows') endif if exists('g:dotvim_settings.plugin_groups_exclude') for group in g:dotvim_settings.plugin_groups_exclude let i = index(s:settings.plugin_groups, group) if i != -1 call remove(s:settings.plugin_groups, i) endif endfor endif for key in keys(s:settings) if has_key(g:dotvim_settings, key) let s:settings[key] = g:dotvim_settings[key] endif endfor "}}} " setup & neobundle {{{ set nocompatible if s:is_windows set rtp+=~/.vim endif set rtp+=~/.vim/bundle/neobundle.vim call neobundle#rc(expand('~/.vim/bundle/')) NeoBundleFetch 'Shougo/neobundle.vim' "}}} " functions {{{ function! Preserve(command) "{{{ " preparation: save last search, and cursor position. let _s=@/ let l = line(".") let c = col(".") " do the business: execute a:command " clean up: restore previous search history, and cursor position let @/=_s call cursor(l, c) endfunction "}}} function! StripTrailingWhitespace() "{{{ call Preserve("%s/\\s\\+$//e") endfunction "}}} function! EnsureExists(path) "{{{ if !isdirectory(expand(a:path)) call mkdir(expand(a:path)) endif endfunction "}}} function! CloseWindowOrKillBuffer() "{{{ let number_of_windows_to_this_buffer = len(filter(range(1, winnr('$')), "winbufnr(v:val) == bufnr('%')")) " never bdelete a nerd tree if matchstr(expand("%"), 'NERD') == 'NERD' wincmd c return endif if number_of_windows_to_this_buffer > 1 wincmd c else bdelete endif endfunction "}}} "}}} " base configuration {{{ set timeoutlen=300 "mapping timeout set ttimeoutlen=50 "keycode timeout set mouse=a "enable mouse set mousehide "hide when characters are typed set history=1000 "number of command lines to remember set ttyfast "assume fast terminal connection set viewoptions=folds,options,cursor,unix,slash "unix/windows compatibility set encoding=utf-8 "set encoding for text if exists('$TMUX') set clipboard= else set clipboard=unnamed "sync with OS clipboard endif set hidden "allow buffer switching without saving set autoread "auto reload if file saved externally set fileformats+=mac "add mac to auto-detection of file format line endings set nrformats-=octal "always assume decimal numbers set showcmd set tags=tags;/ set showfulltag set keywordprg=":help" "remap K to vim help set modeline set modelines=5 if s:is_windows && !s:is_cygwin " ensure correct shell in gvim set shell=c:\windows\system32\cmd.exe endif " whitespace set backspace=indent,eol,start "allow backspacing everything in insert mode set autoindent "automatically indent to match adjacent lines set smartindent "smart indenting for additional languages set expandtab "spaces instead of tabs set smarttab "use shiftwidth to enter tabs let &tabstop=s:settings.default_indent "number of spaces per tab for display let &softtabstop=s:settings.default_indent "number of spaces per tab in insert mode let &shiftwidth=s:settings.default_indent "number of spaces when indenting set list "highlight whitespace set listchars=tab:│\ ,trail:•,extends:❯,precedes:❮ set shiftround set linebreak set showbreak=↪\ set scrolloff=1 "always show content after scroll set scrolljump=5 "minimum number of lines to scroll set display+=lastline set wildmenu "show list for autocomplete set wildmode=list:longest:full "priority for tab completion set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store set splitbelow set splitright " disable sounds set noerrorbells set novisualbell set t_vb= " searching set hlsearch "highlight searches set incsearch "incremental searching set ignorecase "ignore case for searching set smartcase "do case-sensitive if there's a capital letter if executable('ack') set grepprg=ack\ --nogroup\ --column\ --smart-case\ --nocolor\ --follow\ $* set grepformat=%f:%l:%c:%m endif if executable('ag') set grepprg=ag\ --nogroup\ --column\ --smart-case\ --nocolor\ --follow set grepformat=%f:%l:%c:%m endif " vim file/folder management {{{ " persistent undo if exists('+undofile') set undofile set undodir=~/.vim/.cache/undo endif " backups set backup set backupdir=~/.vim/.cache/backup " swap files set directory=~/.vim/.cache/swap set noswapfile call EnsureExists('~/.vim/.cache') call EnsureExists(&undodir) call EnsureExists(&backupdir) call EnsureExists(&directory) "}}} let mapleader = "," let g:mapleader = "," "}}} " ui configuration {{{ set showmatch "automatically highlight matching braces/brackets/etc. set matchtime=2 "tens of a second to show matching parentheses set laststatus=2 set number set lazyredraw set noshowmode set foldenable "enable folds by default set foldmethod=syntax "fold via syntax of files set foldlevelstart=99 "open all folds by default let g:xml_syntax_folding=1 "enable xml folding set cursorline autocmd WinLeave * setlocal nocursorline autocmd WinEnter * setlocal cursorline let &colorcolumn=s:settings.max_column if s:settings.enable_cursorcolumn set cursorcolumn autocmd WinLeave * setlocal nocursorcolumn autocmd WinEnter * setlocal cursorcolumn endif if has('conceal') set conceallevel=1 set listchars+=conceal:Δ endif if has('gui_running') set lines=999 columns=999 "open maximized set guioptions+=t "tear off menu items set guioptions-=T "toolbar icons if s:is_macvim set gfn=Ubuntu_Mono:h14 set transparency=2 endif if s:is_windows set gfn=Ubuntu_Mono:h10 endif if has('gui_gtk') set gfn=Ubuntu\ Mono\ 11 endif else set t_Co=256 if $TERM_PROGRAM == 'iTerm.app' " different cursors for insert vs normal mode if exists('$TMUX') let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\" let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\" else let &t_SI = "\]50;CursorShape=1\x7" let &t_EI = "\]50;CursorShape=0\x7" endif endif endif "}}} " plugin/mapping configuration {{{ if count(s:settings.plugin_groups, 'core') "{{{ NeoBundle 'matchit.zip' NeoBundle 'tpope/vim-surround' NeoBundle 'tpope/vim-repeat' NeoBundle 'tpope/vim-dispatch' NeoBundle 'tpope/vim-eunuch' NeoBundle 'tpope/vim-unimpaired' "{{{ nmap [e nmap ]e vmap [egv vmap ]egv "}}} NeoBundleDepends 'Shougo/vimproc.vim', { \ 'build': { \ 'mac': 'make -f make_mac.mak', \ 'unix': 'make -f make_unix.mak', \ 'cygwin': 'make -f make_cygwin.mak', \ 'windows': '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe" make_msvc32.mak', \ }, \ } endif "}}} if count(s:settings.plugin_groups, 'web') "{{{ NeoBundleLazy 'groenewege/vim-less', {'autoload':{'filetypes':['less']}} NeoBundleLazy 'cakebaker/scss-syntax.vim', {'autoload':{'filetypes':['scss','sass']}} NeoBundleLazy 'hail2u/vim-css3-syntax', {'autoload':{'filetypes':['css','scss','sass']}} NeoBundleLazy 'ap/vim-css-color', {'autoload':{'filetypes':['css','scss','sass','less','styl']}} NeoBundleLazy 'othree/html5.vim', {'autoload':{'filetypes':['html']}} NeoBundleLazy 'wavded/vim-stylus', {'autoload':{'filetypes':['styl']}} NeoBundleLazy 'digitaltoad/vim-jade', {'autoload':{'filetypes':['jade']}} NeoBundleLazy 'juvenn/mustache.vim', {'autoload':{'filetypes':['mustache']}} NeoBundleLazy 'gregsexton/MatchTag', {'autoload':{'filetypes':['html','xml']}} NeoBundleLazy 'mattn/zencoding-vim', {'autoload':{'filetypes':['html','xml','xsl','xslt','xsd','css','sass','scss','less','mustache']}} "{{{ autocmd FileType html,xml,xsl,xslt,xsd,css,sass,scss,less,mustache inoremap u:call zencoding#expandAbbr(0,"")a "}}} endif "}}} if count(s:settings.plugin_groups, 'javascript') "{{{ NeoBundleLazy 'teramako/jscomplete-vim', {'autoload':{'filetypes':['javascript']}} "{{{ autocmd FileType javascript setlocal omnifunc=jscomplete#CompleteJS "}}} NeoBundleLazy 'pangloss/vim-javascript', {'autoload':{'filetypes':['javascript']}} NeoBundleLazy 'maksimr/vim-jsbeautify', {'autoload':{'filetypes':['javascript']}} "{{{ nnoremap fjs :call JsBeautify() "}}} NeoBundleLazy 'leafgarland/typescript-vim', {'autoload':{'filetypes':['typescript']}} NeoBundleLazy 'kchmck/vim-coffee-script', {'autoload':{'filetypes':['coffee']}} NeoBundleLazy 'mmalecki/vim-node.js', {'autoload':{'filetypes':['javascript']}} NeoBundleLazy 'leshill/vim-json', {'autoload':{'filetypes':['javascript','json']}} NeoBundleLazy 'othree/javascript-libraries-syntax.vim', {'autoload':{'filetypes':['javascript','coffee','ls','typescript']}} endif "}}} if count(s:settings.plugin_groups, 'ruby') "{{{ NeoBundle 'tpope/vim-rails' NeoBundle 'tpope/vim-bundler' endif "}}} if count(s:settings.plugin_groups, 'python') "{{{ NeoBundleLazy 'klen/python-mode', {'autoload':{'filetypes':['python']}} "{{{ let g:pymode_rope=0 "}}} NeoBundleLazy 'davidhalter/jedi-vim', {'autoload':{'filetypes':['python']}} "{{{ let g:jedi#popup_on_dot=0 "}}} endif "}}} if count(s:settings.plugin_groups, 'go') "{{{ NeoBundleLazy 'jnwhiteh/vim-golang', {'autoload':{'filetypes':['go']}} endif "}}} if count(s:settings.plugin_groups, 'scm') "{{{ " NeoBundle 'sjl/splice.vim' NeoBundle 'mhinz/vim-signify' "{{{ let g:signify_update_on_bufenter=0 "}}} NeoBundle 'tpope/vim-fugitive' "{{{ nnoremap gs :Gstatus nnoremap gd :Gdiff nnoremap gc :Gcommit nnoremap gb :Gblame nnoremap gl :Glog nnoremap gp :Git push nnoremap gw :Gwrite nnoremap gr :Gremove autocmd FileType gitcommit nmap U :Git checkout -- autocmd BufReadPost fugitive://* set bufhidden=delete "}}} NeoBundleLazy 'gregsexton/gitv', {'depends':['tpope/vim-fugitive'], 'autoload':{'commands':'Gitv'}} "{{{ nnoremap gv :Gitv nnoremap gV :Gitv! "}}} endif "}}} if count(s:settings.plugin_groups, 'autocomplete') "{{{ NeoBundle 'honza/vim-snippets' if s:settings.autocomplete_method == 'ycm' "{{{ NeoBundle 'Valloric/YouCompleteMe' "{{{ let g:ycm_complete_in_comments_and_strings=1 let g:ycm_key_list_select_completion=['', ''] let g:ycm_key_list_previous_completion=['', ''] let g:ycm_filetype_blacklist={'unite': 1} "}}} NeoBundle 'SirVer/ultisnips' "{{{ let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" let g:UltiSnipsSnippetsDir='~/.vim/snippets' "}}} else NeoBundle 'Shougo/neosnippet.vim' "{{{ let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets,~/.vim/snippets' let g:neosnippet#enable_snipmate_compatibility=1 imap neosnippet#expandable_or_jumpable() ? "\(neosnippet_expand_or_jump)" : (pumvisible() ? "\" : "\") smap neosnippet#expandable_or_jumpable() ? "\(neosnippet_expand_or_jump)" : "\" imap pumvisible() ? "\" : "" smap pumvisible() ? "\" : "" "}}} endif "}}} if s:settings.autocomplete_method == 'neocomplete' "{{{ NeoBundleLazy 'Shougo/neocomplete.vim', {'autoload':{'insert':1}} "{{{ let g:neocomplete#enable_at_startup=1 let g:neocomplete#data_directory='~/.vim/.cache/neocomplete' let g:neocomplete#enable_auto_delimiter=1 "}}} endif "}}} if s:settings.autocomplete_method == 'neocomplcache' "{{{ NeoBundleLazy 'Shougo/neocomplcache.vim', {'autoload':{'insert':1}} "{{{ let g:neocomplcache_enable_at_startup=1 let g:neocomplcache_enable_auto_delimiter=1 " let g:neocomplcache_force_overwrite_completefunc=1 " let g:neocomplcache_auto_completion_start_length=1 let g:neocomplcache_max_list=10 let g:neocomplcache_temporary_dir='~/.vim/.cache/neocon' " let g:neocomplcache_enable_auto_select=1 " let g:neocomplcache_enable_cursor_hold_i=1 " let g:neocomplcache_cursor_hold_i_time=300 let g:neocomplcache_enable_fuzzy_completion=1 if !exists('g:neocomplcache_omni_functions') let g:neocomplcache_omni_functions = {} endif " enable general omni completion let g:neocomplcache_omni_functions.css = 'csscomplete#CompleteCSS' let g:neocomplcache_omni_functions.html = 'htmlcomplete#CompleteTags' let g:neocomplcache_omni_functions.markdown = 'htmlcomplete#CompleteTags' let g:neocomplcache_omni_functions.python = 'pythoncomplete#Complete' let g:neocomplcache_omni_functions.xml = 'xmlcomplete#CompleteTags' let g:neocomplcache_omni_functions.ruby = 'rubycomplete#Complete' "}}} endif "}}} endif "}}} if count(s:settings.plugin_groups, 'editing') "{{{ NeoBundleLazy 'editorconfig/editorconfig-vim', {'autoload':{'insert':1}} NeoBundle 'tpope/vim-speeddating' NeoBundle 'tpope/vim-endwise' NeoBundle 'tomtom/tcomment_vim' NeoBundle 'terryma/vim-expand-region' NeoBundle 'terryma/vim-multiple-cursors' NeoBundle 'chrisbra/NrrwRgn' NeoBundle 'dahu/vim-fanfingtastic' NeoBundleLazy 'godlygeek/tabular', {'autoload':{'commands':'Tabularize'}} "{{{ nmap a& :Tabularize /& vmap a& :Tabularize /& nmap a= :Tabularize /= vmap a= :Tabularize /= nmap a: :Tabularize /: vmap a: :Tabularize /: nmap a:: :Tabularize /:\zs vmap a:: :Tabularize /:\zs nmap a, :Tabularize /, vmap a, :Tabularize /, nmap a :Tabularize / vmap a :Tabularize / "}}} NeoBundle 'Raimondi/delimitMate' "{{{ let delimitMate_expand_cr=1 autocmd FileType markdown,vim let b:loaded_delimitMate=1 "}}} NeoBundle 'skwp/vim-easymotion' "{{{ " NeoBundle 'Lokaltog/vim-easymotion' let g:EasyMotion_keys = 'asdfghjklqwertyuiopzxcvbnm' autocmd ColorScheme * highlight EasyMotionTarget ctermfg=32 guifg=#0087df autocmd ColorScheme * highlight EasyMotionShade ctermfg=237 guifg=#3a3a3a "}}} endif "}}} if count(s:settings.plugin_groups, 'navigation') "{{{ NeoBundleLazy 'mbbill/undotree', {'autoload':{'commands':'UndotreeToggle'}} "{{{ let g:undotree_SplitLocation='botright' let g:undotree_SetFocusWhenToggle=1 nnoremap :UndotreeToggle "}}} NeoBundleLazy 'EasyGrep', {'autoload':{'commands':'GrepOptions'}} "{{{ let g:EasyGrepRecursive=1 let g:EasyGrepAllOptionsInExplorer=1 let g:EasyGrepCommand=1 nnoremap vo :GrepOptions "}}} NeoBundle 'kien/ctrlp.vim', { 'depends': 'tacahiroy/ctrlp-funky' } "{{{ let g:ctrlp_clear_cache_on_exit=1 let g:ctrlp_max_height=40 let g:ctrlp_show_hidden=0 let g:ctrlp_follow_symlinks=1 let g:ctrlp_working_path_mode=0 let g:ctrlp_max_files=20000 let g:ctrlp_cache_dir='~/.vim/.cache/ctrlp' let g:ctrlp_extensions=['funky'] nmap \ [ctrlp] nnoremap [ctrlp] nnoremap [ctrlp]t :CtrlPBufTag nnoremap [ctrlp]T :CtrlPTag nnoremap [ctrlp]l :CtrlPLine nnoremap [ctrlp]o :CtrlPFunky nnoremap [ctrlp]b :CtrlPBuffer "}}} " NeoBundle 'Shougo/vimfiler.vim' "{{{ " let g:vimfiler_as_default_explorer=1 " let g:vimfiler_data_directory='~/.vim/.cache/vimfiler' " nnoremap :VimFilerExplorer " nnoremap :VimFilerBufferDir --explorer " "}}} NeoBundleLazy 'scrooloose/nerdtree', {'autoload':{'commands':['NERDTreeToggle','NERDTreeFind']}} "{{{ let NERDTreeShowHidden=1 let NERDTreeQuitOnOpen=0 let NERDTreeShowLineNumbers=1 let NERDTreeChDirMode=0 let NERDTreeShowBookmarks=1 let NERDTreeIgnore=['\.git','\.hg'] let NERDTreeBookmarksFile='~/.vim/.cache/NERDTreeBookmarks' nnoremap :NERDTreeToggle nnoremap :NERDTreeFind "}}} NeoBundleLazy 'majutsushi/tagbar', {'autoload':{'commands':'TagbarToggle'}} "{{{ nnoremap :TagbarToggle "}}} endif "}}} if count(s:settings.plugin_groups, 'unite') "{{{ NeoBundleLazy 'Shougo/unite.vim', {'autoload':{'commands':'Unite'}} "{{{ let bundle = neobundle#get('unite.vim') function! bundle.hooks.on_source(bundle) call unite#filters#matcher_default#use(['matcher_fuzzy']) call unite#filters#sorter_default#use(['sorter_rank']) call unite#set_profile('files', 'smartcase', 1) call unite#custom#source('line,outline','matchers','matcher_fuzzy') endfunction let g:unite_data_directory='~/.vim/.cache/unite' let g:unite_enable_start_insert=1 let g:unite_source_history_yank_enable=1 let g:unite_source_rec_max_cache_files=5000 let g:unite_prompt='» ' if executable('ag') let g:unite_source_grep_command='ag' let g:unite_source_grep_default_opts='--nocolor --nogroup --hidden' let g:unite_source_grep_recursive_opt='' elseif executable('ack') let g:unite_source_grep_command='ack' let g:unite_source_grep_default_opts='--no-heading --no-color -a' let g:unite_source_grep_recursive_opt='' endif function! s:unite_settings() nmap Q (unite_exit) nmap (unite_exit) imap (unite_exit) endfunction autocmd FileType unite call s:unite_settings() nmap [unite] nnoremap [unite] if s:is_windows nnoremap [unite] :Unite -toggle -auto-resize -buffer-name=mixed file_rec buffer file_mru bookmark nnoremap [unite]f :Unite -toggle -auto-resize -buffer-name=files file_rec else nnoremap [unite] :Unite -toggle -auto-resize -buffer-name=mixed file_rec/async buffer file_mru bookmark nnoremap [unite]f :Unite -toggle -auto-resize -buffer-name=files file_rec/async endif nnoremap [unite]y :Unite -buffer-name=yanks history/yank nnoremap [unite]l :Unite -auto-resize -buffer-name=line line nnoremap [unite]b :Unite -auto-resize -buffer-name=buffers buffer nnoremap [unite]/ :Unite -no-quit -buffer-name=search grep:. nnoremap [unite]m :Unite -auto-resize -buffer-name=mappings mapping nnoremap [unite]s :Unite -quick-match buffer "}}} NeoBundleLazy 'tsukkee/unite-tag', {'autoload':{'unite_sources':['tag','tag/file']}} "{{{ nnoremap [unite]t :Unite -auto-resize -buffer-name=tags tags tags/file "}}} NeoBundleLazy 'Shougo/unite-outline', {'autoload':{'unite_sources':'outline'}} "{{{ nnoremap [unite]o :Unite -auto-resize -buffer-name=outline outline "}}} NeoBundleLazy 'Shougo/junkfile.vim', {'autoload':{'commands':'JunkfileOpen','unite_sources':['junkfile','junkfile/new']}} "{{{ let g:junkfile#directory=expand("~/.vim/.cache/junk") nnoremap [unite]j :Unite -auto-resize -buffer-name=junk junkfile junkfile/new "}}} endif "}}} if count(s:settings.plugin_groups, 'visual') "{{{ NeoBundle 'bling/vim-bufferline' "{{{ let g:bufferline_echo=0 let g:bufferline_rotate=1 "}}} " NeoBundle 'Lokaltog/vim-powerline' "{{{ " let g:Powerline_symbols = 'unicode' " "}}} " NeoBundle 'Lokaltog/powerline', { 'rtp': 'powerline/bindings/vim' } " NeoBundle 'zhaocai/linepower.vim' " NeoBundle 'myusuf3/numbers.vim', { 'gui': 1 } NeoBundle 'kshenoy/vim-signature' NeoBundleLazy 'zhaocai/GoldenView.Vim', {'autoload':{'mappings':['ToggleGoldenViewAutoResize']}} "{{{ let g:goldenview__enable_default_mapping=0 nmap ToggleGoldenViewAutoResize "}}} " NeoBundleLazy 'roman/golden-ratio', {'autoload':{'commands':'GoldenRatioToggle'}} "{{{ " let g:golden_ratio_autocommand=0 " let g:golden_ratio_wrap_ignored=0 " nnoremap :GoldenRatioToggle " "}}} endif "}}} if count(s:settings.plugin_groups, 'indents') "{{{ NeoBundle 'nathanaelkane/vim-indent-guides' "{{{ let g:indent_guides_start_level=1 let g:indent_guides_guide_size=1 let g:indent_guides_enable_on_vim_startup=1 let g:indent_guides_color_change_percent=3 if !has('gui_running') let g:indent_guides_auto_colors=0 function! s:indent_set_console_colors() hi IndentGuidesOdd ctermbg=235 hi IndentGuidesEven ctermbg=236 endfunction autocmd VimEnter,Colorscheme * call s:indent_set_console_colors() endif "}}} endif "}}} if count(s:settings.plugin_groups, 'misc') "{{{ NeoBundleLazy 'tpope/vim-markdown', {'autoload':{'filetypes':['markdown']}} if executable('redcarpet') && executable('instant-markdown-d') NeoBundleLazy 'suan/vim-instant-markdown', {'autoload':{'filetypes':['markdown']}} endif NeoBundleLazy 'guns/xterm-color-table.vim', {'autoload':{'commands':'XtermColorTable'}} NeoBundle 'vimwiki' NeoBundle 'bufkill.vim' NeoBundle 'mhinz/vim-startify' "{{{ let g:startify_session_dir = '~/.vim/.cache/sessions' let g:startify_show_sessions = 1 nnoremap :Startify "}}} NeoBundle 'scrooloose/syntastic' "{{{ let g:syntastic_error_symbol = '✗' let g:syntastic_style_error_symbol = '✠' let g:syntastic_warning_symbol = '∆' let g:syntastic_style_warning_symbol = '≈' "}}} NeoBundleLazy 'mattn/gist-vim', { 'depends': 'mattn/webapi-vim', 'autoload': { 'commands': 'Gist' } } "{{{ let g:gist_post_private=1 let g:gist_show_privates=1 "}}} NeoBundleLazy 'Shougo/vimshell.vim', {'autoload':{'commands':'VimShell'}} "{{{ if s:is_macvim let g:vimshell_editor_command='mvim' else let g:vimshell_editor_command='vim' endif let g:vimshell_right_prompt='getcwd()' let g:vimshell_temporary_directory='~/.vim/.cache/vimshell' let g:vimshell_vimshrc_path='~/.vim/vimshrc' nnoremap c :VimShell -split "}}} endif "}}} if count(s:settings.plugin_groups, 'windows') "{{{ NeoBundleLazy 'PProvost/vim-ps1', {'autoload':{'filetypes':['ps1']}} "{{{ autocmd BufNewFile,BufRead *.ps1,*.psd1,*.psm1 setlocal ft=ps1 "}}} NeoBundleLazy 'OrangeT/vim-csharp', {'autoload':{'filetypes':['cs']}} endif "}}} nnoremap nbu :Unite neobundle/update -no-start-insert "}}} " mappings {{{ " formatting shortcuts nmap fef :call Preserve("normal gg=G") nmap f$ :call StripTrailingWhitespace() vmap s :sort " toggle paste map :set invpaste:set paste? " remap arrow keys nnoremap :bprev nnoremap :bnext nnoremap :tabnext nnoremap :tabprev " change cursor position in insert mode inoremap inoremap if mapcheck('/') == '' nnoremap / :vimgrep //gj **/* endif " sane regex {{{ nnoremap / /\v vnoremap / /\v nnoremap ? ?\v vnoremap ? ?\v cnoremap s/ s/\v "}}} " folds {{{ nnoremap zr zr:echo &foldlevel nnoremap zm zm:echo &foldlevel nnoremap zR zR:echo &foldlevel nnoremap zM zM:echo &foldlevel " }}} " screen line scroll nnoremap j gj nnoremap k gk " auto center {{{ nnoremap n nzz nnoremap N Nzz nnoremap * *zz nnoremap # #zz nnoremap g* g*zz nnoremap g# g#zz nnoremap zz nnoremap zz "}}} " reselect visual block after indent vnoremap < >gv " reselect last paste nnoremap gp '`[' . strpart(getregtype(), 0, 1) . '`]' " find current word in quickfix nnoremap fw :execute "vimgrep ".expand("")." %":copen " find last search in quickfix nnoremap ff :execute 'vimgrep /'.@/.'/g %':copen " shortcuts for windows {{{ nnoremap v vl nnoremap s s nnoremap vsa :vert sba nnoremap h nnoremap j nnoremap k nnoremap l "}}} " tab shortcuts map tn :tabnew map tc :tabclose " make Y consistent with C and D. See :help Y. nnoremap Y y$ " hide annoying quit message nnoremap :echo " window killer nnoremap Q :call CloseWindowOrKillBuffer() " quick buffer open nnoremap gb :ls:e # if neobundle#is_sourced('vim-dispatch') nnoremap tag :Dispatch ctags -R endif " general nmap l :set list! list? noremap :set hlsearch! hlsearch? map :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" " helpers for profiling {{{ nnoremap DD :exe ":profile start profile.log":exe ":profile func *":exe ":profile file *" nnoremap DP :exe ":profile pause" nnoremap DC :exe ":profile continue" nnoremap DQ :exe ":profile pause":noautocmd qall! "}}} "}}} " autocmd {{{ " go back to previous position of cursor if any autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe 'normal! g`"zvzz' | \ endif autocmd FileType js,scss,css autocmd BufWritePre call StripTrailingWhitespace() autocmd FileType css,scss setlocal foldmethod=marker foldmarker={,} autocmd FileType css,scss nnoremap S vi{:sort autocmd FileType python setlocal foldmethod=indent autocmd FileType markdown setlocal nolist "}}} " vundle rtp load sequence requires the filetypes to be loaded after all bundles are loaded filetype off filetype plugin indent on syntax enable " color schemes {{{ NeoBundle 'altercation/vim-colors-solarized' NeoBundle 'nanotech/jellybeans.vim' NeoBundle 'tomasr/molokai' NeoBundle 'chriskempson/vim-tomorrow-theme' NeoBundle 'w0ng/vim-hybrid' NeoBundle 'sjl/badwolf' NeoBundle 'jelera/vim-gummybears-colorscheme' NeoBundle 'zeis/vim-kolor' "{{{ let g:kolor_underlined=1 "}}} colorscheme jellybeans "}}} if filereadable(expand("~/.vimrc.local")) echom "Sourcing ~/.vimrc.local is deprecated. Please consult the README on how to create a shim." source ~/.vimrc.local endif NeoBundleCheck