Created
December 19, 2016 17:36
-
-
Save Anticom/acd460943493d58e09e0d96e2223b141 to your computer and use it in GitHub Desktop.
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
""" See: https://github.com/mgedmin/dotvim/blob/master/vimrc | |
" Backup files {{{2 | |
set backup " make backups | |
set backupdir=~/tmp " but don't clutter $PWD with them | |
if $USER == "root" | |
" 'sudo vi' on certain machines cannot write to ~/tmp (NFS root-squash) | |
set backupdir=/root/tmp | |
endif | |
if !isdirectory(&backupdir) | |
" create the backup directory if it doesn't already exist | |
exec "silent !mkdir -p " . &backupdir | |
endif | |
" }}} | |
"##### SOME IMPORTANT CONFIG ##### | |
let mapleader="\<space>" | |
set showcmd | |
" Splits: | |
set splitbelow | |
set splitright | |
" Searching: | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" spell checking | |
"set spell | |
"set spelllang=en | |
"set spellsuggest=best | |
"################################# | |
"############################################################################## | |
"# VUNDLE # | |
"############################################################################## | |
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 'VundleVim/Vundle.vim' | |
" Functionality: | |
" Project rooting | |
Plugin 'airblade/vim-rooter' | |
Plugin 'tpope/vim-fugitive' | |
" Lorem generator | |
Plugin 'loremipsum' | |
" CTags automation | |
Plugin 'ludovicchabant/vim-gutentags' | |
" Provide fugitive browse support for bitbucket | |
Plugin 'tommcdo/vim-fubitive' | |
"Plugin 'Shougo/vimshell.vim' | |
Plugin 'rstacruz/sparkup' | |
Plugin 'scrooloose/nerdcommenter' | |
" Visual debugger | |
Plugin 'Shougo/vimproc.vim' | |
Plugin 'idanarye/vim-vebugger' | |
" Plugin 'joonty/vdebug' | |
" Language_support: | |
Plugin 'kergoth/vim-bitbake' | |
" UI: | |
" File explorer | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'Xuyuanp/nerdtree-git-plugin' | |
Plugin 'jistr/vim-nerdtree-tabs' | |
" Better language support | |
Plugin 'octol/vim-cpp-enhanced-highlight' | |
Plugin 'leafgarland/typescript-vim' | |
Plugin 'nickhutchinson/vim-cmake-syntax' | |
" Assist persistent undo | |
Plugin 'mbbill/undotree' | |
"Plugin 'sjl/gundo.vim' | |
" Source outlines | |
Plugin 'vim-scripts/taglist.vim' | |
" Indentation guides | |
Plugin 'Yggdroot/indentLine' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'Shougo/neocomplete.vim' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'ryanoasis/vim-devicons' | |
" Gutter related | |
Plugin 'airblade/vim-gitgutter' | |
"Plugin 'chrisbra/changesPlugin' | |
" Color Themes: | |
Plugin 'tomasr/molokai' | |
Plugin 'mkarmona/colorsbox' | |
Plugin 'Donearm/Ubaryd' | |
Plugin 'vim-airline/vim-airline-themes' | |
" Misc: | |
"Plugin 'itchyny/calendar.vim' | |
Plugin 'mhinz/vim-startify' | |
Plugin 'viewdoc' | |
" 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 - 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 | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
"############################################################################## | |
"# VUNDLE RELATED CONFIG # | |
"############################################################################## | |
""" szw/vim-ctrlspace | |
set nocompatible | |
set hidden | |
"set showtabline=0 | |
""" pwd: | |
let g:gutentags_project_root = ['.project', '.cproject'] | |
let g:rooter_patterns = ['.project', '.cproject', '.git', '.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'] | |
if &diff | |
let g:rooter_manual_only = 1 | |
endif | |
""" scrooloose/nerdtree | |
" autoopen nerdtree | |
"autocmd StdinReadPre * let s:std_in=1 | |
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" autoclose nerdtree | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
""" vim-airline/vim-airline | |
set laststatus=2 | |
let g:airline_powerline_fonts = 1 | |
"let g:Powerline_symbols = 'fancy' | |
set t_Co=256 | |
"set fillchars+=stl:\ ,stlnc:\ | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
" display open buffers in tabline | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#buffer_idx_mode = 1 | |
""" Shougo/neocomplete.vim | |
" Disable AutoComplPop. | |
let g:acp_enableAtStartup = 0 | |
" Use neocomplete. | |
let g:neocomplete#enable_at_startup = 1 | |
" Use smartcase. | |
let g:neocomplete#enable_smart_case = 1 | |
" Set minimum syntax keyword length. | |
let g:neocomplete#sources#syntax#min_keyword_length = 3 | |
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' | |
" Define dictionary. | |
let g:neocomplete#sources#dictionary#dictionaries = { | |
\ 'default' : '', | |
\ 'vimshell' : $HOME.'/.vimshell_hist', | |
\ 'scheme' : $HOME.'/.gosh_completions' | |
\ } | |
" Define keyword. | |
if !exists('g:neocomplete#keyword_patterns') | |
let g:neocomplete#keyword_patterns = {} | |
endif | |
let g:neocomplete#keyword_patterns['default'] = '\h\w*' | |
" Enable omni completion. | |
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags | |
" Enable heavy omni completion. | |
if !exists('g:neocomplete#sources#omni#input_patterns') | |
let g:neocomplete#sources#omni#input_patterns = {} | |
endif | |
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::' | |
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)' | |
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' | |
" For perlomni.vim setting. | |
" https://github.com/c9s/perlomni.vim | |
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::' | |
""" scrooloose/syntastic | |
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 | |
"let g:syntastic_cpp_compiler = 'clang++' | |
let g:syntastic_cpp_compiler = 'g++' | |
"let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++' | |
""" airblade/vim-gitgutter | |
set updatetime=750 | |
let g:gitgutter_sign_column_always = 1 | |
let g:gitgutter_realtime = 1 | |
""" ctrlpvim/ctrlp.vim | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux | |
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows | |
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' | |
""" itchyny/calendar.vim | |
let g:calendar_google_calendar = 1 | |
let g:calendar_google_task = 1 | |
""" devicons | |
set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Nerd\ Font\ Complete\ 12 | |
""" color schemes | |
syntax enable | |
"set background=light | |
colorscheme colorsbox-material | |
let g:airline_theme='ubaryd' | |
"############################################################################## | |
"# CUSTOM CONFIG # | |
"############################################################################## | |
" Essential settings {{{ | |
let $PAGER='' | |
set shell=/bin/bash | |
set encoding=utf-8 | |
" Support for correct color display when using tmux | |
set t_ut= | |
" }}} | |
" Persistent undo (vim 7.3+) {{{2 | |
if has("persistent_undo") | |
set undofile " enable persistent undo | |
let &undodir=&backupdir . "/.vimundo" " but don't clutter $PWD | |
if !isdirectory(&undodir) | |
" create the undo directory if it doesn't already exist | |
exec "silent !mkdir -p " . &undodir | |
endif | |
endif | |
""" just some candy | |
set mouse=a | |
""" Show whitespace characteres | |
set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣ | |
"set list | |
""" smarter tabbing | |
let _curfile = expand("%:t") | |
if _curfile =~ "Makefile" || _curfile =~ "makefile" || _curfile =~".*\.mk" | |
set noexpandtab | |
else | |
set tabstop=4 | |
set softtabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
"retab | |
endif | |
""" coding style guides | |
set colorcolumn=80 | |
"set showmatch | |
""" shortcuts | |
set relativenumber number | |
vnoremap > ><CR>gv | |
vnoremap < <<CR>gv | |
"let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] } | |
"nnoremap <C-w>E :SyntasticCheck<CR> :SyntasticToggleMode<CR> | |
" Neocomplete key-mappings. | |
" <CR>: close popup and save indent. | |
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> | |
function! s:my_cr_function() | |
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>" | |
" For no inserting <CR> key. | |
"return pumvisible() ? "\<C-y>" : "\<CR>" | |
endfunction | |
" <TAB>: completion. | |
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
" <C-h>, <BS>: close popup and delete backword char. | |
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>" | |
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>" | |
" Close popup by <Space>. | |
"inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>" | |
" AutoComplPop like behavior. | |
"let g:neocomplete#enable_auto_select = 1 | |
" Shell like behavior(not recommended). | |
"set completeopt+=longest | |
"let g:neocomplete#enable_auto_select = 1 | |
"let g:neocomplete#disable_auto_complete = 1 | |
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>" | |
""" NerdTree | |
"silent! nmap <C-p> :NERDTreeToggle<CR> | |
silent! map <F3> :NERDTreeFind<CR> | |
let g:NERDTreeMapActivateNode="<F3>" | |
let g:NERDTreeMapPreview="<F2>" | |
""" undotree | |
nnoremap <F5> :UndotreeToggle<CR> | |
""" taglist | |
nnoremap <F4> :TlistToggle<CR> | |
nnoremap <F8> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR> | |
"nnoremap <C-q> :qa<CR> | |
""" some final fixups | |
set grepprg=grep\ --color=always\ -n\ $*\ /dev/null | |
"autocmd FileType make setlocal noexpandtab | |
" Become a better vim user: | |
"noremap <Up> :echo "Stop using Up key!" | |
"noremap <Down> :echo "Stop using Down key!" | |
"noremap <Left> :echo "Stop using Left key!" | |
"noremap <Right> :echo "Stop using Right key!" | |
nmap <leader>1 <Plug>AirlineSelectTab1 | |
nmap <leader>2 <Plug>AirlineSelectTab2 | |
nmap <leader>3 <Plug>AirlineSelectTab3 | |
nmap <leader>4 <Plug>AirlineSelectTab4 | |
nmap <leader>5 <Plug>AirlineSelectTab5 | |
nmap <leader>6 <Plug>AirlineSelectTab6 | |
nmap <leader>7 <Plug>AirlineSelectTab7 | |
nmap <leader>8 <Plug>AirlineSelectTab8 | |
nmap <leader>9 <Plug>AirlineSelectTab9 | |
nmap <leader>- <Plug>AirlineSelectPrevTab | |
nmap <leader>+ <Plug>AirlineSelectNextTab | |
" My mappings {{{ | |
" swap ^ and 0 | |
nnoremap 0 ^ | |
nnoremap ^ 0 | |
" Plugin key-mappings. | |
inoremap <expr><C-g> neocomplete#undo_completion() | |
inoremap <expr><C-l> neocomplete#complete_common_string() | |
" Ctags navigation | |
nnoremap <C-G> <C-]> | |
nnoremap <C-B> <C-T> | |
" Splits {{{ | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" }}} | |
" copy and paste {{{ | |
if has('xterm_clipboard') | |
vmap <C-c> "+yi | |
vmap <C-x> "+c | |
vmap <C-v> c<ESC>"+p | |
imap <C-v> <ESC>"+pa | |
endif | |
" }}} | |
""""" LEADER MAPPINGS: """"" | |
" nerdtree tabs: | |
map <leader> <plug>NERDTreeTabsToggle<CR> | |
nnoremap <leader>w :set list!<CR> | |
" formatting | |
nnoremap <leader>f gg=G | |
"nnoremap <leader>t :noremap <Leader>t :!ctags <CR> | |
" Debugging: | |
let g:vebugger_leader='<Leader>d' | |
cnoremap gdb VBGstartGDB | |
"nnoremap <leader>db :VBGtoggleBreakpoint<CR> | |
"i step in | |
"o step over | |
"O step out | |
"c continue | |
"b toggle breakpoint on current line | |
"B clear breakpoints | |
"e |:VBGevalWordUnderCursor| in normal mode | |
" |:VBGevalSelectedText| in select mode | |
"E Prompt for an argument for |:VBGeval| | |
" | |
"x |:VBGexecute| current line in normal mode. | |
" |:VBGexecuteSelectedText| in select mode | |
"X Prompt for an argument for |:VBGexecute| | |
" | |
"t |:VBGtoggleTerminalBuffer| | |
"r Select mode only - |:VBGrawWriteSelectedText| | |
"R Prompt for an argument for |:VBGrawWrite| | |
" }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment