Skip to content

Instantly share code, notes, and snippets.

@zerowidth
Created September 1, 2009 23:13
Show Gist options
  • Save zerowidth/179452 to your computer and use it in GitHub Desktop.
Save zerowidth/179452 to your computer and use it in GitHub Desktop.
" size the window so it fills the macbook screen
set columns=181
set lines=53
set gfn=Andale_Mono:h12
" colorscheme twilight2
colorscheme vibrantink
set transparency=5
source ~/.vim/vimrc
command W w !sudo tee % > /dev/null
let g:NERDTreeMapOpenSplit = 'i'
let g:fuzzy_ignore = "gems*;pkg/*"
let g:NERDSpaceDelims = 1
let NERDTreeChDirMode=2 " auto-change CWD when changing tree root
command -n=? -complete=dir NT NERDTreeToggle <args>
" TODO look up "local leader" for setting up custom local leader
colorscheme desert
" colorscheme vibrantink
" set listchars=tab:▷⋅,trail:⋅,nbsp:⋅
set listchars=tab:⋅⋅,trail:⋅,nbsp:⋅
set directory=~/.vimswap
" set nobackup
set noswapfile
set tabstop=2
set softtabstop=2
set shiftwidth=2
syntax on
set go-=T " disable the toolbars in macvim
set go-=r " disable right-hand scrollbar
set go-=L " disable left-hand scrollbar
" set go-=e " disable graphical tabs
set winheight=10 " current window is a nice height always
set winminheight=3 " but the other windows aren't *too* small
set number
command Tr %s/\s\+$//ge | %s/\t/ /ge | nohls
" from http://github.com/enriquez/bringing-vim-to-the-people/commit/33eda98452c9b070a24ecfaa35cb2e5b6dfc9cba
command FFR ruby @finder = nil
" set up word wrap stuff
set wrap
set linebreak
set textwidth=120
" set wrapmargin=120
" tab mojo from ara
" this lets 'tt' toggle between tabs
let g:tabno=tabpagenr()
au TabLeave * :let g:tabno = tabpagenr()
" map tt :exec 'normal !'.g:tabno.'gt'<cr>
" map 'tn' to tabnext - a count is relative from current pos
function TabNext()
exec 'tabn'
endfunction
" map tn :call TabNext()<CR>
" map <C-J> <C-W>j<C-W>_
" map <C-K> <C-W>k<C-W>_
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-h> <C-w>h
map <C-l> <C-w>l
map <C-_> <C-w>_
map <D-j> gt
map <D-k> gT
map <C-Left> :call TabMove(1)<CR>
map <C-Right> :call TabMove(0)<CR>
" map 'tg' to 'tab go' - this is an absolute tab number and quite useful with 'tt'
" map tg gt
" map <C-j> gt
" map 'tp' to 'tab previous'
" map tp gT
" map <C-k> gT
" ctrl-j and ctrl-k move tabs left(j)/right(k)
" map <C-h> :call TabMove(1)<CR>
" map <C-j> :call TabMove(1)<CR>
" map <C-k> :call TabMove(0)<CR>
" map <C-l> :call TabMove(0)<CR>
function TabMove(n)
let nr = tabpagenr()
let size = tabpagenr('$')
" do we want to go left?
if (a:n != 0)
let nr = nr - 2
endif
" crossed left border?
if (nr < 0)
let nr = size-1
" crossed right border?
elseif (nr == size)
let nr = 0
endif
" fire move command
exec 'tabm'.nr
endfunction
" settings from jeremy
" wildmatching
" set wildmode=list:longest " make cmdline tab completion similar to bash
" set wildmenu " enable ctrl-n and ctrl-p to scroll through matches
" set wildignore=*.o,*.obj,*~
"
" completion additions.
" set popumen to display longest match on popup even if only one match
" set completeopt=menuone,longest
" from http://vim.wikia.com/wiki/Change_vimrc_with_auto_reload
" autocmd BufWritePost .vimrc source %
" from http://pastie.org/359759 / evan phoenix
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-N>"
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>
" from atmos
nnoremap <D-r> :NERDTreeToggle<CR>
nnoremap <D-R> :NERDTreeFind<CR>
" redraw the screen
nnoremap <D-l> :nohlsearch<CR>
inoremap <D-l> <C-O>:nohlsearch<CR>
" formatoptions get overridden by the ftplugin stuff built-ins
" see http://peox.net/articles/vimconfig.html for more info
" from http://www.oreillynet.com/onlamp/blog/2005/07/vim_its_slim_and_trim_heres_wh.html
" function ClosePair(char)
" if getline('.')[col('.') - 1] == a:char
" return "\<Right>"
" else
" return a:char
" endif
" endf
" inoremap ( ()<ESC>i
" inoremap ) <C-R>=ClosePair(')')<CR>
" inoremap { {}<ESC>i
" inoremap } <C-R>=ClosePair('}')<CR>
" inoremap [ []<ESC>i
" inoremap ] <C-R>=ClosePair(']')<CR>
" http://www.omnigroup.com/mailman/archive/macosx-admin/2004-June/047237.html
autocmd FileType crontab :set backupcopy=yes
" http://vim.wikia.com/wiki/Disable_F1_built-in_help_key
nmap <F1> :echo<CR>
imap <F1> <C-o>:echo<CR>
" auto-reload any file modified outside vim
set autoread
" but from http://old.nabble.com/Automatically-reload-file-on-change-td15247242.html
" it's possible to set a group instead, e.g. for log files
" augroup vimrcAu
" au!
" au BufEnter,BufNew Test.log setlocal autoread
" augroup END
set tags=./tags,tags
command Rescan :ruby finder.rescan!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment