Skip to content

Instantly share code, notes, and snippets.

@smbambling
Created November 24, 2015 19:33
Show Gist options
  • Save smbambling/e1600a0f640c6a637a71 to your computer and use it in GitHub Desktop.
Save smbambling/e1600a0f640c6a637a71 to your computer and use it in GitHub Desktop.
Bambling .vimrc
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible " be iMproved, required
filetype off " required
" ================ General Config ====================
set number "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
set history=1000 "Store lots of :cmdline history
set showcmd "Show incomplete cmds down the bottom
set showmode "Show current mode down the bottom
set gcr=a:blinkon0 "Disable cursor blink
set visualbell "No sounds
set autoread "Reload files changed outside vim
" This makes vim act like all other editors, buffers can
" exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
" set hidden
" =============== Vundle Initialization ===============
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-markdown'
Plugin 'tpope/vim-sensible'
Plugin 'rodjek/vim-puppet'
Plugin 'tpope/vim-surround'
Plugin 'honza/vim-snippets'
Plugin 'SirVer/ultisnips'
Plugin 'tpope/vim-fugitive'
Plugin 'JamshedVesuna/vim-markdown-preview'
Plugin 'easymotion/vim-easymotion'
Plugin 'nathanaelkane/vim-indent-guides'
call vundle#end() " required
filetype plugin indent on " required
" ================ 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=2
set softtabstop=2
set tabstop=2
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 list listchars=tab:\ \ ,trail:·
set nowrap "Don't wrap lines
set linebreak "Wrap lines at convenient points
" ============== Indent Guides ======================
" Indent Guides - https://github.com/nathanaelkane/vim-indent-guides
let g:indent_guides_enable_on_vim_startup = 1 " Force indent-guides to load
let g:indent_guides_guide_size = 1 " Change the width
" ============== Splits ===============
" remap to user (-,_) and (\,|)
nnoremap <C-_> <C-W><C-S>
nnoremap <C-\> <C-W><C-V>
set splitbelow
set splitright
" =============== Things and Stuff ==================
" Setup spelling +
set spell spelllang=en_us
set complete+=kspell " Spelling + Autocomplete
" Set Shell
set shell=/bin/bash
" ================ Folds ============================
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "don't fold by default
set foldlevel=1 "this is just what i use
" Set 'SPACE' to open and close folds
nnoremap <space> za
" ================ Powerline ========================
source /Library/Python/2.7/site-packages/powerline/bindings/vim/plugin/powerline.vim
" ================ 'GUI' Settings ===================
" Set Font
set guifont=Hack:h12
" Send more characters for redraws
set ttyfast
" Enable mouse use in all modes
"if has("mouse")
" set mouse=a
"endif
" ================ Markdown Preview =================
let vim_markdown_preview_toggle=0
let vim_markdown_preview_temp_file=1
" ================ YouCompleteMe ====================
" Better key bindings for UltiSnipsExpandTrigger using a key other than return
" to expand snippets conflicts with my muscle memory
let g:UltiSnipsExpandTrigger = "<nop>"
let g:ulti_expand_or_jump_res = 0
function ExpandSnippetOrCarriageReturn()
let snippet = UltiSnips#ExpandSnippetOrJump()
if g:ulti_expand_or_jump_res > 0
return snippet
else
return "\<CR>"
endif
endfunction
inoremap <expr> <CR> pumvisible() ? "<C-R>=ExpandSnippetOrCarriageReturn()<CR>" : "\<CR>"
" ================ EasyMotion ======================
let g:EasyMotion_do_mapping = 0 " Disable default mappings
" Bi-directional find motion
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
nmap \ <Plug>(easymotion-s)
" or
" `s{char}{char}{label}`
" Need one more keystroke, but on average, it may be more comfortable.
nmap \\ <Plug>(easymotion-s2)
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment