" Profile startup time " vim --startuptime vim.log -c q " vim -c 'r ! cat vim.log| sort -k 2' " The mapleader has to be set before vundle starts loading all the plugins. let mapleader=";" " Use Vim settings, rather then Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " NeoBundleInitialisation {{{ if has('vim_starting') set runtimepath+=~/.vim/bundle/neobundle.vim/ endif call neobundle#rc(expand('~/.vim/bundle/')) " Let NeoBundle manage NeoBundle NeoBundleFetch 'Shougo/neobundle.vim' NeoBundle 'Shougo/vimproc', { \ 'build' : { \ 'windows' : 'make -f make_mingw32.mak', \ 'cygwin' : 'make -f make_cygwin.mak', \ 'mac' : 'make -f make_mac.mak', \ 'unix' : 'make -f make_unix.mak', \ }, \ }, "{{{ let g:neobundle#install_process_timeout = 3000 "}}} " Syntax NeoBundle 'itchyny/landscape.vim' "}}} " Tabs & indenting {{{ set tabstop=4 set shiftwidth=4 set expandtab set softtabstop=4 au FileType python,ruby setl sw=2 sts=2 et au FileType javascript,css,less,sass,scss setl sw=2 sts=2 et au FileType php,phtml,html setl sw=4 sts=4 et filetype plugin indent on filetype plugin on " }}} " Colourscheme {{{ syntax on syntax sync fromstart colorscheme landscape hi LineNr ctermbg=016 hi MatchParen term=reverse ctermfg=027 " }}} " NeoBundle {{{ " Visual NeoBundle 'vim-scripts/jumphl.vim', "{{{ autocmd VimEnter * DoJumpHl " Highlight line after jump "}}} NeoBundle 'ivyl/vim-bling' NeoBundle 'kana/vim-narrow' NeoBundle 'qstrahl/vim-matchmaker', "{{{ let g:matchmaker_enable_startup = 0 nnoremap m :MatchmakerToggle "}}} " Indenting NeoBundle '2072/PHP-Indenting-for-VIm' NeoBundle 'pangloss/vim-javascript' NeoBundle 'editorconfig/editorconfig-vim' " Syntax NeoBundle 'groenewege/vim-less', {'autoload':{'filetypes':['less']}}, "{{{ au BufNewFile,BufRead *.less setf less "}}} NeoBundle 'ntpeters/vim-better-whitespace', " {{{ autocmd FileType c,cpp,css,less,sass,scss,java,php,ruby,puppet,python,javascript,vim,sh,nginx,ant,xml autocmd BufWritePre StripWhitespace "}}} NeoBundle 'hail2u/vim-css3-syntax' NeoBundle 'cakebaker/scss-syntax.vim', {'autoload':{'filetypes':['scss','sass']}} NeoBundle 'ap/vim-css-color', {'autoload':{'filetypes':['css','scss','sass','less','styl']}}, "{{{ let g:cssColorVimDoNotMessMyUpdatetime = 1 "}}} NeoBundle 'Glench/Vim-Jinja2-Syntax', "{{{ autocmd BufRead,BufNewFile *.nunjucks setlocal filetype=jinja "}}} NeoBundle 'othree/html5.vim', {'autoload':{'filetypes':['html', 'jinja2', 'phtml']}} NeoBundle 'dbakker/vim-md-noerror' NeoBundle 'rodjek/vim-puppet', "{{{ au BufNewFile,BufRead *.pp setf puppet "}}} NeoBundle 'evanmiller/nginx-vim-syntax' NeoBundle 'maksimr/vim-jsbeautify', {'autoload':{'filetypes':['javascript']}} "{{{ let g:config_Beautifier = { \'js' : { \ 'indent_char': ' ', \ 'indent_size': 2 \} \} nnoremap fjs :call JsBeautify() "}}} NeoBundleLazy 'jelera/vim-javascript-syntax', {'autoload':{'filetypes':['javascript']}} " Images NeoBundle 'tpope/vim-afterimage' " Completion NeoBundle 'vim-scripts/dbext.vim' NeoBundle 'marijnh/tern_for_vim', { \ 'build': { \ 'others': 'npm install' \}} NeoBundle 'Shougo/neocomplete.vim', "{{{ " brew install vim --with-python --with-ruby --with-perl --with-lua --with-tcl " brew install macvim --with-cscope --with-lua --override-system-vim set completeopt-=preview let g:acp_enableAtStartup = 0 let g:neocomplete#enable_at_startup = 0 let g:neocomplete#enable_smart_case = 1 let g:neocomplete#sources#syntax#min_keyword_length = 3 let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' let g:neocomplete#data_directory='~/.vim/.cache/neocomplete' " Define dictionary. let g:neocomplete#sources#dictionary#dictionaries = { \ 'default' : '', \ 'vimshell' : $HOME.'/.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } if !exists('g:neocomplete#keyword_patterns') let g:neocomplete#keyword_patterns = {} endif let g:neocomplete#keyword_patterns['default'] = '\h\w*' " Plugin key-mappings. inoremap neocomplete#undo_completion() inoremap neocomplete#complete_common_string() inoremap pumvisible() ? "\" : "\" inoremap neocomplete#smart_close_popup()."\" inoremap neocomplete#smart_close_popup()."\" inoremap neocomplete#close_popup() inoremap neocomplete#cancel_popup() inoremap neocomplete#start_manual_complete('omni') autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=tern#Complete autocmd FileType coffee setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags " }}} " Usability NeoBundle 'tpope/vim-commentary' NeoBundle 'AndrewRadev/splitjoin.vim', "{{{ nmap gS :SplitjoinSplit nmap gJ :SplitjoinJoin " }}} NeoBundle 'inkarkat/closetag.vim' " Documentation NeoBundle 'heavenshell/vim-jsdoc', "{{{ let g:jsdoc_allow_input_prompt = 1 let g:jsdoc_input_description = 1 let g:jsdoc_additional_descriptions = 1 let g:jsdoc_return = 1 let g:jsdoc_return_type = 1 let g:jsdoc_return_description = 1 let g:jsdoc_default_mapping = 0 " default: 1 Set value to 0 to turn off default mapping of :JsDoc nnoremap j :JsDoc "}}} " Motion NeoBundle 'Lokaltog/vim-easymotion' NeoBundle 'dbakker/vim-paragraph-motion' NeoBundle 'matze/vim-move', "{{{ " Move current line/selections up " Move current line/selections down let g:move_key_modifier = 'C' "}}} " Features NeoBundle 'mhinz/vim-startify', "{{{ let g:startify_show_sessions = 1 let g:startify_list_order = ['sessions', 'bookmarks', 'dir', 'files'] let g:startify_session_dir = expand('~/.vim/.cache/unite/session') let g:startify_change_to_dir = 1 autocmd FileType startify setlocal nocursorline autocmd VimEnter * \ if !argc() | \ Startify | \ NERDTree | \ execute "normal \w" | \ endif hi StartifyBracket ctermfg=100 hi StartifyNumber ctermfg=215 hi StartifyPath ctermfg=245 hi StartifySlash ctermfg=240 " }}} " Status bar NeoBundle 'bling/vim-airline', "{{{ set laststatus=2 let g:airline_powerline_fonts = 1 let g:airline_theme = 'airlineish' " }}} NeoBundle 'paranoida/vim-airlineish' " Syntax NeoBundle 'luochen1990/rainbow', "{{{ let g:rainbow_active = 0 nnoremap r :RainbowToggle "}}} NeoBundle 'scrooloose/syntastic', "{{{ " Show / hide location list noremap lc :lcl noremap lo :lw noremap :SyntasticCheck let g:syntastic_mode_map = { 'mode': 'active', \ 'active_filetypes': ['javascript', 'php'], \ 'passive_filetypes': ['css', 'html', 'xhtml', 'scss', 'sass'] } let g:syntastic_check_on_open = 0 let g:syntastic_enable_signs = 1 let g:syntastic_auto_jump = 1 let g:syntastic_auto_loc_list = 0 let g:syntastic_always_populate_loc_list = 1 let g:syntastic_enable_highlighting = 1 let g:syntastic_echo_current_error = 1 let g:syntastic_javascript_checkers=['jshint'] let g:syntastic_php_checkers=['php'] let g:syntastic_css_checkers=['csslint'] "}}} NeoBundle 'Shougo/unite-outline', "{{{ nnoremap o :Unite outline "}}} NeoBundle 'Shougo/unite-session' NeoBundle 'kien/ctrlp.vim', "{{{ let g:ctrlp_extensions = ['funky'] let g:ctrlp_match_window_bottom = 0 let g:ctrlp_match_window_reversed = 0 " let g:ctrlp_dont_split = 'netrw' nnoremap p :CtrlP nnoremap b :CtrlPBuffer "}}} NeoBundle 'tacahiroy/ctrlp-funky', "{{{ nnoremap o :CtrlPFunky "}}} NeoBundle 'vim-scripts/YankRing.vim', "{{{ nnoremap y :YRShow "}}} NeoBundle 'luochen1990/select-and-search', "{{{ let g:select_and_search_active = 1 "}}} NeoBundle 'Shougo/unite.vim', "{{{ let g:unite_data_directory = expand('~/.vim/.cache/unite') let g:unite_enable_start_insert=0 let g:unite_source_rec_max_cache_files=5000 let g:unite_prompt='» ' " CTRL-P " nnoremap p :Unite -start-insert file_rec/async " call unite#filters#matcher_default#use(['matcher_fuzzy']) " call unite#set_profile('files', 'smartcase', 1) " Searching - brew install the_silver_searcher let g:unite_source_grep_command='ag' let g:unite_source_grep_default_opts='--nogroup --nocolor --column --ignore .sass-cache' nnoremap / :Unite -buffer-name=search grep:. " Session let g:unite_source_session_enable_auto_save = 1 nnoremap :UniteSessionSave noremap s :Unite -quick-match -buffer-name=sessions session " Custom mappings for the unite buffer autocmd FileType unite call s:unite_settings() function! s:unite_settings() " Enable navigation with control-j and control-k in insert mode imap (unite_select_next_line) imap (unite_select_previous_line) " Enable opening items in splits or tab imap unite#do_action('split') imap unite#do_action('vsplit') imap unite#do_action('tabopen') nmap (unite_exit) endfunction " }}} NeoBundle 'sjl/gundo.vim', "{{{ nnoremap :GundoToggle let g:gundo_right = 0 let g:gundo_preview_bottom = 1 let g:gundo_close_on_revert = 1 " }}} NeoBundle 'terryma/vim-expand-region' NeoBundle 'kris89/vim-multiple-cursors' NeoBundle 'hlissner/vim-multiedit' " Utility NeoBundle 't9md/vim-choosewin', "{{{ let g:choosewin_overlay_enable = 1 nmap :ChooseWin " workaround for overlay font broken on mutibyte buffer. let g:choosewin_overlay_clear_multibyte = 1 " tmux like overlay color let g:choosewin_color_overlay = { \ 'gui': ['DodgerBlue3', 'DodgerBlue3' ], \ 'cterm': [ 25, 25 ] \ } let g:choosewin_color_overlay_current = { \ 'gui': ['firebrick1', 'firebrick1' ], \ 'cterm': [ 124, 124 ] \ } let g:choosewin_blink_on_land = 0 " dont' blink at land let g:choosewin_statusline_replace = 0 " don't replace statusline let g:choosewin_tabline_replace = 0 " don't replace tabline "}}} NeoBundle 'justinmk/vim-gtfo' NeoBundle 'scrooloose/nerdtree', "{{{ nmap f :NERDTreeToggle nmap n :NERDTreeFind autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif let NERDTreeShowLineNumbers=1 "}}} NeoBundle 'tpope/vim-unimpaired' NeoBundle 'AndrewRadev/inline_edit.vim' NeoBundle 'tpope/vim-surround' NeoBundle 'tpope/vim-eunuch' NeoBundle 'tpope/vim-repeat' NeoBundle 'vim-scripts/bufkill.vim', "{{{ nnoremap d :BW "}}} NeoBundle 'Raimondi/delimitMate', "{{{ let delimitMate_expand_cr = 0 let delimitMate_jump_expansion = 0 "}}} NeoBundle 'tsaleh/vim-matchit' " VCS NeoBundle 'tommcdo/vim-fugitive-blame-ext' NeoBundle 'tpope/vim-fugitive', "{{{ noremap 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 "}}} NeoBundleCheck " }}} " General settings {{{ set number set cindent set re=1 " a - terse messages (like [+] instead of [Modified]) " t - truncate file names " I - no intro message when starting vim fileless " T - truncate long messages to avoid having to hit a key set shortmess=atIT set nowrap " Do not wrap lines by default set autoread " Reload files changed outside vim " set colorcolumn=80 set history=1000 " remember more commands and search history set undolevels=1000 " remember more undo levels "set lazyredraw set ttyfast " u got a fast terminal " No need to show mode due to Powerline set noshowmode " Explicitly set encoding to utf-8 set encoding=utf-8 " Prevents MatchParen from loading, which can cause slowdown " let g:loaded_matchparen=1 " This makes vim act like all other editors, buffers can :u " exist in the background without being in a window. " http://items.sjbach.com/319/configuring-vim-right set hidden " fix delete fail on os x http://vim.wikia.com/wiki/backspace_and_delete_problems set backspace=indent,eol,start " Do not highlight current line set nocursorline set nocursorcolumn set fcs=vert:│ " Solid line for vsplit separator " Select all nmap a ggVG " }}} " Sudo {{{ " w!!: Writes using sudo cnoremap w!! w !sudo tee % >/dev/null " }}} " Spelling toggle {{{ " http://yavin4.anshul.info/2006/05/18/spell-check-in-vim-7/ set spelllang=en_nz " Toggle spelling & line highlighting with F7 map :set nospell!:set nospell? :set cursorline! " }}} " Disable arrow keys {{{ map map map map imap imap imap imap " }}} " Pasting {{{ nnoremap :set invpaste paste? set pastetoggle= " toggle paste mode " }}} " Turn Off Swap Files {{{ set noswapfile set nobackup set nowb " }}} " Position saving {{{ " http://amix.dk/vim/vimrc.html " Return to last edit position when opening files (You want this!) autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " }}} " Persistent Undo {{{ " Keep undo history across sessions, by storing in file. silent !mkdir ~/.vim/backups > /dev/null 2>&1 set undodir=~/.vim/backups set undofile " }}} " Scrolling {{{ set scrolloff=8 " Start scrolling when we're 8 lines away from margins set sidescrolloff=15 set sidescroll=1 " }}} " Search & Replace {{{ set hlsearch set incsearch set smartcase set ignorecase set showmatch " Clear search highlight http://statico.github.io/vim.html nmap q :nohlsearch " Replace all instances of word under cursor nnoremap r :%s/\<\>//g " }}} " Show special characters {{{ " http://vimcasts.org/episodes/show-invisibles/ " Shortcut to rapidly toggle `set list` set list nmap l :set list! " Use the same symbols as TextMate for tabstops and EOLs set listchars=tab:┆\ ,trail:•,extends:❯,precedes:❮ set shiftround set linebreak set showbreak=↪ " }}} " Open preview window at bottom {{{ set splitbelow set splitright " }}} " Buffer switching {{{ map d :bd " delete buffer " nmap :bnext " nmap :bnext "}}} " PHP {{{ au BufNewFile,BufRead *.phtml setf phtml " }}} " CSS {{{ autocmd BufRead,BufNewFile *.css,*.scss,*.less setlocal foldmethod=marker foldmarker={,} " }}}