Skip to content

Instantly share code, notes, and snippets.

@bbtdev
Created March 8, 2018 10:35
Show Gist options
  • Save bbtdev/eb0d3a81f7442e0f864f62ec15252454 to your computer and use it in GitHub Desktop.
Save bbtdev/eb0d3a81f7442e0f864f62ec15252454 to your computer and use it in GitHub Desktop.
vimrc backup
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'
" should always have
Plugin 'altercation/vim-colors-solarized'
Plugin 'justinmk/vim-dirvish'
Plugin 'bling/vim-airline'
Plugin 'kien/ctrlp.vim'
Plugin 'surround.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-endwise'
Plugin 'francoiscabrol/ranger.vim'
" ctags
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'majutsushi/tagbar'
" should make myself
Plugin 'ervandew/supertab'
" html
Plugin 'matchit.zip'
Plugin 'ragtag.vim'
" elm
Plugin 'ElmCast/elm-vim'
" ruby/ruby on rails
Plugin 'ngmy/vim-rubocop'
" rspec
Plugin 'thoughtbot/vim-rspec'
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
" style
syntax enable
colorscheme solarized
set background=dark
set t_Co=256
" structure
set expandtab
set shiftwidth=2
set tabstop=2
set number
set hidden
set nocompatible
" buffer navigation
:nnoremap gb :ls<CR>:b<Space>
" new line without comment
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" find navigation
set path=$PWD/**
set wildmenu
set wim=longest:full,full
" netrw close buffer
autocmd FileType netrw setl bufhidden=wipe
" dirvish
" dirvish sort by folder
autocmd FileType dirvish sort ,^.*[\/],
" ctrlp in dirvish
autocmd FileType dirvish nnoremap <buffer><silent> <c-p> :CtrlP<cr>
" gutentags ripper tags ruby setup
let g:gutentags_define_advanced_commands = 1
let g:gutentags_ctags_executable_ruby = 'ripper-tags --ignore-unsupported-options'
" endwise ctrl+j
imap <C-J> <CR>
" tagbar
nmap <F8> :TagbarToggle<CR>
" cscope
function! LoadCscope()
let db = findfile("cscope.out", ".;")
if (!empty(db))
let path = strpart(db, 0, match(db, "/cscope.out$"))
set nocscopeverbose " suppress 'duplicate connection' error
exe "cs add " . db . " " . path
set nocscopeverbose
" else add the database pointed to by environment variable
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
endfunction
au BufEnter /* call LoadCscope()
" elm
let g:elm_format_autosave = 1
" GREP custom
function MyGrepFunc(myarg)
execute 'silent grep! -r --exclude=log --exclude=*.min.*' a:myarg | cw | redr!
endfunction
:com -nargs=1 GREP call MyGrepFunc(<f-args>)
map <F4> :call MyGrepFunc(expand("<cword>") . " *")<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment