-
-
Save tallytalwar/f7e8713e00c49712f9f8 to your computer and use it in GitHub Desktop.
.vimrc and plugins (using pathogen)
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
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
" VIM Configuration File | |
" Description: Optimized for C/C++ development, but useful also for other things. | |
" Source Author: Gerhard Gappmeier | |
" Modified By: Varun Talwar | |
" Plugins Used | |
" - Make Sure to setup pathogen before using any of the following plugins: https://github.com/tpope/vim-pathogen | |
" - gruvbox (note, once installed you will have to link `gruvbox/colors/gruvbox.vim` to `~/.vim/colors/gruvbox.vim` | |
" - kotlin-vim | |
" - nerdcommenter | |
" - nerdtree | |
" - nerdtree-git-plugin | |
" - rust.vim | |
" - syntastic | |
" - vim-airline (This will require the powerline fonts: https://github.com/powerline/fonts) | |
" - vim-fugitive | |
" - vim-gitgutter | |
" - vim-glsl | |
" - vim-lldb | |
" - vim-multiple-cursor | |
" - vim-nerdtree-tabs | |
" set UTF-8 encoding | |
set enc=utf-8 | |
set fenc=utf-8 | |
set termencoding=utf-8 | |
" disable vi compatibility (emulation of old bugs) | |
set nocompatible | |
" use indentation of previous line | |
set autoindent | |
" use intelligent indentation for C | |
set smartindent | |
" configure tabwidth and insert spaces instead of tabs | |
set tabstop=4 " tab width is 4 spaces | |
set shiftwidth=4 " indent also with 4 spaces | |
set expandtab " expand tabs to spaces | |
" wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays. | |
set textwidth=120 | |
" turn syntax highlighting on | |
set t_Co=256 | |
syntax on | |
" colorscheme xoria256 | |
" colorscheme zenburn | |
" colorscheme wombat256mod | |
colorscheme gruvbox | |
:set bg=dark | |
" Column color for 121 | |
set ruler | |
set colorcolumn=121 | |
highlight COlorColumn ctermbg=Black | |
" turn line numbers on | |
set number | |
" turn relative line numbers on | |
set relativenumber | |
" highlight matching braces | |
set showmatch | |
" intelligent comments | |
set comments=sl:/*,mb:\ *,elx:\ */ | |
" vi search fanciness | |
" incremental searching | |
set incsearch | |
" searching string highlighting | |
set hlsearch | |
" allow erasing previously entered characters in insert mode | |
:set backspace=indent,eol,start | |
" Install DoxygenToolkit from http://www.vim.org/scripts/script.php?script_id=987 | |
let g:DoxygenToolkit_authorName="John Doe <[email protected]>" | |
" Enhanced keyboard mappings | |
" | |
" in normal mode F2 will save the file | |
nmap <F2> :w<CR> | |
" in insert mode F2 will exit insert, save, enters insert again | |
imap <F2> <ESC>:w<CR>i | |
" switch between header/source with F5 | |
map <F5> :vsplit %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR> | |
map <F6> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR> | |
" reload tabs | |
map <Leader>rt :tabdo e<cr> | |
" reload buffers | |
map <Leader>rb :bufdo e<cr> | |
" Gdiff HEAD | |
map <Leader>gd :Gdiff<cr> | |
" Gdiff master | |
map <Leader>gm :Gdiff master<cr> | |
" Tangram Building | |
" Tangram Android clean | |
map <Leader>xA :make clean-android<cr> | |
" Tangram Android build | |
map <Leader>a :make android -j<cr> | |
" Tangram Android build and run | |
map <Leader>A :make android -j; android/run.sh<cr> | |
" Tangram Linux clean | |
map <Leader>xL :make clean-linux<cr> | |
" Tangram Linux build | |
map <Leader>l :make linux -j<cr> | |
" Tangram Linux run | |
map <Leader>L :make linux -j; cd build/linux/bin; ./tangram; cd ../../..<cr> | |
" Tangram OSX clean | |
map <Leader>xO :make clean-osx -j<cr> | |
" Tangram OSX build | |
map <Leader>o :make osx -j<cr> | |
" Tangram OSX run | |
map <Leader>O :./build/osx/bin/tangram.app/Contents/MacOS/tangram<cr> | |
" Api trace on tangram | |
map <F9> :!apitrace trace ./build/osx/bin/tangram.app/Contents/MacOS/tangram<CR> | |
" Run Apitrace on the traces generated | |
map <F10> :!qapitrace ./build/osx/bin/tangram.app/Contents/Resources/tangram.trace<CR> | |
" maping to remove traling whitespaces: F4 | |
:nnoremap <silent> <F4> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR> | |
" Underline using dashes automatically | |
" " Underline the current line with dashes in normal mode | |
nnoremap <F7> yyp<c-v>$r- | |
" Underline the current line with dashes in insert mode | |
nnoremap <F7> <Esc>yyp<c-v>$r-A | |
" autocomand to remove all trailing whitespaces on a save | |
" autocmd BufWritePre * :%s/\s\+$//e | |
autocmd FileType c,cpp,java,php autocmd BufWritePre <buffer> :%s/\s\+$//e | |
" in diff mode we use the spell check keys for merging | |
if &diff | |
” diff settings | |
set diffopt+=vertical | |
map <M-Down> ]c | |
map <M-Up> [c | |
map <M-Left> do | |
map <M-Right> dp | |
map <F9> :new<CR>:read !svn diff<CR>:set syntax=diff buftype=nofile<CR>gg | |
" else | |
" spell settings | |
" :setlocal spell spelllang=en | |
" set the spellfile - folders must exist | |
" set spellfile=~/.vim/spellfile.add | |
" map <M-Down> ]s | |
" map <M-Up> [s | |
endif | |
" Adding Runtime Path Manipulation for pathogen.vim | |
" refer: https://github.com/tpope/vim-pathogen | |
execute pathogen#infect() | |
" setting libclang path lookup for clangComplete to work | |
let s:clang_library_path='/Library/Developer/CommandLineTools/usr/lib' | |
if isdirectory(s:clang_library_path) | |
let g:clang_snippets=1 | |
let g:clang_close_preview=1 | |
let g:clang_library_path=s:clang_library_path | |
let g:clang_hl_errors=1 | |
let g:clang_user_options='-std=c++11' | |
endif | |
" Hoping to get trackpad scrolling with vi | |
set mouse=a | |
map <ScrollWheelUp> <C-Y> | |
map <ScrollWheelDown> <C-E> | |
" Enablig code folding | |
set foldmethod=manual | |
" enable filetype plugins | |
filetype plugin indent on | |
filetype plugin on | |
" more smart mapping to make sure to have the matching braces automatically added | |
":inoremap { {<CR>}<Esc>ko | |
" Allow saving of files as sudo when I forgot to start vim using sudo. | |
cmap w!! w !sudo tee > /dev/null % | |
" mapping to switch between vertical and horizontal splits | |
" nmap <ESC>w :wincmd k<CR> " shift to upper split | |
" nmap <ESC>s :wincmd j<CR> " shift to lower split | |
" nmap <ESC>a :wincmd h<CR> " shift to left split | |
" nmap <ESC>d :wincmd l<CR> " shift to right split | |
" Now option key is mapped to ESC in the terminal preferences instead of hex value and hence the above changes | |
nmap ∑ :wincmd k<CR> | |
nmap ß :wincmd j<CR> | |
nmap å :wincmd h<CR> | |
nmap ∂ :wincmd l<CR> | |
" Launch vi with NERDTree by default | |
"autocmd VimEnter * NERDTree | |
" Moves the cursor in the new window and not in the NERDTree window | |
"autocmd VimEnter * wincmd p | |
" Map NERDTreeTabsToggle to something useful | |
nmap <ESC>n :NERDTreeTabsToggle | |
" Open NERDTree on console vim startup | |
let g:nerdtree_tabs_open_on_console_startup = 1 | |
let g:nerdtree_tabs_autofind = 1 | |
" using powerline font | |
set guifont=Liberation\ Mono\ for\ Powerline\ 10 | |
" vim-airline configuration | |
set laststatus=2 | |
let g:airline_powerline_fonts = 1 | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
" powerline symbols for vim-airline | |
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_symbols.branch = '' | |
let g:airline_symbols.readonly = '' | |
let g:airline_symbols.linenr = '' | |
" Settings for syntastic plugin | |
" set statusline+=%#warningmsg# | |
"set statusline+=%{SyntasticStatuslineFlag()} | |
"set statusline+=%* | |
"let g:syntastic_always_populate_loc_list = 1 | |
"let g:syntastic_auto_loc_list = 1 | |
"let g:syntastic_check_on_open = 1 | |
"let g:syntastic_check_on_wq = 0 | |
""Use c++11 for syntastic | |
"let g:syntastic_cpp_compiler = 'clang++' | |
"let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++' | |
""Diable Java checks for syntastic | |
let g:syntastic_mode_map = { 'passive_filetypes' : ['java'] } | |
" gitgutter configuration | |
let g:gitgutter_max_signs = 5000 "update gitgutter to allow more hunks | |
" Custom Delimiters for NerdCommenter (to respect glsl shaders) ... follow cpp commenting scehem | |
" let g:NERDCustomDelimiters = { | |
" \ ‘glsl’ : { ‘left': ‘//‘, ‘leftAlt’: ‘/’, ‘rightAlt’: ‘/‘ }, | |
" \ ‘vs’ : { ‘left': ‘//‘, ‘leftAlt’: ‘/’, ‘rightAlt’: ‘/‘ }, | |
" \ ‘fs’ : { ‘left': ‘//‘, ‘leftAlt’: ‘/’, ‘rightAlt’: ‘/‘ }, | |
" \ } | |
" NERDTree-git-plugin config | |
let g:NERDTreeIndicatorMapCustom = { | |
\ "Modified" : "✹", | |
\ "Staged" : "✚", | |
\ "Untracked" : "✭", | |
\ "Renamed" : "➜", | |
\ "Unmerged" : "═", | |
\ "Deleted" : "✖", | |
\ "Dirty" : "✗", | |
\ "Clean" : "✔︎", | |
\ "Unknown" : "?" | |
\ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment