Skip to content

Instantly share code, notes, and snippets.

@zerowidth zerowidth/.profile
Created Dec 24, 2008

What would you like to do?
function d() {
if [ -n "$1" ]; then
if [ -d "$1" ]; then
pushd $1 >/dev/null
mvim -c :NT
popd >/dev/null
echo "$1 is not a directory"
echo "specify a directory to edit"
alias e='mvim'
alias sp='spec -cfs -Du'
alias spb='spec -bcfs -Du'
source ~/.vim/vimrc
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 twilight2
colorscheme vibrantink
" size the window so it fills the macbook screen
set columns=181
set lines=53
set gfn=Andale_Mono:h12
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 StripTrailingSpaces :%s/\s\+$//g
command Tr :StripTrailingSpaces
" 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'
" 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
" crossed left border?
if (nr < 0)
let nr = size-1
" crossed right border?
elseif (nr == size)
let nr = 0
" fire move command
exec 'tabm'.nr
" 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
" autocmd BufWritePost .vimrc source %
" from / evan phoenix
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
return "\<C-N>"
inoremap <Tab> <C-R>=CleverTab()<CR>
" from atmos
nnoremap <D-r> :NERDTreeToggle<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 for more info
" from
" 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.