├── .vimrc_custom ├── .vim ├── backup │ └── .empty ├── tmp │ └── .empty └── undo │ └── .empty ├── .gvimrc ├── .stow-local-ignore ├── Inconsolata.otf ├── .gitignore ├── .gitmodules ├── README.md └── .vimrc /.vimrc_custom: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vim/backup/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vim/tmp/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vim/undo/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gvimrc: -------------------------------------------------------------------------------- 1 | set visualbell t_vb= " no sound or visual beep in gVim 2 | set guioptions-=T 3 | -------------------------------------------------------------------------------- /.stow-local-ignore: -------------------------------------------------------------------------------- 1 | README.* 2 | \.git 3 | \.gitmodules 4 | \.gitignore 5 | Inconsolata.otf 6 | -------------------------------------------------------------------------------- /Inconsolata.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntuitiveWebSolutions/VimConf/HEAD/Inconsolata.otf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vim/backup/*~ 2 | .vim/tmp/* 3 | .vim/undo/%* 4 | .vim/.netrwhist 5 | .vim/bundle/* 6 | .vimrc_custom 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".vim/bundle/neobundle.vim"] 2 | path = .vim/bundle/neobundle.vim 3 | url = git@github.com:Shougo/neobundle.vim.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | VimConf 2 | ======= 3 | 4 | A vimrc file and different bundles. This vim setup requires at least Vim 7.3+ compiled with python & multibyte support. 5 | 6 | The font used when running gVim is [Inconsolata](http://www.levien.com/type/myfonts/inconsolata.html "Inconsolata"); the OpenType file is included in this repo. 7 | 8 | The config uses [neobundle](https://github.com/Shougo/neobundle.vim "neobundle") for installing and updating bundled modules. 9 | 10 | For Tagbar to work well with JavaScript (and probably other languages), we **highly** recommend installing the latest version of [Exuberant Ctags](http://ctags.sourceforge.net/ "Exuberant Ctags"). 11 | 12 | For Syntastic to check syntax of different file types, you optionally need to have a PHP runtime, JSHint, and/or PyFlakes installed. 13 | 14 | Requirements 15 | ------------ 16 | 17 | * Vim 7.3+ compiled with python & multibyte support. 18 | * An up to date installation of git. 19 | 20 | Setup 21 | ----- 22 | 23 | Check out VimConf to your home folder like so: 24 | 25 | ```bash 26 | $> cd ~ 27 | $> git clone --recursive git://github.com/IntuitiveWebSolutions/VimConf.git 28 | ``` 29 | 30 | Then create symlinks to the files inside the repo: 31 | 32 | ON OSX 33 | ```bash 34 | $> ln -s ~/VimConf/.vim ~/.vim 35 | $> ln -s ~/VimConf/.vimrc ~/.vimrc 36 | $> ln -s ~/VimConf/.vimrc_custom ~/.vimrc_custom 37 | $> ln -s ~/VimConf/.gvimrc ~/.gvimrc 38 | ``` 39 | 40 | ON Ubuntu 41 | ```bash 42 | $> ln -s ~/VimConf/.vim ~ 43 | $> ln -s ~/VimConf/.vimrc ~ 44 | $> ln -s ~/VimConf/.vimrc_custom ~ 45 | $> ln -s ~/VimConf/.gvimrc ~ 46 | ``` 47 | 48 | That way, any time you want to update to the latest versions of the VimConf, you can just `git pull` inside the VimConf folder. 49 | 50 | ```bash 51 | $> cd ~/VimConf/ 52 | $> git pull 53 | ``` 54 | 55 | NeoBundle 56 | --------- 57 | 58 | [NeoBundle](https://github.com/Shougo/neobundle.vim "neobundle") is the tool used to pull in all the plugins below. Make sure that the bundle is checked out (it is a submodule), and check out 'master'. 59 | 60 | ```bash 61 | $> cd VimConf 62 | $> git pull 63 | $> git submodule init 64 | $> git submodule update 65 | $> cd ~/VimConf/.vim/bundle/neobundle.vim 66 | $> git checkout master 67 | ``` 68 | 69 | Now open vim - when you do this NeoBundle will ask to install all the plugins listed in vimrc. You can update these at any time from inside vim by running: 70 | 71 | ```bash 72 | :NeoBundleUpdate 73 | ``` 74 | 75 | **Bundle List** 76 | 77 | * [vim-gitgutter](https://github.com/airblade/vim-gitgutter "vim-gitgutter") 78 | * [vim-airline](https://github.com/bling/vim-airline "vim-airline") 79 | * [jedi-vim](https://github.com/davidhalter/jedi-vim "jedi-vim") 80 | * [js-beautify](https://github.com/einars/js-beautify "js-beautify") 81 | * [vim-json](https://github.com/elzr/vim-json "vim-json") 82 | * [supertab](https://github.com/ervandew/supertab "supertab") 83 | * [vim-go](https://github.com/fatih/vim-go "vim-go") 84 | * [todo.txt-vim](https://github.com/freitass/todo.txt-vim "todo.txt-vim") 85 | * [Vim-Jinja2-Syntax](https://github.com/Glench/Vim-Jinja2-Syntax "Vim-Jinja2-Syntax") 86 | * [vim-less](https://github.com/groenewege/vim-less "vim-less") 87 | * [vim-snippets](https://github.com/honza/vim-snippets "vim-snippets") 88 | * [vim-coffee-script](https://github.com/kchmck/vim-coffee-script "vim-coffee-script") 89 | * [python-mode](https://github.com/klen/python-mode "python-mode") 90 | * [vim-howdoi](https://github.com/laurentgoudet/vim-howdoi "vim-howdoi") 91 | * [tagbar](https://github.com/majutsushi/tagbar "tagbar") 92 | * [vim-jsbeautify](https://github.com/maksimr/vim-jsbeautify "vim-jsbeautify") 93 | * [emmet-vim](https://github.com/mattn/emmet-vim "emmet-vim") 94 | * [vim-startify](https://github.com/mhinz/vim-startify "vim-startify") 95 | * [vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides "vim-indent-guides") 96 | * [vim-javascript](https://github.com/pangloss/vim-javascript "vim-javascript") 97 | * [vim-markdown](https://github.com/plasticboy/vim-markdown "vim-markdown") 98 | * [vim-puppet](https://github.com/rodjek/vim-puppet "vim-puppet") 99 | * [nerdcommenter](https://github.com/scrooloose/nerdcommenter "nerdcommenter") 100 | * [syntastic](https://github.com/scrooloose/syntastic "syntastic") 101 | * [neobundle](https://github.com/Shougo/neobundle.vim "neobundle") 102 | * [unite](https://github.com/Shougo/unite.vim "unite") 103 | * [vimproc](https://github.com/Shougo/vimproc "vimproc") 104 | * [vimshell](https://github.com/Shougo/vimshell.vim "vimshell") 105 | * [ultisnips](https://github.com/SirVer/ultisnips "ultisnips") 106 | * [ag](https://github.com/smeggingsmegger/ag.vim "ag") 107 | * [vim-colorschemes](https://github.com/smeggingsmegger/vim-colorschemes "vim-colorschemes") 108 | * [vim-bundle-mako](https://github.com/sophacles/vim-bundle-mako "vim-bundle-mako") 109 | * [dwm](https://github.com/spolu/dwm.vim "dwm") 110 | * [php](https://github.com/StanAngeloff/php.vim "php") 111 | * [vim-abolish](https://github.com/tpope/vim-abolish "vim-abolish") 112 | * [vim-fugitive](https://github.com/tpope/vim-fugitive "vim-fugitive") 113 | * [vim-repeat](https://github.com/tpope/vim-repeat "vim-repeat") 114 | * [vim-surround](https://github.com/tpope/vim-surround "vim-surround") 115 | * [YouCompleteMe.git](https://github.com/Valloric/YouCompleteMe.git "YouCompleteMe.git") 116 | 117 | Color Schemes 118 | ------------- 119 | 120 | * **blayden** *Default* 121 | * **jellybean** *Can be set in .vimrc_custom* 122 | * **solarized** *Can be set in .vimrc_custom - follow instructions at [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized "vim-colors-solarized")* 123 | 124 | Window Management 125 | ------------------------------- 126 | Windows are always organised as follows: 127 | 128 | ``` 129 | =================================== 130 | | | S1 | 131 | | |=================== 132 | | M | S2 | 133 | | |=================== 134 | | | S3 | 135 | =================================== 136 | ``` 137 | 138 | Use the following commands to create, browse and close windows: 139 | 140 | `C-N` Creates a new window and place it in the master pane [M] & stacks all previous windows in the stacked pane [S] 141 | `C-C` Close the current window if no unsaved changes 142 | `C-J` Jumps to next window (clockwise) 143 | `C-K` Jumps to previous window (anti-clockwise) 144 | `C-Space` Focus the current window, that is, place it in the master pane [M] & stacks all other windows in the stacked pane [S] 145 | 146 | Keybindings and Commands 147 | ------------------------------- 148 | 149 | **NERDCommenter Default Mappings** 150 | 151 | The below mappings are default in NERDCommenter, and the ones most used, so they are included in our README. 152 | 153 | | Keys | Command | 154 | |---------------------------:|:----------------------------------------------------| 155 | | **,c[spacebar]** | Toggles comment state of the selected line(s) | 156 | | **,cl** | Comment current line or text selected in visual mode (forces nesting) | 157 | | **,cu** | Uncomment selected lines(s) | 158 | 159 | **JavaScript Commands** 160 | 161 | | Keys | Command | 162 | |---------------------------:|:----------------------------------------------------| 163 | | **,b** | Insert 'debugger;' breakpoint. | 164 | 165 | 166 | **Custom Mappings** 167 | 168 | | Keys | Command | 169 | |---------------------------:|:----------------------------------------------------| 170 | |**gh** | GitGutter Next Hunk | 171 | |**gH** | GitGutter Previous Hunk | 172 | |**,,** | Toggles comment state of the selected line(s) | 173 | |**,si** | Adds a 'Signature' to the end of the line. Ex. ' -- Ben Hayden 5/14/2012' | 174 | |**,tc** | Close tab | 175 | |**,tn** | Next tab | 176 | |**,tp** | Previous tab | 177 | |**,te** | Edit new tab | 178 | |**,l** | Navigate buffers | 179 | |**,/** | Grep in the current directory | 180 | |**,y** | Show yank buffers to paste from | 181 | |**,nt** | Open Netrw in a vertical split | 182 | |**,tb** | Toggle Tagbar plugin | 183 | |**,e** | Open Syntastic Error Location List | 184 | |**,en** | Go to next error | 185 | |**,ep** | Go to previous error | 186 | |**,ig** | Toggle IndentGuides plugin | 187 | |**,ml** | Compile LESS file to CSS. Requires NPM install of less | 188 | |**,p** | Toggle paste mode (for easy copy & pasting in a terminal) | 189 | |**,ln** | Toggle line numbers (for easy copying out of terminal) | 190 | |**,xp** | Put (Paste) from system clipboard | 191 | |**,xy** | Yank (Copy) to system clipboard | 192 | |**,xx** | Cut to system clipboard | 193 | |**,s** | Write file | 194 | |**,ev** | Edit $MYVIMRC | 195 | |**,sv** | Source $MYVIMRC | 196 | |**,sp** | Turn on Spell checking for EN_US | 197 | |**,nsp** | Turn off Spell checking for EN_US | 198 | |**,q** | Write & quit file | 199 | |**,rf** | Turn Syntax off/on on a file - a "refresh" of the syntax highlighting | 200 | |**,v** | Vertical split window | 201 | |**,h** | Horizontal split window | 202 | |**,cw** | Close window | 203 | |**,w** | Closes all but the current window | 204 | |**,bd** | Delete (close) buffer | 205 | |**,ch** | Clear (turn off) highlighting | 206 | |**,rt** | Re-tab entire file. (Shortcut for gg=G) | 207 | |**,hb** | Send selected visual hunk to hastebin | 208 | |**,0** | Go to the first character of a line | 209 | |**,O** | Insert a newline before the current line without entering insert mode | 210 | |**,o** | Insert a newline after the current line without entering insert mode | 211 | |**,[spacebar] [character]** | Insert a character in place without entering insert mode | 212 | |**,a [character]** | Appends a character in place without entering insert mode | 213 | |**,ws** | Runs TrimWS and retab on the current buffer | 214 | |**,j** | Reformat JSON automatically (Requires python command in system path) | 215 | |**:W** | Write as super user | 216 | |**:Tabs2Spaces** | Convert tab characters to 4 space characters | 217 | |**shift + down arrow** | Jump down 10 lines | 218 | |**shift + up arrow** | Jump up 10 lines | 219 | |**control + h** | Switch to left window | 220 | |**control + j** | Switch to bottom window | 221 | |**control + k** | Switch to top window | 222 | |**control + l** | Switch to right window | 223 | |**control + p** | Run Unite file | 224 | |**visual selection + \** | Visual Selection Search with // | 225 | |**visual selection + #** | Visual Selection Search with ?? | 226 | 227 | Emmet is Awesome 228 | ------------------------------- 229 | 230 | 1. Expand an Abbreviation 231 | 232 | Type the abbreviation as 'div>p#foo$*3>a' and type ','. 233 | ```html 234 |
235 |

236 | 237 |

238 |

239 | 240 |

241 |

242 | 243 |

244 |
245 | ``` 246 | 2. Wrap with an Abbreviation 247 | 248 | Write as below. 249 | ``` 250 | test1 251 | test2 252 | test3 253 | ``` 254 | 255 | Then do visual select(line wise) and type ','. 256 | Once you get to the 'Tag:' prompt, type 'ul>li*'. 257 | 258 | ```html 259 | 264 | ``` 265 | 266 | If you type a tag, such as 'blockquote', then you'll see the following: 267 | 268 | ``` 269 |
270 | test1 271 | test2 272 | test3 273 |
274 | ``` 275 | 276 | 3. Balance a Tag Inward 277 | 278 | type 'd' in insert mode. 279 | 280 | 4. Balance a Tag Outward 281 | 282 | type 'D' in insert mode. 283 | 284 | 5. Go to the Next Edit Point 285 | 286 | type 'n' in insert mode. 287 | 288 | 6. Go to the Previous Edit Point 289 | 290 | type 'N' in insert mode. 291 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | " Notes { 2 | " Ben Hayden, Scott Blevins, Matt Thompson, et al. Public Domain. 3 | " https://github.com/IntuitiveWebSolutions/VimConf 4 | "} 5 | 6 | " Basics { 7 | set nocompatible " explicitly get out of vi-compatible mode 8 | syntax on " syntax highlighting on 9 | if has('vim_starting') 10 | set runtimepath+=~/.vim/bundle/neobundle.vim/ 11 | endif 12 | " Declare all NeoBundles 13 | call neobundle#begin(expand('~/.vim/bundle/')) 14 | NeoBundleFetch 'Shougo/neobundle.vim' 15 | 16 | " Shougo stuff 17 | NeoBundle 'Shougo/unite.vim' 18 | 19 | " Search using ag or ack! 20 | NeoBundle 'smeggingsmegger/ag.vim' 21 | 22 | " A really cool shell in vim! 23 | NeoBundle 'Shougo/vimshell.vim' 24 | 25 | " todo.txt plugin. 26 | NeoBundle 'freitass/todo.txt-vim' 27 | 28 | " Git Integration 29 | NeoBundle 'airblade/vim-gitgutter' 30 | NeoBundle 'tpope/vim-fugitive' 31 | 32 | " Colors 33 | NeoBundle 'smeggingsmegger/vim-colorschemes' 34 | 35 | " Nicer start screen 36 | NeoBundle 'mhinz/vim-startify' 37 | 38 | " all the things! 39 | " NeoBundle 'ervandew/supertab' 40 | 41 | " A pretty statusline, bufferline integration 42 | NeoBundle 'bling/vim-airline' 43 | 44 | " Better Python code completion. 45 | " NeoBundleLazy 'davidhalter/jedi-vim', { 'filetypes' : ['python'] } 46 | " Use Python mode for all the awesome PEP-8 stuff but not for completion. 47 | NeoBundleLazy 'klen/python-mode', { 'filetypes' : ['python'] } 48 | 49 | " Vim window manager. CTRL-N, CTRL-C (Close), CTRL-space (Make active 50 | " window), CTRL-J (Next), CTRL-K (Prev) 51 | NeoBundle 'spolu/dwm.vim' 52 | 53 | " Track the snippets engine. 54 | " CTRL-C to use 55 | " NeoBundle 'SirVer/ultisnips' 56 | 57 | " Snippets are separated from the engine. Add this if you want them: 58 | " NeoBundle 'honza/vim-snippets' 59 | 60 | " Tagbar for browsing source code trees. 61 | NeoBundle 'majutsushi/tagbar' 62 | 63 | " Show indent level with ,ig 64 | NeoBundle 'nathanaelkane/vim-indent-guides' 65 | 66 | " Quick commenting using ,, 67 | NeoBundle 'scrooloose/nerdcommenter' 68 | 69 | " Source code error checking 70 | NeoBundle 'scrooloose/syntastic' 71 | 72 | " Tim Pope has some awesome plugins for working with text. 73 | NeoBundle 'tpope/vim-abolish' 74 | NeoBundle 'tpope/vim-surround' 75 | 76 | " Repeat plugin actions 77 | NeoBundle 'tpope/vim-repeat' 78 | 79 | " NeoComplete 80 | NeoBundle 'Shougo/neocomplete.vim' 81 | NeoBundle 'Shougo/neosnippet.vim' 82 | NeoBundle 'Shougo/neosnippet-snippets' 83 | 84 | " Sparkup for HTML voodoo 85 | " CTRL-y, to convert 86 | NeoBundleLazy 'mattn/emmet-vim', { 'filetypes' : ['javascript', 'html', 'php'] } 87 | 88 | " Syntax, tabs, indenting, etc. for PHP, JS, Puppet, Go, Coffee 89 | NeoBundleLazy 'StanAngeloff/php.vim', { 'filetypes' : ['javascript', 'html', 'php', 'jinja'] } 90 | NeoBundleLazy 'pangloss/vim-javascript', { 'filetypes' : ['javascript', 'html', 'php', 'jinja'] } 91 | NeoBundleLazy 'maksimr/vim-jsbeautify', { 'filetypes' : ['javascript', 'html', 'php', 'jinja', 'css'] } 92 | NeoBundleLazy 'einars/js-beautify', { 'filetypes' : ['javascript', 'html', 'php', 'jinja', 'css'] } 93 | NeoBundleLazy 'rodjek/vim-puppet', { 'filetypes' : ['puppet'] } 94 | NeoBundleLazy 'fatih/vim-go', { 'filetypes' : ['go'] } 95 | NeoBundleLazy 'kchmck/vim-coffee-script', { 'filetypes' : ['coffee', 'javascript', 'html', 'jinja'] } 96 | NeoBundleLazy 'plasticboy/vim-markdown', { 'filetypes' : ['mkd'] } 97 | NeoBundleLazy 'elzr/vim-json', { 'filetypes' : ['json', 'jinja'] } 98 | NeoBundleLazy 'groenewege/vim-less', { 'filetypes' : ['less'] } 99 | NeoBundleLazy 'mitsuhiko/vim-jinja', { 'filetypes' : ['html', 'jinja'] } 100 | NeoBundleLazy 'sophacles/vim-bundle-mako', { 'filetypes' : ['html', 'jinja'] } 101 | 102 | " NOT WORKING WITH HOMEBREW VIM. :( Keeping to try out later. 103 | " YouCompleteMe uses jedi to complete for Python and works for many other 104 | " languages. This replaces python-mode. 105 | " NeoBundle 'Valloric/YouCompleteMe.git' , { 106 | " \ 'build' : { 107 | " \ 'mac' : './install.sh --clang-completer', 108 | " \ 'unix' : './install.sh --clang-completer --system-libclang' 109 | " \ }, 110 | " \ } 111 | 112 | " vimproc needs a special build 113 | NeoBundle 'Shougo/vimproc', { 114 | \ 'build' : { 115 | \ 'windows' : 'make -f make_mingw32.mak', 116 | \ 'cygwin' : 'make -f make_cygwin.mak', 117 | \ 'mac' : 'make -f make_mac.mak', 118 | \ 'unix' : 'make -f make_unix.mak', 119 | \ }, 120 | \ } 121 | 122 | call neobundle#end() 123 | 124 | " the plugin indent needs to be on before neobundle runs... 125 | filetype plugin indent on " load filetype plugins/indent settings 126 | " Update and turn on all NeoBundles 127 | NeoBundleCheck 128 | 129 | colorscheme blayden " set our customized colorscheme 130 | set background=dark 131 | " } 132 | 133 | " General { 134 | set backspace=indent,eol,start " make backspace a more flexible 135 | set backup " make backup files 136 | set history=1000 " remember more commands and search history 137 | set undolevels=1000 " use many big heap levels of undo 138 | set backupdir=~/.vim/backup " where to put backup files 139 | set directory=~/.vim/tmp " directory to place swap files in 140 | set fileformats=unix,mac,dos " support all three, in this order 141 | set hidden " you can change buffers without saving 142 | if has("mouse") 143 | set mouse=a " use mouse everywhere 144 | endif 145 | set noerrorbells " don't make noise when something errors 146 | if has("persistent_undo") 147 | set undofile " enable file undoing 148 | set undodir=~/.vim/undo " where to put undo files 149 | endif 150 | set whichwrap=b,s,h,l,<,>,~,[,] " everything wraps 151 | " | | | | | | | | | 152 | " | | | | | | | | +-- "]" Insert and Replace 153 | " | | | | | | | +-- "[" Insert and Replace 154 | " | | | | | | +-- "~" Normal 155 | " | | | | | +-- Normal and Visual 156 | " | | | | +-- Normal and Visual 157 | " | | | +-- "l" Normal and Visual (not recommended) 158 | " | | +-- "h" Normal and Visual (not recommended) 159 | " | +-- Normal and Visual 160 | " +-- Normal and Visual 161 | set wildmenu " turn on command line completion wild style 162 | " ignore these list file extensions 163 | set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc, 164 | \*.jpg,*.gif,*.png 165 | set wildmode=list:longest " turn on wild mode huge list 166 | " Set buffer to infinity 167 | set viminfo='100,h 168 | 169 | " Enable omnicompletion 170 | " NOTE: This is turned off right now because of jedi-vim 171 | " set omnifunc=syntaxcomplete#Complete 172 | " au FileType python set omnifunc=jedi#completions 173 | " } 174 | 175 | " Vim UI { 176 | set cursorline " highlight current line 177 | set hlsearch " highlight searched for phrases 178 | set incsearch " highlight as you type you 179 | " search phrase 180 | set laststatus=2 " always show the status line 181 | set lazyredraw " do not redraw while running macros 182 | set linespace=0 " don't insert any extra pixel lines 183 | " betweens rows 184 | set list " we do what to show tabs, to ensure we get them 185 | " out of my files 186 | set listchars=tab:>-,trail:- " show tabs and trailing 187 | set matchtime=5 " how many tenths of a second to blink 188 | " matching brackets for 189 | set nostartofline " leave my cursor where it was 190 | set number " turn on line numbers 191 | set numberwidth=5 " We are good up to 99999 lines 192 | set report=0 " tell us when anything is changed via :... 193 | set ruler " Always show current positions along the bottom 194 | set scrolloff=10 " Keep 10 lines (top/bottom) for scope 195 | set shortmess=aOstT " shortens messages to avoid 196 | " 'press a key' prompt 197 | set showcmd " show the command being typed 198 | set showmatch " show matching brackets 199 | set sidescrolloff=10 " Keep 5 lines at the size 200 | set statusline= " clear the statusline for when vimrc is reloaded 201 | set statusline+=%-3.3n\ " buffer number 202 | set statusline+=%<%.99f\ " file name up to 99 chars 203 | set statusline+=%h%m%r%w " flags 204 | set statusline+=%{fugitive#statusline()} " Git fugitive status line 205 | set statusline+=[%{strlen(&ft)?&ft:'none'}, " filetype 206 | set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding 207 | set statusline+=%{&fileformat}] " file format 208 | set statusline+=%= " right align 209 | set statusline+=%b,0x%-8B\ " current char 210 | set statusline+=%-14.(%l,%c%V%)\ %<%P " offset 211 | set statusline+=%#syntodo#%{SyntasticStatuslineFlag()} " Add syntastic status line 212 | " } 213 | 214 | " Text Formatting/Layout { 215 | set expandtab " no real tabs please! 216 | set formatoptions=rq " Automatically insert comment leader on return, 217 | " and let gq format comments 218 | set ignorecase " case insensitive by default 219 | set infercase " case inferred by default 220 | set nowrap " do not wrap line 221 | set shiftround " when at 3 spaces, and I hit > ... go to 4, not 5 222 | set smartcase " if there are caps, go case-sensitive 223 | set nosmartindent " turn off smart indent so comments work in Python 224 | set shiftwidth=4 " auto-indent amount when using cindent, 225 | " >>, << and stuff like that 226 | set softtabstop=4 " when hitting tab or backspace, how many spaces 227 | "should a tab be (see expandtab) 228 | set tabstop=4 " We don't care about real tabs... 229 | " } 230 | 231 | " Mappings { 232 | let mapleader = "," 233 | " Mapping Unite commands 234 | nnoremap / :Unite grep:. 235 | nnoremap y :Unite -buffer-name=yank history/yank 236 | nnoremap l :Unite -buffer-name=buffers -quick-match buffer 237 | nnoremap :Unite -start-insert file 238 | " Mapping tab commands 239 | nnoremap tc :tabc 240 | nnoremap tn :tabn 241 | nnoremap tp :tabp 242 | nnoremap te :tabe 243 | " Remap ,0 to first non-blank character 244 | nnoremap 0 ^ 245 | " Netrw vertical left split 246 | command! NetrwVSP 30vsp . | set winfixwidth 247 | nnoremap nt :NetrwVSP 248 | " Add Tagbar Toggle 249 | nnoremap tb :TagbarToggle 250 | " Error list, next & previous commands for Syntastic 251 | nnoremap e :Errors 252 | nnoremap en :lnext 253 | nnoremap ep :lprev 254 | 255 | " Adding Toggle Comment 256 | nnoremap :call NERDComment("n", "Toggle") 257 | vnoremap :call NERDComment("v", "Toggle") 258 | " Add 'Sign' shortcut 259 | nnoremap si :exec "normal A".system("echo -n ' -- '$(git config --global --get user.name) $(date +\%D)") 260 | " Map Paste / No Number for copy, paste, etc. in Vim without X. 261 | nnoremap p :set paste! 262 | nnoremap ln :set number! 263 | 264 | " X System Clipboard copy, cut, & paste shortcuts. 265 | noremap xp "+gP 266 | noremap xy "+y 267 | noremap xx "+x 268 | " Format JSON automagically 269 | nmap json :%!python -m json.tool 270 | " Compile (make) less to new CSS file 271 | nnoremap ml :w !lessc % > %:t:r.css 272 | " Spell Checking 273 | nnoremap sp :setlocal spell spelllang=en_us 274 | nnoremap nsp :setlocal spell spelllang= 275 | " Edit & Source $MYVIMRC 276 | nnoremap ev :vsplit $MYVIMRC 277 | nnoremap sv :source $MYVIMRC 278 | " Start vertical split command with space character. 279 | nnoremap vs :vsp 280 | " Start horizontal split command with space character. 281 | nnoremap hs :sp 282 | " Close window 283 | nnoremap cw :close 284 | " Close all but the current window. 285 | nnoremap w :only 286 | " Close buffer 287 | nnoremap bd :bd 288 | " Clear highlighting 289 | nnoremap ch :noh 290 | " Insert a line above or below cursor without insert mode. 291 | nnoremap O O 292 | nnoremap o o 293 | " Make arrow keys jump by 10 lines 294 | nnoremap 10j 295 | nnoremap 10k 296 | inoremap 10ji 297 | inoremap 10ki 298 | vnoremap 10j 299 | vnoremap 10k 300 | 301 | " Send the selected hunk to IWS's hastebin 302 | vnoremap hb :'<,'>:w !HASTE_SERVER=http://hastebin.britecorepro.com haste 303 | " Jump easily between open windows 304 | " Deprecated in favor of DWM 305 | " nnoremap h 306 | " nnoremap j 307 | " nnoremap k 308 | " nnoremap l 309 | " " Howdoi mapping 310 | map hdi Howdoi 311 | " Refresh syntax highlighting 312 | nnoremap rf :syntax off:syntax on 313 | " Fix all the whitespace in a file. Re-tabs and removes trailing whitespace. 314 | " Usage: ,ws 315 | nnoremap ws :TrimWS 316 | nnoremap rt gg=G 317 | nnoremap rw :TrimWSgg=G 318 | 319 | nnoremap lw :set wrap!:set linebreak!:set list! 320 | 321 | " Insert a single character of your choosing and return to the right spot. 322 | " Usage: ,[spacebar][character] 323 | nnoremap :exec "normal i".nr2char(getchar())."\e" 324 | nnoremap a :exec "normal a".nr2char(getchar())."\e" 325 | " Write as super user 326 | command! W w !sudo tee % > /dev/null 327 | " Trim trailing whitespace 328 | command! TrimWS %s/\s*$//g | noh 329 | " Visual Selection Search using * and # 330 | function! s:VSetSearch() 331 | let temp = @@ 332 | norm! gvy 333 | let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') 334 | let @@ = temp 335 | endfunction 336 | vnoremap * :call VSetSearch()// 337 | vnoremap # :call VSetSearch()?? 338 | " 'Parameters' Operator mapping 339 | " Usage: dp - Delete between () 340 | onoremap p i( 341 | " } 342 | 343 | " Plugin settings { 344 | let coffee_compile_vert=1 " When compiling CoffeeScript, throw output into vertical split 345 | let coffee_make_options='--bare' 346 | let g:syntastic_check_on_open=1 " Run Syntastic when opening files 347 | let g:syntastic_python_checkers=['python', 'flake8'] " Be more strict in python syntax 348 | let g:ftplugin_sql_omni_key='' " reset sql omni key 349 | let NERDSpaceDelims=1 " Add space delimiters 350 | let g:gitgutter_eager=0 " Only run gitgutter on read/write of files 351 | 352 | " airline settings 353 | let g:airline#extensions#tabline#enabled = 1 " Adding pretty tabline 354 | let g:airline#extensions#tabline#show_buffers = 1 " Make 0 for not showing closed buffers 355 | " let g:vim_json_syntax_conceal = 0 " Don't hide quotes on JSON 356 | 357 | " GitGutter Next/Prev Shortcuts 358 | nmap gh GitGutterNextHunk 359 | nmap gH GitGutterPrevHunk 360 | 361 | " Disable GitGutter in vimdiff 362 | if &diff 363 | let g:gitgutter_enabled=0 364 | endif 365 | 366 | " Solarized variables 367 | let g:solarized_termtrans=1 368 | let g:solarized_contrast="high" 369 | 370 | " Molokai settings 371 | let g:rehash256 = 1 372 | let g:molokai_original = 1 373 | 374 | " Python syntax highlighting settings 375 | let python_highlight_all = 1 376 | let python_version_2 = 1 377 | 378 | " Indent guide settings 379 | let g:indent_guides_start_level = 2 380 | let g:indent_guides_guide_size = 1 381 | let g:indent_guides_auto_colors = 0 382 | hi IndentGuidesOdd ctermbg=234 383 | hi IndentGuidesEven ctermbg=234 384 | 385 | " Jedi settings 386 | " let g:jedi#popup_on_dot = 1 387 | " let g:jedi#popup_select_first = 1 388 | " Disabling parameter autocomplete to speed up completion for now. 389 | " Will enable after it is fixed in Jedi. 390 | " let g:jedi#show_call_signatures = "0" 391 | 392 | " No rope for autocomplete! 393 | let g:pymode_rope = 0 394 | let g:pymode_folding = 0 395 | let g:pymode_lint=0 " Turn off python-mode lint since we use Syntastic 396 | let g:pymode_trim_whitespaces=0 " don't molest whitespace 397 | let g:pymode_syntax_all = 1 398 | let g:pymode_syntax_print_as_function = 1 399 | let g:pymode_syntax = 1 400 | let g:pymode_options_max_line_length = 0 401 | 402 | " Snippet settings 403 | " let g:UltiSnipsExpandTrigger="" 404 | " let g:UltiSnipsListSnippets="" 405 | " let g:UltiSnipsJumpForwardTrigger="" 406 | " let g:UltiSnipsJumpBackwardTrigger="" 407 | 408 | " markdown settings 409 | let g:vim_markdown_folding_disabled=1 410 | 411 | " golang settings 412 | " let g:go_fmt_command = "goimports" 413 | 414 | " Unite settings 415 | let g:unite_enabled_start_insert=1 416 | let g:unite_source_history_yank_enable=1 417 | let g:unite_winheight = 10 418 | 419 | " Startify settings 420 | let g:startify_session_persistence = 1 421 | let g:startify_custom_header = [ 422 | \ '', 423 | \ '', 424 | \ ' _______ _______ __ _______ _____ __', 425 | \ ' |_ _\ \ / / ____| \ \ / /_ _| / ____| / _|', 426 | \ ' | | \ \ /\ / / (___ \ \ / / | | _ __ ___ | | ___ _ __ | |_', 427 | \ ' | | \ \/ \/ / \___ \ \ \/ / | | | `_ ` _ \| | / _ \| `_ \| _|', 428 | \ ' _| |_ \ /\ / ____) | \ / _| |_| | | | | | |___| (_) | | | | |', 429 | \ ' |_____| \/ \/ |_____/ \/ |_____|_| |_| |_|\_____\___/|_| |_|_|', 430 | \ '', 431 | \ '', 432 | \ ] 433 | " } 434 | 435 | " ------------------------------- 436 | " Neocomplete Settings & Mappings 437 | " ------------------------------- 438 | 439 | " Turn this thing on. 440 | let g:neocomplete#enable_at_startup = 1 441 | " Use smartcase. 442 | let g:neocomplete#enable_smart_case = 1 443 | " Set minimum syntax keyword length. 444 | let g:neocomplete#sources#syntax#min_keyword_length = 3 445 | 446 | " Plugin key-mappings. 447 | inoremap neocomplete#undo_completion() 448 | inoremap neocomplete#complete_common_string() 449 | 450 | " Recommended key-mappings. 451 | " : close popup and save indent. 452 | inoremap =CloseNeoCompleteCR() 453 | function! CloseNeoCompleteCR() 454 | return pumvisible() ? neocomplete#close_popup() : "\" 455 | endfunction 456 | " : completion. 457 | inoremap pumvisible() ? "\" : "\" 458 | " , : close popup and delete backword char. 459 | inoremap neocomplete#smart_close_popup()."\" 460 | inoremap neocomplete#smart_close_popup()."\" 461 | inoremap neocomplete#close_popup() 462 | inoremap neocomplete#cancel_popup() 463 | 464 | " Enable heavy omni completion. 465 | if !exists('g:neocomplete#sources#omni#input_patterns') 466 | let g:neocomplete#sources#omni#input_patterns = {} 467 | endif 468 | " Python's omni completion is broken 469 | let g:neocomplete#sources#omni#input_patterns.python = '' 470 | 471 | " -------------------- 472 | " Neosnippets Mappings 473 | " -------------------- 474 | 475 | imap neosnippet#expandable_or_jumpable() ? 476 | \ "\(neosnippet_expand_or_jump)" 477 | \: pumvisible() ? "\" : "\" 478 | smap neosnippet#expandable_or_jumpable() ? 479 | \ "\(neosnippet_expand_or_jump)" 480 | \: "\" 481 | 482 | 483 | 484 | 485 | " Global Abbreviations { 486 | iabbrev rn return 487 | " } 488 | 489 | " Global Functions { 490 | function! InsertDebugLine(str, lnum) 491 | let line = getline(a:lnum) 492 | if strridx(line, a:str) != -1 493 | normal dd 494 | else 495 | let plnum = prevnonblank(a:lnum) 496 | call append(line('.')-1, repeat(' ', indent(plnum)).a:str) 497 | normal k 498 | endif 499 | 500 | " Save file without any events 501 | if &modifiable && &modified | noautocmd write | endif 502 | endfunction 503 | " } 504 | 505 | " Autocmds { 506 | autocmd FileType javascript noremap js :call JsBeautify() 507 | autocmd FileType html noremap js :call HtmlBeautify() 508 | autocmd FileType css noremap js :call CSSBeautify() 509 | autocmd FileType javascript vnoremap :call RangeJsBeautify() 510 | autocmd FileType html vnoremap :call RangeHtmlBeautify() 511 | autocmd FileType css vnoremap :call RangeCSSBeautify() 512 | autocmd FileType gitcommit setlocal colorcolumn=50 513 | 514 | au BufNewFile,BufRead *.wsgi set filetype=python 515 | augroup golang_au 516 | autocmd! 517 | " Display real tabs like 4 spaces, don't list trailing characters 518 | au BufNewFile,BufReadPost *.go setl noexpandtab tabstop=4 nolist 519 | augroup END 520 | augroup javascript_au 521 | autocmd! 522 | " Add debugger key command for JS 523 | au BufNewFile,BufReadPost *.js nnoremap b :call InsertDebugLine("debugger;", line('.')) 524 | augroup END 525 | augroup less_au 526 | autocmd! 527 | " Function to compile Less to CSS 528 | function! LessToCss() 529 | let current_file = shellescape(expand('%:p')) 530 | let filename = shellescape(expand('%:r')) 531 | let command = "silent !lessc " . current_file . " " . filename . ".css" 532 | execute command 533 | endfunction 534 | " Auto-compile less files on save. 535 | autocmd BufWritePost,FileWritePost *.less call LessToCss() 536 | augroup END 537 | augroup python_au 538 | autocmd! 539 | " Add remote debugger key command for Python 540 | au BufNewFile,BufReadPost *.py nnoremap rb :call InsertDebugLine("import rpdb; rpdb.set_trace() # XXX BREAKPOINT", line('.')) 541 | au BufNewFile,BufReadPost *.py nnoremap bb :call InsertDebugLine("import pudb; pudb.set_trace() # XXX BREAKPOINT", line('.')) 542 | augroup END 543 | augroup reopen_au 544 | autocmd! 545 | " Re-open VIM to the last spot you had open. 546 | au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") 547 | \| exe "normal! g'\"" | endif 548 | 549 | " Jump to the top of git COMMIT_EDITMSG files. 550 | au BufReadPost COMMIT_EDITMSG 551 | \ exe "normal! gg" 552 | augroup END 553 | augroup unite_au 554 | autocmd! 555 | function! s:unite_settings() 556 | " Put settings that execute inside the unite buffer here 557 | endfunction 558 | autocmd FileType unite call s:unite_settings() 559 | augroup END 560 | " } 561 | 562 | " Include custom configurations via the .vimrc_custom file 563 | " which is included here: 564 | if filereadable($HOME."/.vimrc_custom") 565 | source $HOME/.vimrc_custom 566 | endif 567 | --------------------------------------------------------------------------------