Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set nocompatible " Default to Vim instead of Vi
- filetype off " required!
- set rtp+=~/.vim/bundle/vundle/
- call vundle#rc()
- " let Vundle manage Vundle. Required!
- Bundle 'gmarik/vundle'
- " Navigation.
- Bundle 'ZoomWin'
- Bundle 'Lokaltog/vim-easymotion'
- Bundle 'kien/ctrlp.vim'
- " UI enhancements.
- Bundle 'mutewinter/vim-indent-guides'
- Bundle 'Lokaltog/vim-powerline'
- Bundle 'tomtom/quickfixsigns_vim'
- Bundle 'myusuf3/numbers.vim'
- Bundle 'majutsushi/tagbar'
- Bundle 'altercation/vim-colors-solarized'
- Bundle 'Mustang2'
- " Commands
- Bundle 'scrooloose/nerdcommenter'
- Bundle 'tpope/vim-surround'
- Bundle 'tpope/vim-fugitive'
- Bundle 'tpope/vim-repeat'
- Bundle 'tpope/vim-unimpaired'
- Bundle 'godlygeek/tabular'
- Bundle 'mileszs/ack.vim'
- Bundle 'milkypostman/vim-togglelist'
- Bundle 'keepcase.vim'
- Bundle 'scratch.vim'
- Bundle 'tpope/vim-eunuch'
- Bundle 'HelpClose'
- Bundle 'mattn/gist-vim'
- Bundle 'Shougo/neocomplcache'
- Bundle 'sjl/gundo.vim'
- Bundle 'YankRing.vim'
- " Helpers
- Bundle 'IndexedSearch'
- Bundle 'Raimondi/delimitMate'
- Bundle 'scrooloose/syntastic'
- Bundle 'ervandew/supertab'
- " Libraries
- Bundle 'L9'
- Bundle 'tpope/vim-repeat'
- Bundle 'mattn/webapi-vim'
- " HTML
- Bundle 'gregsexton/MatchTag'
- Bundle 'othree/html5.vim'
- Bundle 'indenthtml.vim'
- " Markdown
- Bundle 'tpope/vim-markdown'
- " ----------------------------------------
- " Bindings
- " ----------------------------------------
- " Set leader to ,
- " Note: This line MUST come before any <leader> mappings
- let mapleader=","
- " Fixes common typos
- command! W w
- command! Q q
- map <F1> <Esc>
- imap <F1> <Esc>
- vnoremap <F1> <Esc>:w<CR>
- nnoremap <F1> <Esc>:w<CR>
- inoremap <F1> <Esc>:w<CR>
- inoremap <F2> <Esc>:w<CR>
- nnoremap <F2> <Esc>:w<CR>
- vnoremap <F2> <Esc>:w<CR>
- nnoremap <Left> :bp<CR>
- nnoremap <Right> :bn<CR>
- " Crazy flying pinky
- cnoremap w' w<CR>
- " This mapping along with mapping ; to : allows for quick save with ;w;
- cnoremap w; w<CR>
- " Disable the ever-annoying Ex mode shortcut key. Type visual my ass. Make it
- " repeat the last macro instead. *hat tip* http://vimbits.com/bits/263
- nmap Q @@
- " Removes doc lookup binding because it's easy to fat finger
- nmap K k
- vmap K k
- " Make line completion easier
- imap <C-l> <C-x><C-l>
- " Easier Scrolling (think j/k with left hand)
- " All variations are mapped for now until I get used to one
- " C/M/D + d (page up)
- " C/M/D + f (page down)
- nmap <C-d> <C-b>
- if has("gui_macvim")
- nmap <D-f> <C-f>
- nmap <D-d> <C-b>
- else
- nmap <M-f> <C-f>
- nmap <M-d> <C-b>
- endif
- " Overrides neocomplcache with regular keyword completion
- inoremap <expr><C-k> "\<C-x><C-n>"
- " Use ; for : in normal and visual mode, less keystrokes
- nnoremap ; :
- vnoremap ; :
- " double percentage sign in command mode is expanded
- " to directory of current file - http://vimcasts.org/e/14
- cnoremap %% <C-R>=expand('%:h').'/'<cr>
- " Yank entire buffer with gy
- nmap gy :%y+<cr>
- " Make Y behave like other capital commands.
- " Hat-tip http://vimbits.com/bits/11
- nnoremap Y y$
- " Just to beginning and end of lines easier. From http://vimbits.com/bits/16
- noremap H ^
- noremap L $
- " Clear search
- map <silent><Leader>/ :nohls<CR>
- " Highlight search word under cursor without jumping to next
- nnoremap <leader>h *<C-O>
- " ---------------
- " Leader Commands
- " ---------------
- " Toggle spelling mode with ,s
- nmap <silent> <leader>s :set spell!<CR>
- " Edit vimrc with ,v
- nmap <silent> <leader>v :e ~/.vim/vimrc<CR>
- " Quickly switch to last buffer
- nnoremap <leader>, :e#<CR>
- " Window Movement
- " Here's a visual guide for moving between window splits.
- " 4 Window Splits
- " --------
- " g1 | g2
- " ---|----
- " g3 | g4
- " -------
- "
- " 6 Window Splits
- " -------------
- " g1 | gt | g2
- " ---|----|----
- " g3 | gb | g4
- " -------------
- nmap <silent> gh :wincmd h<CR>
- nmap <silent> gj :wincmd j<CR>
- nmap <silent> gk :wincmd k<CR>
- nmap <silent> gl :wincmd l<CR>
- " Upper left window
- nmap <silent> g1 :wincmd t<CR>
- " Upper right window
- nmap <silent> g2 :wincmd b<Bar>:wincmd k<CR>
- " Lower left window
- nmap <silent> g3 :wincmd t<Bar>:wincmd j<CR>
- " Lower right window
- nmap <silent> g4 :wincmd b<CR>
- " Top Middle
- nmap <silent> gt g2<Bar>:wincmd h<CR>
- " Bottom Middle
- nmap <silent> gb g3<Bar>:wincmd l<CR>
- " Previous Window
- nmap <silent> gp :wincmd p<CR>
- " Equal Size Windows
- nmap <silent> g= :wincmd =<CR>
- " Swap Windows
- nmap <silent> gx :wincmd x<CR>
- " Window Splitting
- nmap <silent> <leader>hs :split<CR>
- nmap <silent> <leader>vs :vsplit<CR>
- " Close the current window
- nmap <silent> <leader>sc :close<CR>
- " -----------------------
- " Escape / Write Bindings
- " -----------------------
- " Let's make escape better, together.
- inoremap jj <Esc>
- " Strip trailing spaces
- " nnoremap <leader>S :%s/\s\+$//<cr>:let @/=''<CR>
- " -------------------------------------
- " The following commands are from Janus
- " http://git.io/_GhulA
- " -------------------------------------
- " Underline the current line with '='
- nmap <silent> <leader>ul :t.\|s/./-/g\|:nohls<cr>
- " Format the entire file
- nmap <leader>fef ggVG=
- " Wrap the current line
- nmap <leader>fw Vgq
- "-----------------------------------------------------------------------------
- " Core Vim configuration - plugins independent
- "-----------------------------------------------------------------------------
- " Behaviors ------------------------------------------------------------------
- syntax enable
- "set autoread " Automatically reload changes if detected
- set wildmenu " Turn on WiLd menu
- set hidden " Change buffer - without saving
- set history=768 " Number of things to remember in history.
- set cf " Enable error files & error jumping.
- set clipboard=unnamed " Yanks go on clipboard instead.
- "set autowrite " Writes on make/shell commands
- set timeoutlen=450 " Time to wait for a command (after leader for example).
- set nostartofline " Don't go to the start of the line after some commands
- set scrolloff=7 " Keep three lines below the last line when scrolling
- set encoding=utf-8 " utf-8 as default encoding
- set fileformats=unix,dos,mac " Prefer unix file format
- " Colors ---------------------------------------------------------------------
- set t_Co=256 " Convince vim it can use 256 colors
- " Preferably solarized configurations should be in plugins_config.vim, but
- " they need to be set before setting the solarized colorscheme
- let g:solarized_termtrans=1
- let g:solarized_termcolors=256
- let g:solarized_contrast="high"
- let g:solarized_visibility="high"
- set background=dark
- colorscheme solarized
- call togglebg#map("<F5>")
- " Backups, swap files, and other annoying stuff - GTFO!
- set noswapfile
- set nobackup
- set nowritebackup
- set novisualbell
- set noerrorbells
- " User Interface
- set ruler " Ruler on
- set number " Line numbers on
- set nowrap " Line wrapping off
- set laststatus=2 " Always show the statusline
- set cmdheight=2 " Make the command area two lines high
- set encoding=utf-8
- set noshowmode " Don't show the mode since Powerline
- " shows it
- set title " Set the title of the window in the
- " terminal to the file
- if exists('+colorcolumn') " Color the 80th column differently
- set colorcolumn=80 " as a wrapping guide.
- endif
- if exists('+ballooneval') " Disable tooltips for hovering
- set noballooneval " keywords in Vim.
- set balloondelay=100000 " Set tooltip delay, just in case.
- endif
- " Tabs, spaces, linebreaks, and other invisible chars ------------------------
- set list
- set list listchars=tab:→\ ,trail:·,extends:❯,precedes:❮ ",eol:¶
- set showbreak=↪
- " Text Format ----------------------------------------------------------------
- set tabstop=4
- " set backspace=4 " Delete everything with backspace
- set shiftwidth=4 " Tabs under smart indent
- set cindent
- set autoindent
- set smarttab
- set expandtab
- " Searching ------------------------------------------------------------------
- set ignorecase " Case insensitive search
- set smartcase " Non-case sensitive search
- set incsearch
- set hlsearch
- set wildignore+=*.o,*.obj,*.exe,*.so,*.dll,*.pyc,.svn,.hg,.bzr,.git,
- \.sass-cache,*.class,*.scssc,*.cssc,sprockets%*,*.lessc,*.gif,*.jpg,*.png
- " Visual ---------------------------------------------------------------------
- set showmatch " Show matching brackets.
- set matchtime=2 " How many tenths of a second to blink
- " Sounds ---------------------------------------------------------------------
- set noerrorbells
- set novisualbell
- set t_vb=
- " Mouse ----------------------------------------------------------------------
- set mousehide " Hide mouse after chars typed
- set mouse=a " Mouse in all modes
- " Better complete options to speed it up
- set complete=.,w,b,u,U
- " ----------------------------------------------------------------------------
- " Plugin specific configuration
- " ----------------------------------------------------------------------------
- " Tagbar -------------------------------------------------------------------
- inoremap <F8> :TagbarToggle<CR>
- vnoremap <F8> :TagbarToggle<CR>
- nnoremap <F8> :TagbarToggle<CR>
- " Numbers ------------------------------------------------------------------
- nnoremap <F10> :NumbersToggle<CR>
- vnoremap <F10> :NumbersToggle<CR>
- " Neocachecompl --------------------------------------------------------------
- let g:neocomplcache_enable_at_startup=1
- let g:neocomplcache_enable_cursor_hold_i=1
- let g:neocomplcache_cursor_hold_i_time=200
- let g:neocomplcache_auto_completion_start_length=1
- " Tab / Shift-Tab to cycle completions
- inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
- inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-TAB>"
- " Required to make neocomplcache_cursor_hold_i_time work
- " See https://github.com/Shougo/neocomplcache/issues/140
- let s:update_time_save = &updatetime
- autocmd InsertEnter * call s:on_insert_enter()
- function! s:on_insert_enter()
- if &updatetime > g:neocomplcache_cursor_hold_i_time
- let s:update_time_save = &updatetime
- let &updatetime = g:neocomplcache_cursor_hold_i_time
- endif
- endfunction
- autocmd InsertLeave * call s:on_insert_leave()
- function! s:on_insert_leave()
- if &updatetime < s:update_time_save
- let &updatetime = s:update_time_save
- endif
- endfunction
- " Syntastic ------------------------------------------------------------------
- let g:syntastic_enable_signs=1
- let g:syntastic_auto_loc_list=1
- " Platform-specific config files
- "if has('win32') || has('win64')
- " let g:syntastic_jsl_conf=$HOME.'/.vim/config/windows/syntastic/jsl.conf'
- " let g:syntastic_disabled_filetypes=['sh'] " Disable .sh on Windows
- "endif
- " Indent Guides --------------------------------------------------------------
- let g:indent_guides_enable_on_vim_startup=1
- " Session --------------------------------------------------------------------
- let g:session_autosave=0
- let g:session_autoload=0
- nnoremap <leader>os :OpenSession<CR>
- " SpeedDating ----------------------------------------------------------------
- "let g:speeddating_no_mappings=1 " Remove default mappings (C-a etc.)
- "nmap <silent><leader>dm <Plug>SpeedDatingDown
- "nmap <silent><leader>dp <Plug>SpeedDatingUp
- "nmap <silent><leader>dn <Plug>SpeedDatingNowUTC
- " Tabular --------------------------------------------------------------------
- nmap <Leader>t= :Tabularize /=<CR>
- vmap <Leader>t= :Tabularize /=<CR>
- nmap <Leader>t: :Tabularize /:\zs<CR>
- vmap <Leader>t: :Tabularize /:\zs<CR>
- nmap <Leader>t, :Tabularize /,\zs<CR>
- vmap <Leader>t, :Tabularize /,\zs<CR>
- nmap <Leader>t> :Tabularize /=>\zs<CR>
- vmap <Leader>t> :Tabularize /=>\zs<CR>
- nmap <Leader>t- :Tabularize /-<CR>
- vmap <Leader>t- :Tabularize /-<CR>
- nmap <Leader>t" :Tabularize /"<CR>
- vmap <Leader>t" :Tabularize /"<CR>
- " Fugitive -------------------------------------------------------------------
- nmap <Leader>gc :Gcommit -v<CR>
- nmap <Leader>gw :Gwrite<CR>
- nmap <Leader>gs :Gstatus<CR>
- nmap <Leader>gp :Git push<CR>
- " Mnemonic, gu = Git Update
- nmap <Leader>gu :Git pull<CR>
- nmap <Leader>gd :Gdiff<CR>
- " Exit a diff by closing the diff window
- nmap <Leader>gx :wincmd h<CR>:q<CR>
- " Zoomwin --------------------------------------------------------------------
- " Zoom Window to Full Size
- nmap <silent> <leader>wo :ZoomWin<CR>
- " ctrlp.vim ------------------------------------------------------------------
- " Ensure Ctrl-P isn't bound by default
- let g:ctrlp_map = ''
- " Ensure max height isn't too large. (for performance)
- let g:ctrlp_max_height = 10
- " Leader Commands
- nnoremap <leader>o :CtrlPRoot<CR>
- nnoremap <leader>b :CtrlPBuffer<CR>
- nnoremap <leader>u :CtrlPCurFile<CR>
- nnoremap <leader>m :CtrlPMRUFiles<CR>
- " Powerline ------------------------------------------------------------------
- " Keep ^B from showing on Windows in Powerline
- if has('win32') || has('win64')
- let g:Powerline_symbols = 'compatible'
- elseif has('gui_macvim')
- let g:Powerline_symbols = 'fancy'
- endif
- call Pl#Theme#InsertSegment('ws_marker', 'after', 'lineinfo')
- " Abbreviate All of the Mode Names
- "let g:Powerline_mode_n = 'N'
- "let g:Powerline_mode_i = 'I'
- "let g:Powerline_mode_R = 'R'
- "let g:Powerline_mode_v = 'V'
- "let g:Powerline_mode_V = 'VL'
- "let g:Powerline_mode_cv = 'VB'
- "let g:Powerline_mode_s = 'S'
- "let g:Powerline_mode_S = 'SL'
- "let g:Powerline_mode_cs = 'SB'
- " colorscheme tweaks ---------------------------------------------------------
- " Make cssAttrs (center, block, etc.) the same color as units
- hi! link cssAttr Constant
- " Ack.vim --------------------------------------------------------------------
- nmap <silent> <leader>as :AckFromSearch<CR>
- " Highlight word at cursor and then Ack it.
- nnoremap <leader>H *<C-O>:AckFromSearch!<CR>
- " surround.vim ---------------------------------------------------------------
- " Use # to get a variable interpolation (inside of a string)}
- " ysiw# Wrap the token under the cursor in #{}
- " Thanks to http://git.io/_XqKzQ
- let g:surround_35 = "#{\r}"
- " Markdown-Preview -----------------------------------------------------------
- "nmap <Leader>md :MarkdownPreview<CR>
- "vmap <Leader>md :MarkdownPreview<CR>
- " indenthtml -----------------------------------------------------------------
- " Setup indenthtml to propertly indent html. Without this, formatting doesn't
- " work on html.
- let g:html_indent_inctags = "html,body,head,tbody"
- let g:html_indent_script1 = "inc"
- let g:html_indent_style1 = "inc"
- " vim-markdown
- let g:vim_markdown_folding_disabled=1
- " Unconditional Paste --------------------------------------------------------
- "let g:UnconditionalPaste_NoDefaultMappings=1
- "nmap gcP <Plug>UnconditionalPasteCharBefore
- "nmap gcp <Plug>UnconditionalPasteCharAfter
- " Vundle --------------------------------------------------------------------
- nmap <Leader>bi :BundleInstall<CR>
- nmap <Leader>bu :BundleInstall!<CR> " Because this also updates
- nmap <Leader>bc :BundleClean<CR>
- " ----------------------------------------------------------------------------
- " Functions
- " ----------------------------------------------------------------------------
- " Strip trailing spaces ------------------------------------------------------
- " From http://vimbits.com/bits/377
- " Preserves/Saves the state, executes a command, and returns to the saved state
- 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
- "strip all trailing white space
- command! StripTrailingWhiteSpace :call Preserve("%s/\\s\\+$//e")<CR>
- nmap <silent> <leader>S :StripTrailingWhiteSpace<CR>
- " Paste using Paste Mode -----------------------------------------------------
- "
- " Keeps indentation in source.
- function! PasteWithPasteMode()
- if &paste
- normal p
- else
- " Enable paste mode and paste the text, then disable paste mode.
- set paste
- normal p
- set nopaste
- endif
- endfunction
- command! PasteWithPasteMode call PasteWithPasteMode()
- nmap <silent> <leader>p :PasteWithPasteMode<CR>
Advertisement
Add Comment
Please, Sign In to add comment