Created
February 7, 2013 20:10
-
-
Save gilligan/4733763 to your computer and use it in GitHub Desktop.
mlafeldt vimrc fiddling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Based on Gary Bernhardt's .vimrc file: | |
" https://github.com/garybernhardt/dotfiles/blob/master/.vimrc | |
" vim: set ts=2 sts=2 sw=2 expandtab: | |
" | |
" global settings {{{ | |
" | |
" enter vim mode | |
set nocompatible | |
" allow unsaved background buffers and remember marks/undo for them | |
set hidden | |
" remember more commands and searches | |
set history=10000 | |
" always show status line | |
set laststatus=2 | |
" when a bracket is inserted, briefly jump to the matching one | |
set showmatch | |
" incremental search | |
set incsearch | |
" highlight previous search matches | |
"set hlsearch | |
" make searches case-sensitive only if they contain upper-case characters | |
set ignorecase smartcase | |
" highlight current line | |
set cursorline | |
" height of command line | |
set cmdheight=2 | |
" jump to the first open window that contains the specified buffer | |
set switchbuf=useopen | |
" show line numbers | |
set number | |
" minimal number of columns to use for the line number | |
set numberwidth=5 | |
" always show tab page labels | |
set showtabline=2 | |
" minimal number of columns for current window | |
set winwidth=79 | |
" prevent vim from clobbering the scrollback buffer | |
"set t_ti= t_te= | |
" keep more context when scrolling off the end of a buffer | |
set scrolloff=3 | |
" store temporary files in a central spot | |
set backup | |
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
" allow backspacing over everything in insert mode | |
set backspace=indent,eol,start | |
" display incomplete commands | |
set showcmd | |
" enable syntax highlighting | |
syntax on | |
" use emacs-style tab completion when selecting files etc. | |
set wildmode=longest,list | |
" make tab completion for files/buffers act like bash | |
set wildmenu | |
" set leader key to comma | |
let mapleader="," | |
" show line and column number of the cursor position | |
set ruler | |
" highlight screen column | |
set colorcolumn=81 | |
" set solarized background | |
set background=dark | |
" set minimal window height | |
set wmh=0 | |
" no annoying error bells | |
set noerrorbells | |
set t_vb= | |
" disable gui elements | |
set guioptions-=r " disable gui stuff | |
set guioptions-=T " disable gui stuff | |
set guioptions-=m " disable gui stuff | |
set guioptions-=l " disable gui stuff | |
set guioptions-=L " disable gui stuff | |
set nobackup " no useless backup files | |
" clipboard = unnamed reg for easy interaction | |
set clipboard=unnamed | |
" always be greedy | |
set gdefault | |
" hint at matching bracket | |
set showmatch | |
" | |
" global settings }}} | |
" | |
" | |
" colors and font {{{ | |
" | |
if has('unix') | |
let s:uname = system('uname') | |
if s:uname == "Darwin\n" | |
" OSX-specific options | |
colorscheme solarized | |
set guifont=SourceCodePro-Regular:h12 | |
else | |
set guifont=SourceCodePro | |
endif | |
endif | |
" | |
" colors and font }}} | |
" | |
" | |
" mappings {{{ | |
" | |
if has('gui_running') | |
colorscheme solarized | |
" show whitespace characters | |
set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮ | |
" hide toolbar | |
:set guioptions-=T | |
" make ctrl+c and ctrl+v to copy and paste | |
nmap <C-S-V> "+gP | |
imap <C-S-V> <ESC><C-S-V>i | |
vmap <C-S-C> "+y | |
endif | |
" open files in directory of current file | |
cnoremap %% <C-R>=expand('%:h').'/'<cr> | |
map <leader>e :edit %% | |
map <leader>v :view %% | |
" toggle files | |
nnoremap <leader><leader> <c-^> | |
" show cword matches and offer jump | |
map ,l [I:let nr = input("select: ")<Bar>exe "normal " . nr ."[\t"<CR> | |
" show number of cword occurrances | |
map ,L :execute ":%s@\\<" . expand("<cword>") . "\\>\@&@gn"<CR> | |
" stay on the home row | |
map <Up> <NOP> | |
map <Down> <NOP> | |
map <Left> <NOP> | |
map <Right> <NOP> | |
" | |
" mappings }}} | |
" | |
" | |
" command-t plugin {{{ | |
" | |
set ttimeoutlen=50 | |
if &term =~ "xterm" || &term =~ "screen" | |
let g:CommandTCancelMap = ['<ESC>', '<C-c>'] | |
let g:CommandTSelectNextMap = ['<C-n>', '<C-j>', '<ESC>OB'] | |
let g:CommandTSelectPrevMap = ['<C-p>', '<C-k>', '<ESC>OA'] | |
endif | |
map <leader>f :CommandTFlush<cr>\|:CommandT<cr> | |
map <leader>F :CommandTFlush<cr>\|:CommandT %%<cr> | |
map <leader>b :CommandTBuffer<cr> | |
" | |
" }}} | |
" | |
" | |
" filetype settings {{{ | |
" | |
autocmd FileType * set tabstop=4|set shiftwidth=4|set expandtab | |
autocmd FileType sh,perl,awk,python set tabstop=4|set shiftwidth=4|set expandtab|set smartindent | |
autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab|set smartindent | |
autocmd FileType c,h,cpp set tabstop=8|set shiftwidth=8|set noexpandtab|set cindent | |
autocmd FileType make set tabstop=8|set shiftwidth=8|set noexpandtab | |
autocmd FileType asm set tabstop=8|set shiftwidth=8|set noexpandtab | |
" | |
" }}} | |
" | |
" | |
" add local settings | |
" | |
if filereadable(expand('~/.vimrc.local')) | |
so expand('~/.vimrc.local') | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment