Skip to content

Instantly share code, notes, and snippets.

Last active April 28, 2018 01:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
set nocompatible
if has("syntax")
syntax on
if has("autocmd")
" Automatically reload vimrc after saving
autocmd bufwritepost .vimrc source $MYVIMRC
" Remember last position in file
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
filetype plugin indent on
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set tabstop=4
set shiftwidth=4
set expandtab
set hidden
set history=1000
set ruler
set spell spelllang=en_us
set backspace=2
"set colorcolumn=80
"set number
"nnoremap <F2> :NumbersToggle<CR>
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
"Many of these are from
" We usually want to jump to a line+column, not just the line.
nnoremap ' `
nnoremap ` '
let mapleader = ","
runtime macros/matchit.vim
set wildmenu
set wildmode=list:longest
set scrolloff=3
map <leader>c <C-_><C-_>
map f <Plug>(easymotion-s)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
let g:EasyMotion_smartcase = 1
"Now using vim-plug for plugin management:
"mkdir -p ~/.vim/autoload
"curl -fLo ~/.vim/autoload/plug.vim
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
if v:version < 800
Plug 'vim-syntastic/Syntastic'
Plug 'w0rp/ale'
Plug 'altercation/vim-colors-solarized'
Plug 'godlygeek/tabular' "
" Plug 'davidhalter/jedi-vim'
Plug 'gavinbeatty/dragvisuals.vim'
Plug 'tpope/vim-surround'
Plug 'tomtom/tcomment_vim'
Plug 'morhetz/gruvbox'
Plug 'sjl/gundo.vim'
Plug 'benmills/vimux'
"Plug 'myusuf3/numbers.vim'
Plug 'Lokaltog/vim-easymotion'
Plug 'triglav/vim-visual-increment'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'christoomey/vim-tmux-navigator'
Plug 'vim-scripts/hgrev'
Plug 'tpope/vim-fugitive'
Plug 'Shougo/unite.vim'
Plug 'Shougo/vimproc', { 'do' : 'make' }
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
Plug 'fisadev/vim-isort', {'do' : 'pip install isort' } " Sort imports
Plug 'AndrewRadev/splitjoin.vim' "gS or gJ to split or join lines
Plug 'vim-scripts/listmaps.vim' ":Listmaps to list maps
Plug 'justinmk/vim-gtfo' "Opens the file manager or terminal at the directory of the current file in Vim. gof, goF
Plug 'christoomey/vim-tmux-navigator'
Plug 'airblade/vim-gitgutter' "
Plug 'morhetz/gruvbox'
Plug 'tpope/vim-markdown'
Plug 'tpope/vim-unimpaired' "[n ]n to jump between SCM errors
"Plug 'tmhedberg/SimpylFold'
Plug 'chrisbra/Recover.vim' "See a diff when recovering a file
Plug 'Valloric/ListToggle' "Toggle the location and quickfix lists, ,l or ,q
Plug 'rking/ag.vim' "Ag as a replacement for :grep
Plug 'airblade/vim-gitgutter' "
"Plug 'wting/gitsessions.vim'
Plug 'majutsushi/tagbar' " ctag outliner See (F8)
" Plug 'mattn/webapi-vim' | Plug 'mattn/gist.vim' "Create :Gist
Plug 'ConradIrwin/vim-bracketed-paste' " Autodetect pastes so you don't have to :set paste
" Source a .vimrc.local file if it exists. Allows for machine-local configuration
if filereadable(glob("~/.vimrc.local"))
source ~/.vimrc.local
call plug#end()
au BufRead,BufNewFile *.md set filetype=markdown
runtime plugin/dragvisuals.vim
vmap <expr> <LEFT> DVB_Drag('left')
vmap <expr> <RIGHT> DVB_Drag('right')
vmap <expr> <DOWN> DVB_Drag('down')
vmap <expr> <UP> DVB_Drag('up')
vmap <expr> D DVB_Duplicate()
" Remove any introduced trailing whitespace after moving... ##
let g:DVB_TrimWS = 1
set background=dark
" let g:solarized_visibility = "high"
" let g:solarized_contrast = "high"
let g:solarized_termcolors=256
"let g:solarized_termcolors=16
colorscheme gruvbox
let g:airline_powerline_fonts = 1
set laststatus=2
let g:airline_theme='gruvbox'
let g:airline#extensions#tabline#enabled = 1
let g:airline_section_y = 'r%{HGRev()}'
let g:airline#extensions#fugitive#enabled = 1
set guifont="Inconsolata\ for\ Powerline"
if v:version < 800
let g:syntastic_error_symbol = '✗'
let g:syntastic_warning_symbol = '!'
let g:airline#extensions#syntastic#enabled = 1
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '!'
let g:airline#extensions#ale#enabled = 1
" Gundo
let g:gundo_width = 25
let g:gundo_preview_bottom = 1
map <leader>vp :VimuxPromptCommand<CR>
map <leader>vl :VimuxRunLastCommand<CR>
map <leader>vi :VimuxInspectRunner<CR>
map <leader>vq :VimuxCloseRunner<CR>
"CtrlP functionality with Unite
nnoremap <C-p> :Unite file_rec/async<CR>
"File grepping
nnoremap <space>/ :Unite grep:.<CR>
"Search yank history
let g:unite_source_history_yank_enable = 1
nnoremap <space>y :Unite history/yank<CR>
"Find buffer
nnoremap <space>s :Unite -quick-match buffer<CR>
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
" mouse mode by default, F4 to toggle
" This is so we've got scrolling, but can also select to copy
" An alternative is to option/alt-select
"set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
function! ToggleMouse()
" check if mouse is enabled
if &mouse == 'a'
" disable mouse
set mouse=
" enable mouse everywhere
set mouse=a
set diffopt+=vertical
let g:lt_location_list_toggle_map = '<leader>l'
let g:lt_quickfix_list_toggle_map = '<leader>q'
"let g:lt_height = 10
"Uncomment this to start with Syntastic disabled
"let g:syntastic_mode_map = { 'mode': 'passive' }
set grepprg=ag\ --nogroup\ $*
nnoremap <leader>F :FZF<CR>
nnoremap <F2> :set nonumber!<CR>
map <F3> :NERDTreeToggle<CR>
nnoremap <F4> :call ToggleMouse()<CR>
nnoremap <F5> :GundoToggle<CR>
nnoremap <F6> :Gblame<CR>
if v:version < 800
nnoremap <F7> :SyntasticReset<CR>
nnoremap <F7> :AleReset<CR>
nmap <F8> :TagbarToggle<CR>
nmap <F9> :GitGutterSignsToggle<CR>
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
" Jump to next function, reposition to top of screen
map zT ]]+zt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment