Created
May 29, 2017 13:47
-
-
Save pertrai1/3d2047cc0810487a970115bba34ae7a7 to your computer and use it in GitHub Desktop.
Latest Vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set nocompatible | |
| filetype off | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| Plugin 'VundleVim/Vundle.vim' | |
| Plugin 'tpope/vim-fugitive' | |
| Plugin 'tpope/vim-git' | |
| Plugin 'honza/vim-snippets' | |
| Plugin 'scrooloose/syntastic.git' | |
| Plugin 'jistr/vim-nerdtree-tabs.git' | |
| Plugin 'scrooloose/nerdtree.git' | |
| Plugin 'ctrlpvim/ctrlp.vim' | |
| Plugin 'rking/ag.vim' | |
| Plugin 'henrik/vim-indexed-search' | |
| Plugin 'Lokaltog/vim-easymotion' | |
| Plugin 'nathanaelkane/vim-indent-guides' | |
| Plugin 'Shougo/neocomplete.git' | |
| Plugin 'sjl/gundo.vim' | |
| Plugin 'vim-scripts/AutoTag.git' | |
| Plugin 'majutsushi/tagbar' | |
| Plugin 'jeetsukumaran/vim-buffergator' | |
| Plugin 'vim-airline/vim-airline' | |
| Plugin 'jlanzarotta/bufexplorer' | |
| Plugin 'vim-airline/vim-airline-themes' | |
| Plugin 'ternjs/tern_for_vim' | |
| call vundle#end() | |
| filetype plugin indent on | |
| "============================================================================== | |
| " My VIMRC - Rob Simpson - v2.2.1 | |
| "============================================================================== | |
| set shell=/bin/zsh | |
| "============================================================================== | |
| " turn on the ruler in the status line | |
| "============================================================================== | |
| set ruler | |
| "============================================================================== | |
| " Allow deletes in Insert mofe to keep deleting past the insertion point | |
| "============================================================================== | |
| set backspace=indent,eol,start | |
| "============================================================================== | |
| " Turn on case-insensitive matches (but only when pattern is all-lowercase) | |
| "============================================================================== | |
| set ignorecase smartcase | |
| "============================================================================== | |
| " Makes searches look-ahead as you type | |
| "============================================================================== | |
| set incsearch | |
| "============================================================================== | |
| " Make successful searches highlight all possible matches | |
| "============================================================================== | |
| set hlsearch | |
| "============================================================================== | |
| " Make delete key in Normal mode remove the highlighted matches | |
| "============================================================================== | |
| map <silent> <BS> :nohlsearch<CR> | |
| "============================================================================== | |
| " Make folds auto-open and auto-close when the curor moves over them | |
| "============================================================================== | |
| set foldopen=all | |
| set foldclose=all | |
| "============================================================================== | |
| " Fold lines according to the file's syntax | |
| "============================================================================== | |
| syntax enable | |
| set foldmethod=syntax | |
| "============================================================================== | |
| " show/hide fold structures in the left margin | |
| "============================================================================== | |
| :set foldcolumn=6 | |
| :set foldcolumn& | |
| "============================================================================== | |
| " Deepest level to fold | |
| "============================================================================== | |
| set foldnestmax=5 | |
| "============================================================================== | |
| " Set the number lines to be shown | |
| "============================================================================== | |
| set number | |
| "============================================================================== | |
| " Set the splits | |
| "============================================================================== | |
| set splitbelow | |
| set splitright | |
| "============================================================================== | |
| " Show incomplete commands down the bottom | |
| "============================================================================== | |
| set showcmd | |
| "============================================================================== | |
| " Show current mode down the bottom | |
| "============================================================================== | |
| set showmode | |
| "============================================================================== | |
| " Manage tabs | |
| "============================================================================== | |
| set smarttab | |
| set tabstop=4 | |
| set shiftwidth=4 | |
| set softtabstop=4 | |
| set expandtab | |
| set nocompatible | |
| "============================================================================== | |
| " General | |
| "============================================================================== | |
| runtime ftplugin/man.vim | |
| set history=1000 "Store lots of :cmdline history | |
| set gcr=a:blinkon0 "Disable cursor blink | |
| set visualbell "No sounds | |
| set autoread "Reload files changed outside vim | |
| set shiftround | |
| set hidden | |
| set autoindent | |
| set smartindent | |
| set textwidth=120 | |
| set formatoptions=tcrnqn1j | |
| set colorcolumn=+1 | |
| syntax on | |
| "============================================================================== | |
| " Leader mappings | |
| "============================================================================== | |
| let mapleader = "," | |
| nnoremap ; : | |
| nnoremap <leader><leader> V | |
| nnoremap <leader>ev :vsp $MYVIMRC<CR> | |
| nnoremap <leader>sv :source $MYVIMRC<CR> | |
| nnoremap <leader>a :Ag | |
| nnoremap <leader>bp :bprevious<CR> | |
| nnoremap <leader>bn :bnext<CR> | |
| nnoremap <leader>bl :ls<CR> | |
| nnoremap <leader>g :GundoToggle<CR> | |
| nnoremap <F8> :TagbarToggle<CR> | |
| nnoremap <leader>rt :retab<CR> | |
| nnoremap -c ddO | |
| "============================================================================== | |
| " Window mappings | |
| "============================================================================== | |
| nnoremap <C-J> <C-W><C-J> "Ctrl-j to move down a split | |
| nnoremap <C-K> <C-W><C-K> "Ctrl-k to up a split | |
| nnoremap <C-L> <C-W><C-L> "Ctrl-l to right a split | |
| nnoremap <C-H> <C-W><C-H> "Ctrl-h to left a split | |
| noremap <C-h> <C-w>h | |
| noremap <C-j> <C-w>j | |
| noremap <C-k> <C-w>k | |
| noremap <C-l> <C-w>l | |
| "============================================================================== | |
| " Pasting mappings | |
| "============================================================================== | |
| vmap <Leader>y "+y | |
| vmap <Leader>d "+d | |
| nmap <Leader>p "+p | |
| nmap <Leader>P "+P | |
| vmap <Leader>p "+p | |
| vmap <Leader>P "+P | |
| "============================================================================== | |
| " Ctrlp settings | |
| "============================================================================== | |
| let g:ctrlp_use_caching = 0 | |
| if executable('ag') | |
| set grepprg=ag\ --nogroup\ --nocolor | |
| let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
| else | |
| let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] | |
| let g:ctrlp_prompt_mappings = { | |
| \ 'AcceptSelection("e")': ['<space>', '<cr>', '<2-LeftMouse>'], | |
| \ } | |
| endif | |
| nnoremap <leader>o :CtrlP<CR> | |
| let g:ctrlp_custom_ignore = { | |
| \ 'dir': '\v[\/](\.(git|hg|svn)|\_site)$', | |
| \ 'file': '\v\.(exe|so|dll|class|png|jpg|jpeg)$', | |
| \} | |
| let g:ctrlp_cmd = 'CtrlPMixed' | |
| let g:ctrlp_by_filename = '1' | |
| let g:ctrlp_match_window = 'bottom, order:ttb' | |
| let g:ctrlp_switch_buffer = 0 | |
| let g:ctrlp_working_path_mode = 'r' | |
| nmap <leader>bb :CtrlpBuffer<CR> | |
| nmap <leader>bm :CtrlpMixed<CR> | |
| nmap <leader>bs :CtrlpMRU<CR> | |
| "============================================================================== | |
| " Buffergator settings | |
| "============================================================================== | |
| let g:buffergator_viewport_split_policy = 'R' | |
| let g:buffergator_suppress_keymaps = 1 | |
| nmap <leader>jj :BuffergatorMruCyclePrev<CR> | |
| nmap <leader>kk :BuffergatorMruCycleNext<CR> | |
| nmap <leader>bl :BuffergatorOpen<CR> | |
| nmap <leader>T :enew<CR> | |
| nmap <leader>bq :bp <BAR> bd #<CR> | |
| "============================================================================== | |
| " Vundle settings | |
| "============================================================================== | |
| if filereadable(expand("~/.vim/vundles.vim")) | |
| source ~/.vim/vundles.vim | |
| endif | |
| "============================================================================== | |
| " File swap settings | |
| "============================================================================== | |
| set noswapfile | |
| set nobackup | |
| set nowb | |
| "============================================================================== | |
| " NERDTree Settings | |
| "============================================================================== | |
| map <C-e> :NERDTreeTabsToggle<CR>:NERDTreeMirrorOpen<CR> | |
| map <leader>e :NERDTreeFind<CR> | |
| nmap <leader>nt :NERDTreeFind<CR> | |
| let NERDTreeShowBookmarks = 1 | |
| let NERDTreeChDirMode = 0 | |
| let NERDTreeQuitOnOpen = 0 | |
| let NERDTreeMouseMode = 2 | |
| let NERDTreeShowHidden = 1 | |
| let NERDTreeKeepTreeInNewTab = 1 | |
| let g:nerdtree_tabs_open_on_gui_startup = 1 | |
| let g:nerdtree_tabs_open_on_console_startup = 1 | |
| map <leader>d <plug>NERDTreeTabsToggle<CR> | |
| map <leader>l :NERDTreeFind<CR> | |
| "============================================================================== | |
| " Persistent Settings | |
| " Keep undo history across sessions, by storing in file. | |
| " Only works all the time. | |
| "============================================================================== | |
| if has('persistent_undo') | |
| silent !mkdir ~/.vim/backups > /dev/null 2>&1 | |
| set undodir=~/.vim/backups | |
| set undofile | |
| endif | |
| "============================================================================== | |
| " Filetype Settings | |
| "============================================================================== | |
| filetype plugin on | |
| filetype indent on | |
| "============================================================================== | |
| " Line wrapping | |
| "============================================================================== | |
| set nowrap | |
| set linebreak | |
| "============================================================================== | |
| " Optimize any file searching | |
| "============================================================================== | |
| set wildmode=list:longest | |
| set wildmenu | |
| set wildignore=*.o,*.obj,*~ | |
| set wildignore+=*vim/backups* | |
| set wildignore+=*sass-cache* | |
| set wildignore+=*DS_Store* | |
| set wildignore+=vendor/rails/** | |
| set wildignore+=vendor/cache/** | |
| set wildignore+=*.gem | |
| set wildignore+=log/** | |
| set wildignore+=tmp/** | |
| set wildignore+=*.png,*.jpg,*.gif | |
| "============================================================================== | |
| " Still to clean up | |
| "============================================================================== | |
| set scrolloff=8 | |
| set sidescrolloff=15 | |
| set sidescroll=1 | |
| "============================================================================== | |
| " Setting text width for file types | |
| "============================================================================== | |
| autocmd BufRead, BufNewFile *.md setlocal textwidth=80 | |
| autocmd FileType gitcommit setlocal textwidth=72 | |
| "============================================================================== | |
| " Silver Searcher | |
| "============================================================================== | |
| if executable('ag') | |
| " Use Ag over Grep" | |
| set grepprg=ag\ --nogroup\ --nocolor | |
| " Use ag in CtrlP for listing files. | |
| let g:ctrlp_user_command = 'ag %s -1 --nocolor -g ""' | |
| " ag is fast enough that CtrlP does not need to cache | |
| let g:ctrlp_use_caching = 0 | |
| endif | |
| "============================================================================== | |
| " Snipmate | |
| "============================================================================== | |
| imap <C-J> <esc>a<Plug>snipMateNextOrTrigger | |
| smap <C-J> <Plug>snipMateNextOrTrigger | |
| "============================================================================== | |
| " Syntastic | |
| "============================================================================== | |
| let g:syntax_always_populate_loc_list = 1 | |
| let g:syntax_auto_loc_list = 1 | |
| let g:syntastic_check_on_open = 1 | |
| let g:syntax_check_on_wq = 0 | |
| let g:syntastic_auto_jump = 1 | |
| let g:syntastic_aggregate_errors = 1 | |
| let g:syntastic_javascript_checkers = ['eslint', 'jsxhint'] | |
| let g:syntastic_scss_checkers = ['scss_lint'] | |
| let g:syntastic_css_checkers = [ 'csslint' ] | |
| let g:syntastic_json_checkers = [ 'jsonlint' ] | |
| let g:syntastic_error_symbol='✗' | |
| let g:syntastic_warning_symbol='⚠' | |
| let g:syntastic_style_error_symbol = '✗' | |
| let g:syntastic_style_warning_symbol = '⚠' | |
| "============================================================================== | |
| " Airline | |
| "============================================================================== | |
| let g:airline_powerline_fonts=0 | |
| let g:airline_left_sep = '⮀' | |
| let g:airline_left_alt_sep = '⮁' | |
| let g:airline_right_sep = '⮂' | |
| let g:airline_right_alt_sep = '⮃' | |
| let g:airline#extensions#bufferline#enabled = 1 | |
| let g:airline#extensions#branch#enabled = 1 | |
| let g:airline#extensions#branch#empty_message = '' | |
| let g:airline#extensions#syntastic#enabled = 1 | |
| let g:airline#extensions#tabline#enabled = 1 | |
| let g:airline#extensions#tabline#fnamemod = ':t' | |
| let g:airline_detect_modified = 1 | |
| let g:airline#extensions#bufferline#enabled = 1 | |
| let g:airline_detect_paste = 1 | |
| let g:airline_theme = 'sol' | |
| "============================================================================== | |
| " Move line up and down | |
| "============================================================================== | |
| nmap <C-Up> [e | |
| nmap <C-Down> ]e | |
| vmap <C-Up> [egv | |
| vmap <C-Down> ]egv | |
| nmap <leader>be :BufExplorer<CR> | |
| nmap <leader>bh :BufExplorerHorizontalSplit<CR> | |
| "============================================================================== | |
| " Tern | |
| "============================================================================== | |
| let g:tern_map_keys=1 | |
| let g:tern_show_argument_hints='on_hold' | |
| "============================================================================== | |
| " Toggle Indentation | |
| "============================================================================== | |
| function! ToggleIndent() | |
| if &tabstop=="2" | |
| set tabstop=4 | |
| set shiftwidth=4 | |
| set softtabstop=4 | |
| set expandtab | |
| echo "indent set to 4" | |
| else | |
| set tabstop=2 | |
| set shiftwidth=2 | |
| set softtabstop=2 | |
| set expandtab | |
| echo "indent set to 2" | |
| endif | |
| endfunction | |
| nnoremap <leader><Tab> :call ToggleIndent()<CR> | |
| nnoremap <leader>n :setlocal number!<CR> | |
| "Bind K to grep word under cursor | |
| nnoremap K :grep "\b<C-R><C-W>\b"<CR>:cw<CR> | |
| "http://vim.wikia.com/wiki/Use_folds_in_your_program | |
| nnoremap <silent> <Space> @=(foldlevel('.')?'za':"\<Space>")<CR> | |
| vnoremap <Space> zf | |
| map ,js :CtrlP Content/js<CR> | |
| map ,jl :CtrlP Content/less<CR> | |
| map ,jp :CtrlP Views/partials<CR> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment