Skip to content

Instantly share code, notes, and snippets.

@kennyp
Created August 19, 2014 17:37
Show Gist options
  • Save kennyp/90aa724f85e016ec3999 to your computer and use it in GitHub Desktop.
Save kennyp/90aa724f85e016ec3999 to your computer and use it in GitHub Desktop.
" Notes {
" vim: set foldmarker={,} foldlevel=0 spell:
"
" Kenny Parnell <k.parnell@gmail.com>
" }
" General {
execute pathogen#infect()
set background=dark
set cmdheight=2
set expandtab
set hlsearch
set incsearch
set laststatus=2
set encoding=utf-8
set lazyredraw
set listchars=eol:$,tab:>-,trail:.,extends:<,precedes:>
set mouse=a
set number
set ruler
set rulerformat=%25(%n%m%r:\ %Y\ [%l,%v]\ %p%%%)
set shiftwidth=4
set showtabline=2
set smartindent
set smarttab
set ignorecase
set smartcase
set tabstop=4
set title titlestring=%<%t%m%=%l/%L-%P titlelen=70
set ttyfast " As fast as you can
set vb t_vb= " No beep or flash
set wildmenu
set wildmode=list:longest,full
set nocursorline
set hidden
let mapleader=","
if v:version >= 703
set undofile
set undodir=~/.vim/undo
endif
" }
" Folding {
set foldcolumn=3
set foldenable
set foldlevel=3
set foldminlines=2
" }
" Memory {
set history=1000
set maxmem=2000000
set maxmempattern=2000000
set maxmemtot=2000000
" }
" Programming {
set nocompatible " We're running Vim no Vi!
set runtimepath+=/usr/local/go/misc/vim
syntax on " Enable syntax highlighting
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
set tags+=tags;
colorscheme vividchalk
" }
" Autocommands {
" Vim
au BufRead,BufNewFile .vimrc set foldmethod=marker
au BufRead,BufNewFile *.vim set foldmethod=marker
" Mutt
au BufRead,BufNewFile /tmp/mutt* source ~/.vim/rc/mutt.vim
au BufRead,BufNewFile /var/tmp/mutt* source ~/.vim/rc/mutt.vim
" Markdown
au BufRead,BufNewFile *.md set ft=markdown
" Slim
au BufRead,BufNewFile *.slim set ft=slim
" Ruby
au FileType ruby,eruby,rspec set sw=2 ts=2 cc=80 et
au FileType ruby,eruby,rspec hi ColorColumn ctermbg=darkgray
au BufRead,BufNewFile *.erb.deface set ft=html.eruby
au BufRead,BufNewFile *.haml.deface set ft=haml
" XML
au BufRead,BufNewFile *.xml nmap <buffer> <silent> <leader>fm :%!xmllint --format -<cr>ggdd
au BufRead,BufNewFile *.xml set nowrap
" SVG
au BufRead,BufNewFile *.svg nmap <buffer> <silent> <leader>fm :%!xmllint --format -<cr>ggdd
au BufRead,BufNewFile *.svg set nowrap
" JSON
au BufRead,BufNewFile *.json set nowrap
" BGScript
au BufRead,BufNewFile *.bgs set ft=bgscript ts=2 sw=2 et
" }
" Maps {
" Copy and paste using external clipboard
vmap <silent> <Leader>y "+y
vmap <silent> <Leader>Y "+Y
nmap <silent> <Leader>p :set paste<CR>"+p:set nopaste<CR>
vmap <silent> <Leader>p x:set paste<CR>"+p:set nopaste<CR>
nmap <silent> <Leader>P :set paste<CR>"+P:set nopaste<CR>
vmap <silent> <Leader>P x:set paste<CR>"+P:set nopaste<CR>
" Work the arrow keys
nmap <Left> :tabp<CR>
nmap <Right> :tabn<CR>
vmap <Left> <ESC>:tabp<CR>
imap <Right> <ESC>:tabn<CR>
imap <Left> <ESC>:tabp<CR>
vmap <Right> <ESC>:tabn<CR>
" Make parent dirs for current file
map <Leader>md <ESC>:!mkdir %:p:h<CR>
" Git shortcuts
nmap <silent> <leader>gl :!git log -p %<cr>
" }
" Functions {
command -nargs=+ Git :!git <args>
" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment