Created
June 21, 2015 18:58
-
-
Save Reggieme/7d679276ec8420012368 to your computer and use it in GitHub Desktop.
My .vimrc heavy example
This file contains 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
" Reggie .vimrc | |
set nocompatible " be iMproved, required | |
set number | |
set shell=/bin/bash " Enable vim with fish shell | |
filetype off " required for vundle | |
" Vundle {{{ | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
" Javascript syntax ------------------------{{{ | |
Plugin 'jelera/vim-javascript-syntax' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'einars/js-beautify' | |
Plugin 'othree/javascript-libraries-syntax.vim' | |
let g:used_javascript_libs = 'angularjs,jasmine,chai,handlebars,jquery' | |
Plugin 'maksimr/vim-jsbeautify' | |
" map <c-f> :call JsBeautify()<cr> | |
" or | |
autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr> | |
" for html | |
autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr> | |
" for css or scss | |
autocmd FileType css,less,sass,scss noremap <buffer> <c-f> :call CSSBeautify()<cr> | |
" }}} | |
" Auto completion ----------------------------{{{ | |
Plugin 'raimondi/delimitmate' " Autocompletion for quoutes, brackets | |
let delimitMate_expand_cr = 1 | |
Plugin 'Valloric/YouCompleteMe' | |
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' | |
" You complete me disabled for tab, only for control space | |
" let g:ycm_auto_trigger = 0 | |
let g:ycm_key_list_select_completion = ['<C-Space>'] | |
let g:ycm_key_list_previous_completion = ['<C-k'] | |
" YCM gives you popups and splits by default that some people might not like, | |
" so these should tidy it up a bit for you. | |
"let g:ycm_add_preview_to_completeopt=0 | |
"let g:ycm_confirm_extra_conf=0 | |
"set completeopt-=preview | |
"let g:ycm_key_list_select_completion = [] | |
Plugin 'marijnh/tern_for_vim' | |
let g:tern_map_keys=1 | |
Plugin 'MarcWeber/vim-addon-mw-utils' | |
Plugin 'tomtom/tlib_vim' | |
Plugin 'garbas/vim-snipmate' | |
" Remap tab to snip mate | |
"imap <c-j> <Plug>snipMateNextOrTrigger | |
"smap <c-j> <Plug>snipMateNextOrTrigger | |
Plugin 'honza/vim-snippets' | |
" Plugin 'tristen/vim-sparkup' | |
" Enable different Shortcut | |
" let g:sparkupExecuteMapping = '<C-e><c-d>' | |
" let g:sparkupNextMapping = '<C-e><C-e>' | |
" }}} | |
" Vim essentials ----------------------------------{{{ | |
" Vim actions | |
Plugin 'tpope/vim-surround' " Surround text | |
Plugin 'tpope/vim-commentary' " Comente lines | |
Plugin 'tpope/vim-fugitive' " Git commands in vim | |
Plugin 'tpope/vim-repeat' | |
Plugin 'rking/ag.vim' "Search inside all files | |
" Project navigation | |
Plugin 'kien/ctrlp.vim' | |
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git' | |
let g:ctrlp_switch_buffer = 0 | |
" let g:ctrlp_prompt_mappings = { | |
" \ 'AcceptSelection("e")': ['<cr>','<2-LeftMouse>', '<c-o>'], | |
" \ 'OpenMulti()': ['<c-m>'] | |
" \ } | |
" let g:ctrlp_match_window = 'bottom,order:ttb' | |
" let g:ctrlp_working_path_mode = 0 | |
Plugin 'scrooloose/nerdtree' | |
let NERDTreeQuitOnOpen=1 | |
" Status bar and cosmetics | |
Plugin 'bling/vim-airline' " Notification bar for improved UI | |
set laststatus=2 | |
let g:airline#extensions#tabline#enabled = 1 " Automatically displays all | |
Plugin 'Yggdroot/indentLine' | |
" Plugin 'kshenoy/vim-signature' " Markers gutter | |
Plugin 'airblade/vim-gitgutter' " Git gutter for vim | |
" }}} | |
" Extra Support -------------------------------{{{ | |
Plugin 'groenewege/vim-less' | |
" Add colours for css hexa values | |
Plugin 'ap/vim-css-color' | |
Plugin 'othree/html5.vim' | |
" Node tools GF | |
Plugin 'moll/vim-node' | |
" HTML Mustache indentation | |
Plugin 'mustache/vim-mustache-handlebars' | |
" Jade indentation | |
Plugin 'digitaltoad/vim-jade' | |
" Marckdown syntax | |
Plugin 'plasticboy/vim-markdown' | |
let g:vim_markdown_folding_disabled=1 | |
Plugin 'tpope/vim-haml' | |
Plugin 'elzr/vim-json' | |
" Disable hiding double quoutes | |
let g:vim_json_syntax_conceal = 0 | |
" }}} | |
" Semi usefull -------------------------------{{{ | |
" Plugin 'StanAngeloff/php.vim' | |
" Plugin 'benmills/vimux' | |
" let VimuxUseNearest = 1 | |
" Plugin 'christoomey/vim-tmux-navigator' | |
Plugin 'tpope/vim-obsession' | |
Plugin 'sidorares/node-vim-debugger' | |
" Plugin 'briancollins/vim-jst' " Support .ejs files | |
" Plugin 'godlygeek/tabular' " Aligning text | |
" Plugin 'majutsushi/tagbar' | |
" nmap <F8> :TagbarToggle<CR> | |
" }}} | |
" Syntax Linting ----------------------------{{{ | |
Plugin 'scrooloose/syntastic' | |
let g:syntastic_javascript_checkers = ['jshint'] | |
hi SyntasticError ctermbg=097 | |
hi SyntasticWarning ctermbg=124 | |
let g:syntastic_auto_loc_list = 0 | |
" let g:syntastic_loc_list_height = 10 | |
" All of your Plugins must be added before the following line | |
" }}} | |
" Vundle end {{{ | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" To ignore plugin indent changes, instead use: | |
" filetype plugin on | |
" :PluginList - lists configured plugins | |
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate | |
" :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal | |
" }}} | |
" }}} | |
" Color settings {{{ | |
set t_Co=256 | |
set background=light | |
set background=dark | |
let g:solarized_termcolors=256 | |
colorscheme solarized | |
highlight SignColumn ctermbg=NONE | |
highlight LineNr ctermbg=NONE | |
highlight GitGutterAdd guibg=NONE | |
highlight GitGutterChange guibg=NONE | |
highlight GitGutterDelete guibg=NONE | |
highlight GitGutterChangeDelete guibg=NONE | |
" change scheme to better match solarized scheme | |
nnoremap <leader># :source $MYVIMRC<CR>:AirlineTheme lucius<cr> | |
let g:airline_theme='tomorrow' | |
" colorscheme tomorrow-night | |
" Higlighting | |
"***************************************** | |
set hlsearch "'highlight search (very useful!) | |
set incsearch " search incremently (search while typing) | |
set ignorecase " Ignore case searching | |
set showcmd " show command in bottom bar | |
set cursorline " highlight current line" | |
" Change cursor line number color | |
" hi CursorLineNr term=bold ctermfg=grey gui=bold guifg=Yellow | |
" hi CursorLine ctermbg=254 gui=bold guifg=Yellow | |
" Make vertical split thinner | |
hi vertsplit ctermfg=109 ctermbg=NONE | |
" Resize vim automatically when terminal is resized | |
au VimResized * exe "normal! \<c-w>=" | |
" }}} | |
" Indentation and searching {{{ | |
filetype indent on " load filetype-specific indent files | |
set wildmenu " visual autocomplete for command menu | |
set lazyredraw " redraw only when we need to. | |
set showmatch " highlight matching [{()}] | |
set history=300 "longer history than 20(default) | |
set tabstop=4 " size of a hard tabstop | |
set shiftwidth=4 " size of an \"indent\" | |
" a combination of spaces and tabs are used to simulate tab stops | |
" at a width other than the (hard)tabstop | |
set softtabstop=4 | |
" make tab insert indents instead of tabs at the beginning of a line | |
set smarttab | |
set expandtab " always uses spaces instead of tab characters | |
set linebreak | |
" Keyboard | |
set ttyfast "improve redrawing | |
set ttyscroll=8 | |
set notimeout "speed up response to Esc key | |
set ttimeout | |
" set timeoutlen=3000 "waiting period for another key to be pressed (milliseconds) | |
" set ttimeoutlen=100 | |
set scrolloff=8 " Keep 8 lines below and above the cursor | |
" }}} | |
" Remapings {{{ | |
"******************************************** | |
" inoremap jj <esc>:w<cr> | |
" cnoremap jj <c-c> | |
nnoremap j gj | |
nnoremap k gk | |
" Better than H L because you dont use h and l | |
nnoremap H ^ | |
nnoremap L $ | |
" Leader mappings | |
let mapleader = "\<Space>" | |
" %% mappin(%:h) - display current buffer directory in Ex | |
" cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%' | |
cnoremap %% <C-R>=fnameescape(expand('%:h')).'/'<cr> | |
map <leader>ew :e %% | |
map <leader>es :sp %% | |
map <leader>ev :vsp %% | |
map <leader>et :tabe %% | |
nnoremap <leader>qa :qa<CR> | |
nnoremap <leader>qq :q<CR> | |
nnoremap <leader>w :w<CR> | |
" Shell like in the insert mode | |
inoremap <c-a> <esc>I | |
inoremap <c-e> <esc>A | |
" Used by vim-tmux-navigation | |
nnoremap <c-h> <C-w>h | |
nnoremap <c-j> <C-w>j | |
nnoremap <c-k> <C-w>k | |
nnoremap <c-l> <C-w>l | |
" zoom a vim pane, <C-w>= to re-balance | |
nnoremap <leader>- :wincmd _<cr>:wincmd \|<cr> | |
nnoremap <leader>= :wincmd =<cr> | |
" Create space | |
nnoremap go o<esc>:wa<cr> | |
nnoremap gO O<esc>:wa<cr> | |
" Keep n and N in the middle of the screen | |
nnoremap n nzzzv | |
nnoremap N Nzzzv | |
" Keep in the middle when junping around | |
nnoremap g; g;zz | |
nnoremap g, g,zz | |
" Dont move when * | |
nnoremap * *<c-o> | |
" highlight last inserted text | |
nnoremap gV `[v`] | |
"disable accidental q: | |
nnoremap q: :q | |
" Faster screen scroll | |
nnoremap <C-e> 3<C-e> | |
nnoremap <C-y> 3<C-y> | |
" search selected text and escapes chars | |
vnoremap <silent> // y/<C-R>=escape(@", '\\/.*$^~[]')<CR><CR> | |
" substitute previously serched text | |
nnoremap <leader>/ :%s///gc<left><left><left> | |
nmap <c-n> :!node %<CR> | |
nnoremap <c-b> :CtrlPBuffer<cr> | |
nnoremap <leader>m :!mocha %<cr> | |
" Function mappings | |
nnoremap <F3> :NERDTreeToggle<CR> | |
" Press F4 to toggle highlighting on/off, and show current value. | |
noremap <F4> :set hlsearch! hlsearch?<CR> | |
" allign | |
map <F7> mzgg=G`z<CR> | |
" F5 ctrlp clear cache | |
" Scroll through buffers | |
nnoremap <silent> [b :bprevious<CR> | |
nnoremap <silent> ]b :bnext<CR> | |
nnoremap <silent> [B :bfirst<CR> | |
nnoremap <silent> ]B :blast<CR> | |
" toggle with previous buffer | |
nnoremap <tab> <c-^> | |
" delete buffer without deleting window | |
nnoremap <leader>bd :bp<bar>sp<bar>bn<bar>bd<CR> | |
" toggle with previous buffer | |
nnoremap <leader>bb <c-^> | |
" List buffers | |
nnoremap <leader>bl :ls<cr>:b | |
" Open project buffers | |
nnoremap <leader>bm :CtrlP models/<cr> | |
nnoremap <leader>br :CtrlP routes/<cr> | |
nnoremap <leader>bv :CtrlP views/<cr> | |
nnoremap <leader>bc :CtrlPCurFile<cr> | |
nnoremap <leader>ba :e app.js<cr> | |
nnoremap <leader>bi :e index.html<cr> | |
" Tabs controlls | |
nnoremap [t gT | |
nnoremap ]t gt | |
nnoremap ]T :tabfirst<cr> | |
nnoremap ]T :tablast<cr> | |
nnoremap <c-w>t :tabe<cr> | |
" Args list controlls | |
nnoremap ]a :n<cr> | |
nnoremap [a :N<cr> | |
" add files to the args list from the current folder | |
nnoremap <leader>aa :args <C-R>=fnameescape(expand('%:h')).'/*.*'<CR><cr> | |
" add files to args list from the current folder recursively | |
nnoremap <leader>ar :args %:p:h/*/*<CR> | |
" display args list | |
nnoremap <leader>al :args<CR> | |
" Copy paste from the clipboard | |
nmap <Leader><Leader> V | |
vmap <Leader><Leader> V | |
vmap <Leader>y "+y | |
vmap <Leader>d "*d | |
nmap <Leader>p go"*p | |
nmap <Leader>P "*P | |
vmap <Leader>p "*p | |
vmap <Leader>P "*P | |
" Easier change inside commas | |
nnoremap <leader>' f'ci' | |
nnoremap <leader>" f"ci" | |
nnoremap <leader>b' f'ci' | |
nnoremap <leader>b" f"ci" | |
" Plugin mappings | |
nnoremap <leader>ag :Ag<space> | |
nnoremap <leader>lc :ccl<cr> | |
" Nerdtree plugin mappings | |
nnoremap <leader>n :NERDTreeToggle<CR> | |
nnoremap <leader>sf :NERDTreeFind<CR> | |
nnoremap <leader>sd :NERDTree %:p:h<CR> | |
nnoremap <leader>so :Obsession<CR> | |
" nnoremap <leader>sm :mksession! <CR> | |
nnoremap <leader>ga :Git add .<cr> | |
nnoremap <leader>gc :Gcommit<cr> | |
nnoremap <leader>gs :Gstatus<cr> | |
nnoremap <leader>gp :Gpush<cr> | |
" tern plugin mappings | |
nnoremap <leader>td :TernDoc<cr> | |
nnoremap <leader>tb :TernDocBrowse<cr> | |
nnoremap <leader>tt :TernType<cr> | |
nnoremap <leader>td :TernDef<cr> | |
nnoremap <leader>tpd :TernDefPreview<cr> | |
nnoremap <leader>tsd :TernDefSPlit<cr> | |
nnoremap <leader>ttd :TernDefTab<cr> | |
nnoremap <leader>tr :TernRefs<cr> | |
nnoremap <leader>tR :TernRename<cr> | |
nnoremap <leader>tf :TernDef<cr>f(gf | |
" Vimux plugin mappings | |
nnoremap <leader>vr :call VimuxRunCommand("clear; node " . bufname("%"))<CR> | |
nnoremap <leader>vp :VimuxPromptCommand<CR> | |
nnoremap <leader>vc :VimuxCloseRunner<CR> | |
" Vundle Plugin controll | |
nnoremap <leader>> :PluginInstall<cr> | |
nnoremap <leader>< :PluginClean<cr> | |
" Remove trailing whitespace | |
nnoremap <Leader>rtw :%s/\s\+$//e<CR> | |
" Allow saving of files as sudo when I forgot to start vim using sudo. | |
cmap w!! w !sudo tee > /dev/null % | |
" Three window layout swap | |
nnoremap <leader>st <c-w>K<c-w>j<c-w>H | |
nnoremap <leader>sb <c-w>K<c-w>j<c-w>j<c-w>H | |
" Disable arow keys | |
noremap <Up> <NOP> | |
noremap <Down> <NOP> | |
noremap <Left> <NOP> | |
noremap <Right> <NOP> | |
" Vimrc configuration | |
nnoremap <leader>vv :vsp $MYVIMRC<CR> | |
nnoremap <leader>vs :source $MYVIMRC<CR> | |
" USed leaders: qq, qa, ww, e, r, t, y, u, ig, p, c, v, n, >, < | |
" }}} | |
" Folding and persistence {{{ | |
"************************************* | |
"set foldenable | |
" enable machit plugin | |
filetype plugin on | |
runtime macros/matchit.vim | |
" History and Undo files | |
" if has('persistent_undo') | |
" set undodir=~/.vim/undo | |
" set undofile | |
set undolevels=250 | |
" set undoreload=10000 | |
" endif | |
" Back-up files | |
set backup | |
set backupdir=~/.vim/backup// | |
set directory=~/.vim/swap// | |
set writebackup | |
set noswapfile | |
" }}} | |
" File type interpretation {{{ | |
"************************************** | |
" interpret .handlebars and .hbs files as html | |
" au BufNewFile,BufRead *.handlebars set filetype=html | |
" au BufNewFile,BufRead *.hbs set filetype=html | |
" au BufNewFile,BufRead *.ejs set filetype=html | |
" au BufNewFile,BufRead *.jade set ft=jade | |
au FileType vim setl foldenable foldmethod=marker | |
" au FileType ejs,jst setlocal omnifunc=htmlcomplete#CompleteTags | |
au BufNewFile,BufRead *.ejs set filetype=jst.html | |
" Ignores for searches | |
set wildignore+=.hg,.git,.svn | |
set wildignore+=*.jpg,*.bmp,*.png,*.jpeg | |
" }}} | |
" Enable insert cursor in Gnome terminal {{{ | |
" if has("autocmd") && has('GUI_GTK') | |
" au InsertEnter * silent execute \"!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam" | |
" au InsertLeave * silent execute \"!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block" | |
" au VimLeave * silent execute \"!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block" | |
" endif | |
"}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment