Skip to content

Instantly share code, notes, and snippets.

@grahamg
Last active October 14, 2016 14:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamg/8fdba23361bd43e28f77 to your computer and use it in GitHub Desktop.
Save grahamg/8fdba23361bd43e28f77 to your computer and use it in GitHub Desktop.
Vim Configuration
" Use Vim settings rather than Vi settings
" Required to be at the beginning of file
set nocompatible
" Required
filetype off
" Turn on syntax highlighting
syntax on
" Buffers can exist in the background without being in
" a window. http://items.sjbach.com/319/configuring-vim-right
set hidden
" ============= General Configuration ================
set number
set backspace=indent,eol,start
set history=3000
set showcmd
set showmode
set mouse=a
set expandtab
set list
set pastetoggle=<F2>
set cursorline
set visualbell
set autoread
" ================ Turn Off Swap Files ==============
set noswapfile
set nobackup
set nowb
" ================ Search ===========================
set incsearch " Find the next match as we type the search
set hlsearch " Highlight searches by default
set ignorecase " Ignore case when searching...
set smartcase " ...unless we type a capital
" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
if has('persistent_undo') && !isdirectory(expand('~').'/.vim/backups')
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
endif
" ================ Indentation ======================
set autoindent
set smartindent
set smarttab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
" Auto indent pasted text
nnoremap p p=`]<C-o>
nnoremap P P=`]<C-o>
filetype plugin on
filetype indent on
" Display tabs and trailing spaces visually
set listchars=tab:>.,trail:.,extends:#,nbsp:.
autocmd filetype html,xml set listchars-=tab:>.
set nowrap "Don't wrap lines
set linebreak "Wrap lines at convenient points
" ================ Folds ============================
set foldmethod=indent "fold based on indent
set foldnestmax=1 "deepest fold is a single level
set nofoldenable "dont fold by default
" ================ Disable Ex Mode ==================
noremap Q <nop>
" ================ Disable Etc, remap to jk =========
noremap jk <esc>
noremap <esc> <nop>
" ================ Disable arrow keys ===============
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
" ================ Scrolling ========================
set scrolloff=8 "Start scrolling when we're 8 lines away from margins
set sidescrolloff=15
set sidescroll=1
" ================ Search ===========================
set incsearch " Find the next match as we type the search
set hlsearch " Highlight searches by default
set ignorecase " Ignore case when searching...
set smartcase " ...unless we type a capital
"================ Vundle Modules ======================
" Set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tomtom/tcomment_vim'
Plugin 'kristijanhusak/vim-multiple-cursors'
Plugin 'justinmk/vim-sneak'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-session'
Plugin 'jiangmiao/auto-pairs'
Plugin 'sjl/gundo.vim'
Plugin 'wincent/command-t'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'dkprice/vim-easygrep'
Plugin 'junegunn/goyo.vim'
Plugin 'rking/ag.vim'
Plugin 'majutsushi/tagbar'
Plugin 'tpope/vim-fugitive'
Plugin 'joonty/vdebug'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'powerline/powerline'
Plugin 'airblade/vim-gitgutter'
Plugin 'schickling/vim-bufonly'
Plugin 'vim-scripts/activity-log'
Plugin 'vim-scripts/a.vim'
call vundle#end() " required
"================ Toggle Keymaps ======================
:nmap \f zi<CR>
:nmap \e :NERDTreeToggle<CR>
:nmap \t :TagbarToggle<CR>
:nmap \g :GundoToggle<CR>
:nmap \b :Bufonly<CR>
:nmap \o :Goyo<CR>
filetype plugin indent on " required
let g:indentLine_color_term = 239
let g:indentLine_color_tty_light = 7 " (default: 4)
let g:indentLine_color_dark = 1 " (default: 2)
let g:session_autosave = 'no'
autocmd VimEnter * if !argc() | NERDTree | endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment