Skip to content

Instantly share code, notes, and snippets.

@kwstannard
Created October 5, 2012 17:29
Show Gist options
  • Save kwstannard/3841171 to your computer and use it in GitHub Desktop.
Save kwstannard/3841171 to your computer and use it in GitHub Desktop.
vimrc
colorscheme camo
set nocompatible
set background=dark
set noautoindent smartindent
set expandtab
set softtabstop=2
set shiftwidth=2
set hlsearch " highlight search results
set nowrap " don't wrap lines
set title
set ch=1 " make command line one line
set mousehide " hide the mouse when typing text
set guioptions-=T " no toolbar
set guioptions-=m " no menu
set ignorecase " ignore case when searching
set smartcase " only ignore case for lower case searches
set wildmenu " show menu with possible tab completions
set backspace=indent,eol,start
set mouse=a
set number
set numberwidth=4
set scrolloff=2
"puts temp files in temp directory
if has("win32") || has("win64")
set directory=$TMP
else
set directory=/tmp
end
let g:solarized_termcolor=256
filetype plugin indent on " language specific indent rules
syntax on " syntax highlighting on
" block select commenting & uncommenting
map ,c :s/^/#/<CR>:nohlsearch<CR>
map ,u :s/^\/\/\\|^--\\|^[#]//<CR>:nohlsearch<CR>
"folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i use
" clear highlighted search
nnoremap <F3> :noh<return><esc>
" movement key rebindings
nnoremap j k
nnoremap k j
nnoremap h :
nnoremap ; l
nnoremap l h
vnoremap j k
vnoremap k j
vnoremap ; l
vnoremap l h
" return to normal mode
inoremap kj <Esc>
inoremap jk <Esc>
" kill from cursor to line
inoremap <C-k> <Esc><right>d$a
" paste from buffer
inoremap <C-y> <Esc>pi
" save file
inoremap <C-s> <Esc>:w<cr>i
" move to end of line
inoremap <C-e> <Esc>$a
" move to start of line
inoremap <C-a> <Esc>==i
"save file
inoremap hw <Esc>:w<Cr>i
"delete last word
inoremap <A-BS> <Esc><right>dbi
"delete next word
inoremap <A-d> <Esc><right>dwi
" move right one word, doesn't work
inoremap <C-;> <C-right>
inoremap <C-l> <C-left>
inoremap <A-l> <left>
inoremap <A-;> <right>
inoremap <A-j> <up>
inoremap <A-k> <down>
"shift space is underscore
inoremap <S-space> _
"replace shift with alt for right hand side stuff
inoremap <A-'> "
inoremap <A-.> >
inoremap <A-,> <
inoremap <A-/> ?
inoremap <A-[> {
inoremap <A-]> }
nnoremap <C-k> d$
nnoremap <Cr> o
nnoremap <S-CR> O
nnoremap <BS> i<BS>
" window switching controls
nnoremap <C-w>j <C-w><up>
nnoremap <C-w>k <C-w><down>
nnoremap <C-w>l <C-w><left>
nnoremap <C-w>; <C-w><right>
" tab switching
nnoremap <A-left> gT
nnoremap <A-right> gt
nnoremap <C-t> :tabnew<Cr>
" clear all buffers
nnoremap <C-delete> :bufdo<space>bd<Cr>
" copy to end of line
nnoremap Y y$
nnoremap <C-backspace> :%s/\s\+$//g<Cr>
nnoremap hw :wa<Cr>
"new test method
nnoremap <C-n>t o<Cr>it "should " do<Cr><Cr>end<Esc><up><up><C-right><C-right>i
"refactor code
vnoremap pri direffunc<Esc>G?def<Cr>/ end\n/+1<Cr>O<Cr>def reffunc<Cr><Esc>poend<Esc><S-v>?def<Cr>=''
"show syntax highlighting groups for word under cursor
nnoremap <C-S-P> :call <SID>SynStack()<Cr>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunction
highlight LongLines guibg=#333300
au BufWinEnter * call matchadd('LongLines', '^.\{80,119}$', -1)
highlight VeryLongLines guibg=#330000
au BufWinEnter * call matchadd('VeryLongLines', '^.\{120,}$', -1)
highlight Indent9 guibg=#645640
au BufWinEnter * call matchadd('Indent9', '^\s\{20}\&^\s\{17}', -1)
highlight Indent8 guibg=#564832
au BufWinEnter * call matchadd('Indent8', '^\s\{18}\&^\s\{15}', -1)
highlight Indent7 guibg=#484024
au BufWinEnter * call matchadd('Indent7', '^\s\{16}\&^\s\{13}', -1)
highlight Indent6 guibg=#646452
au BufWinEnter * call matchadd('Indent6', '^\s\{14}\&^\s\{11}', -1)
highlight Indent5 guibg=#565644
au BufWinEnter * call matchadd('Indent5', '^\s\{12}\&^\s\{9}', -1)
highlight Indent4 guibg=#484834
au BufWinEnter * call matchadd('Indent4', '^\s\{10}\&^\s\{7}', -1)
highlight Indent3 guibg=#565656
au BufWinEnter * call matchadd('Indent3', '^\s\{8}\&^\s\{5}', -1)
highlight Indent2 guibg=#484848
au BufWinEnter * call matchadd('Indent2', '^\s\{6}\&^\s\{3}', -1)
highlight Indent1 guibg=#404040
au BufWinEnter * call matchadd('Indent1', '^\s\{4}\&^\s\{1}', -1)
highlight RedundantSpaces guibg=red
au BufWinEnter * call matchadd('RedundantSpaces', '\s\+$', -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment