Last active
July 21, 2016 12:50
-
-
Save avishaan/dda912b14137f0ea860a to your computer and use it in GitHub Desktop.
My .vimrc that everyone has been asking for
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
" https://github.com/Valloric/YouCompleteMe/issues/611 | |
"let $PATH = '/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=/usr/local/opt/python/Frameworks/Python.framework/Versions/2.7'.$PATH | |
let $PATH = '/usr/local/bin:'.$PATH | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'EasyMotion' | |
"Plugin 'https://github.com/joequery/Stupid-EasyMotion' | |
Plugin 'https://github.com/scrooloose/syntastic.git' | |
Plugin 'flazz/vim-colorschemes' | |
Plugin 'jelera/vim-javascript-syntax' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'nathanaelkane/vim-indent-guides' | |
Plugin 'Raimondi/delimitMate' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'marijnh/tern_for_vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'git://git.wincent.com/command-t.git' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'git://github.com/tpope/vim-fugitive.git' | |
Plugin 'elzr/vim-json' | |
Plugin 'bling/vim-airline' | |
Plugin 'git://github.com/tpope/vim-abolish.git' | |
Plugin 'git://github.com/terryma/vim-multiple-cursors.git' | |
Plugin 'git://github.com/jtratner/vim-flavored-markdown.git' | |
Plugin 'git://github.com/tpope/vim-surround.git' | |
Plugin 'git://github.com/tpope/vim-unimpaired.git' | |
" use leader leader + and then + - to activate | |
Plugin 'https://github.com/drmikehenry/vim-fontsize' | |
Plugin 'https://github.com/edsono/vim-matchit' | |
Plugin 'suan/vim-instant-markdown' | |
Plugin 'gabrielelana/vim-markdown' | |
Plugin 'dhruvasagar/vim-table-mode' | |
Plugin 'othree/html5.vim' | |
Plugin 'Slava/vim-spacebars' | |
Plugin 'https://github.com/gorodinskiy/vim-coloresque.git' | |
Plugin 'groenewege/vim-less' | |
Plugin 'nelstrom/vim-visual-star-search' | |
Plugin 'digitaltoad/vim-jade' | |
Plugin 'https://github.com/mxw/vim-jsx' | |
Plugin 'https://github.com/tpope/vim-ragtag' | |
Plugin 'https://github.com/tpope/vim-jdaddy' | |
Plugin 'majutsushi/tagbar' | |
Plugin 'mtscout6/vim-tagbar-css' | |
Plugin 'artnez/vim-wipeout' | |
" Plugin 'xolox/vim-misc' | |
" Plugin 'xolox/vim-easytags' | |
" Plugin 'craigemery/vim-autotag' | |
" The following are examples of different formats supported. | |
" Keep Plugin commands between vundle#begin/end. | |
" plugin on GitHub repo | |
" Plugin 'tpope/vim-fugitive' | |
" plugin from http://vim-scripts.org/vim/scripts.html | |
" Plugin 'L9' | |
" Git plugin not hosted on GitHub | |
" git repos on your local machine (i.e. when working on your own plugin) | |
" Plugin 'file:///home/gmarik/path/to/plugin' | |
" The sparkup vim script is in a subdirectory of this repo called vim. | |
" Pass the path to set the runtimepath properly. | |
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} | |
" Avoid a name conflict with L9 | |
" Plugin 'user/L9', {'name': 'newL9'} | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" To ignore plugin indent changes, instead use: | |
"filetype plugin on | |
" | |
" Brief help | |
" :PluginList - list configured plugins | |
" :PluginInstall(!) - install (update) plugins | |
" :PluginSearch(!) foo - search (or refresh cache first) for foo | |
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
set t_Co=256 | |
syntax on | |
set backspace=indent,eol,start | |
set expandtab | |
set shiftwidth=2 | |
set softtabstop=2 | |
" set for specific filetypes | |
"autocmd Filetype html setlocal ts=3 sw=3 expandtab | |
set cursorline | |
set cursorcolumn | |
set scrolloff=9 | |
set colorcolumn=80 | |
"some of own keybindings | |
"use alt to move different window | |
nnoremap ˙ <C-W><C-H> | |
nnoremap ∆ <C-W><C-J> | |
nnoremap ˚ <C-W><C-K> | |
nnoremap ¬ <C-W><C-L> | |
"allow the window nav to work in insert mode | |
inoremap ˙ <Esc><C-W><C-H> | |
inoremap ∆ <Esc><C-W><C-J> | |
inoremap ˚ <Esc><C-W><C-K> | |
inoremap ¬ <Esc><C-W><C-L> | |
"use different keys for pageup/pagedown | |
"nnoremap ¨ <C-D> | |
"nnoremap ˆ <C-U> | |
"inoremap ¨ <Esc><C-D> | |
"inoremap ˆ <Esc><C-U> | |
"associate the following filetypes | |
au BufRead,BufNewFile .tern-project setfiletype json | |
au BufRead,BufNewFile Procfile setfiletype json | |
au BufRead,BufNewFile Procfile setfiletype json | |
let g:solarized_hitrail=1 | |
highlight RedundantWhitespace ctermbg=red guibg=red | |
match RedundantWhitespace /\s\+$\| \+\zs\t/ | |
" if file changes outside of vim, go ahead and update it, like @checkout | |
set autoread | |
" stop line wrap/breaks | |
set nowrap | |
" change easy motion color so they work better with Solarized | |
hi link EasyMotionTarget ErrorMsg | |
hi link EasyMotionShade Comment | |
set number | |
" YCM Stuff | |
" keep logfiles permanently | |
let g:ycm_server_keep_logfiles = 1 | |
"let g:ycm_server_log_level = 'debug' | |
let g:ycm_warning_symbol = '..' | |
let g:ycm_error_symbol = '**' | |
let g:syntastic_error_symbol = "‡" | |
let g:syntastic_warning_symbol = "†" | |
"change error sign color | |
highlight SyntasticWarningSign ctermfg=yellow guifg=darkyellow | |
" write YCM error into the console so we can see wtf is going on | |
let g:ycm_server_use_vim_stdout = 1 | |
let g:ycm_enable_diagnostic_signs = 0 | |
let g:ycm_autoclose_preview_window_after_completion = 1 | |
let g:ycm_filetype_blacklist = { | |
\ 'tagbar' : 1, | |
\ 'qf' : 1, | |
\ 'notes' : 1, | |
\ 'markdown' : 1, | |
\ 'gitcommit' : 1, | |
\ 'text' : 1, | |
\ 'vimwiki' : 1, | |
\ 'ghmarkdown' : 1, | |
\ 'pandoc' : 1, | |
\ 'infolog' : 1, | |
\ 'mail' : 1 | |
\} | |
"BreakLine: Return TRUE if in the middle of {} or () in INSERT mode | |
fun! BreakLine() | |
if (mode() == 'i') | |
return ((getline(".")[col(".")-2] == '{' && getline(".")[col(".")-1] == '}') || | |
\(getline(".")[col(".")-2] == '(' && getline(".")[col(".")-1] == ')')) | |
else | |
return 0 | |
endif | |
endfun | |
" Remap <Enter> to split the line and insert a new line in between if | |
" BreakLine return True | |
inoremap <expr> <CR> BreakLine() ? "<CR><ESC>O" : "<CR>" | |
"Vim color settings for iterm | |
colorscheme solarized | |
set background=dark | |
"let g:solarized_visibility = "high" | |
"let g:solarized_contrast = "high" | |
" Settings for vim-indent-guides | |
let g:indent_guides_start_level = 5 | |
"let g:indent_guides_guide_size = 1 | |
" let g:indent_guides_auto_colors = 0 | |
" autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=.s:g_blue | |
" autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=235 | |
let g:indent_guides_color_change_percent = 5 | |
let g:indent_guides_enable_on_vim_startup = 1 | |
"Settings for nerdtree | |
map <C-n> :NERDTreeToggle<CR> | |
" if nerdtree is last buffer, close it | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
let NERDTreeShowBookmarks=0 | |
" resize NERDTree window | |
let g:NERDTreeWinSize = 28 | |
autocmd vimenter * if !argc() | NERDTree | endif | |
" Change cursor shape between insert and normal mode in iTerm2.app | |
if $TERM_PROGRAM =~ "iTerm" | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode | |
"stop YCM from loading in term because of python crashes during git stuff | |
" let g:loaded_youcompleteme = 1 | |
endif | |
" Change the font | |
set guifont=Meslo\ LG\ S\ Regular\ for\ Powerline:h10 | |
if has("gui_running") | |
if has("gui_gtk2") | |
"set guifont=Inconsolata\ 12 | |
elseif has("gui_macvim") | |
"remove the macvim closefile mapping when hitting cmd w | |
macmenu &File.Close key=<nop> | |
set guifont=Meslo\ LG\ S\ Regular\ for\ Powerline:h10 | |
"set guifont=Menlo\ Regular:h12 | |
elseif has("gui_win32") | |
set guifont=Consolas:h11:cANSI | |
endif | |
endif | |
"some vim-json settings, prevent quotes hiding | |
"let g:vim_json_syntax_conceal = 0 | |
"put all the swap files in this tmp directory instead of the local directory | |
set backupdir=~/tmp | |
"fix the fugitive/gitdiff/vimdiff colors | |
hi! DiffAdd guibg=#003300 | |
hi! DiffChange guibg=#003300 | |
hi! DiffDelete guifg=#330000 guibg=#330000 | |
"hi! DiffText guibg=#990000 | |
set guifont=Meslo\ LG\ S\ Regular\ for\ Powerline:h10 | |
"airline options | |
let g:airline_powerline_fonts = 1 | |
let g:Powerline_symbols = 'fancy' | |
set laststatus=2 | |
let g:airline#extensions#syntastic#enabled = 0 | |
let g:airline_section_warning = 0 | |
" hide file encoding | |
let g:airline_section_y = '' | |
"flavored Markdown config | |
augroup markdown | |
au! | |
au BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown | |
augroup END | |
"ex command line mapping for previewMarkdown | |
command! MarkdownPreview !markdown-preview %:p; | |
" gutter column color | |
"highlight SignColumn guibg=Gray ctermbg=Gray | |
highlight clear SignColumn | |
highlight GitGutterAdd ctermfg=green guifg=darkgreen | |
highlight GitGutterChange ctermfg=yellow guifg=darkyellow | |
highlight GitGutterDelete ctermfg=red guifg=darkred | |
highlight GitGutterChangeDelete ctermfg=yellow guifg=darkyellow | |
" put swap files in different directory | |
set backupdir=./.backup,.,~/tmp | |
set directory=.,./.backup,~/tmp | |
set swapfile | |
set dir=./.swp,~/tmp | |
" vim instant markdown options | |
" no autostart, manual start via :InstantMarkdownPreview | |
let g:instant_markdown_autostart = 0 | |
let g:instant_markdown_slow = 1 | |
" command-t options | |
let g:CommandTWildIgnore=&wildignore . ",**/bower_components/*" | |
let g:CommandTWildIgnore=&wildignore . ",**/node_modules/*" | |
" general ignore | |
set wildignore=*.bak,*.jar,*.gif,*.png,*.jpg,*.swf | |
" leader for spelling toggle | |
nmap <leader>S :set spell!<CR> | |
set nospell | |
" tableize | |
"let g:table_mode_mappings_prefix = "g" | |
command! MarkdownExport !pandoc -V fontsize=10pt -V geometry:margin=0.2in % -o %.pdf | |
" don't wait for long for timeout for leader key | |
set timeoutlen=300 | |
" word wrap/ line wrap | |
set wrap | |
" hide scroll bars in macvim | |
set go-=r | |
set go-=L | |
" hide toolbar | |
set go-=T | |
" hide jsdoc syntax highlighting | |
" let g:javascript_ignore_javaScriptdoc = 1 | |
" leader s to toggle syntastic jshinter/linter | |
nmap <leader>c :SyntasticToggleMode<CR> | |
" remove automatic commenting when moving to next line | |
au FileType * set fo-=c fo-=r fo-=o | |
" html 5 tidy | |
let g:syntastic_html_tidy_exec = 'tidy5' | |
" react jsx support https://jaxbot.me/articles/setting-up-vim-for-react-js-jsx-02-03-2015 | |
let g:syntastic_javascript_checkers = ['jsxhint'] | |
let g:syntastic_javascript_jsxhint_exec = 'jsx-jshint-wrapper' | |
let g:syntastic_json_checkers = ['jsonlint'] | |
let g:syntastic_aggregate_errors = 1 | |
" let g:syntastic_auto_loc_list = 1 | |
" hide warning from location list | |
" let g:syntastic_quiet_messages = { "level" : "warnings" } | |
" indent on newline | |
" :set showbreak=>>>>>>>>> | |
:set breakindent | |
" need to use bash shell since we are now using zsh | |
" :set shell=/bin/bash | |
" vert diff default | |
:set diffopt+=vertical | |
" keep a longer history | |
set history=200 | |
" code folding http://unix.stackexchange.com/questions/141097/how-to-enable-and-use-code-folding-in-vim | |
set foldmethod=manual | |
set foldnestmax=10 | |
" set nofoldenable | |
set foldlevel=2 | |
" relative absolute line number depending on which mode we are in | |
set relativenumber | |
" use jk in insert mode for esc | |
imap jk <Esc> | |
" function to remove "enter to complete" when running vim command | |
command! -nargs=1 Silent | |
\ | execute ':silent !'.<q-args> | |
\ | execute ':redraw!' | |
" trigger pushups | |
function! DoPushup () | |
terminal-notifier -title 'Test' -message 'test' | |
endfunction | |
inoremap if <C-o>:silent !terminal-notifier -title '💪🏾Workout💪🏾' -message 'contract your whole core'<CR>if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment