Skip to content

Instantly share code, notes, and snippets.

@icorbrey
Created June 18, 2020 17:01
Show Gist options
  • Save icorbrey/582fd02a57c12e2ac6d66a8eeb560d4f to your computer and use it in GitHub Desktop.
Save icorbrey/582fd02a57c12e2ac6d66a8eeb560d4f to your computer and use it in GitHub Desktop.
My Vim configuration file!
set nocompatible
filetype off
set encoding=utf-8
" Initialize Vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Let Vundle manage itself
Plugin 'VundleVim/Vundle.vim'
" Install Plugins
Plugin 'ervandew/supertab'
Plugin 'gruvbox-community/gruvbox'
Plugin 'jiangmiao/auto-pairs'
Plugin 'junegunn/gv.vim'
Plugin 'mhinz/vim-signify'
Plugin 'ryanoasis/vim-devicons'
Plugin 'scrooloose/nerdtree'
Plugin 'sheerun/vim-polyglot'
Plugin 'SirVer/ultisnips'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" Finalize Vundle
call vundle#end()
filetype plugin indent on
" Use the mouse
set mouse=a
" Set update time for diff checking
set updatetime=100
" Move lines with Ctrl+Up/Down
nnoremap <silent> <C-Up> :move-2<CR>==
nnoremap <silent> <C-Down> :move+<CR>==
inoremap <silent> <C-Up> <ESC>:move-2<CR>==gi
inoremap <silent> <C-Down> <ESC>:move+<CR>==gi
vnoremap <silent> <C-Up> :move '<-2<CR>gv=gv
vnoremap <silent> <C-Down> :move '>+1<CR>gv=gv
" Comment/uncomment code with Ctrl+/
nnoremap <silent> <C-_> :Commentary<CR>
inoremap <silent> <C-_> <ESC>:Commentary<CR>gi
vnoremap <silent> <C-_> :'<,'>Commentary<CR>gv
" Use hard tabs at 4 spaces
set autoindent
set noexpandtab
set tabstop=4
set shiftwidth=4
set listchars=tab:\|\
set list
" Gruvbox!
syntax on
colorscheme gruvbox
set background=dark
" Other visual configuration
set title
set wildmenu
set wildmode=list:longest,full
" Display line numbers
set number
set cursorline
" Backups are for those who make mistakes
set nobackup
set nowritebackup
set noswapfile
" Make snippets navigate using Tab
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsSnippetDirectories=["~/.snippets"]
" Make NERDTree show up when I want it to
autocmd vimenter * NERDTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Airline should look pretty
let g:airline_powerline_fonts=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment