Skip to content

Instantly share code, notes, and snippets.

@wycats
Created August 8, 2010 17:19
Show Gist options
  • Save wycats/514291 to your computer and use it in GitHub Desktop.
Save wycats/514291 to your computer and use it in GitHub Desktop.
set nocompatible
set number
set ruler
syntax on
" Whitespace stuff
set nowrap
set tabstop=2
set shiftwidth=2
set expandtab
set list listchars=tab:\|_,trail:.
" Indenting
filetype plugin indent on
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
" Tab completion
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc
" Status bar
set laststatus=2
" NERDTree configuration
let NERDTreeIgnore=['\.rbc$', '\~$']
" CTags
map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
" make and python use real tabs
autocmd FileType make set noexpandtab
autocmd FileType python set noexpandtab
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" load the plugin and indent settings for the detected filetype
filetype plugin indent on
" Opens an edit command with the path of the currently edited file filled in
" Normal mode: <Leader>e
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" Opens a tab edit command with the path of the currently edited file filled in
" Normal mode: <Leader>t
map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
" Inserts the path of the currently edited file into a command
" Command mode: Ctrl+P
cmap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
function ChangeDirectory(dir)
execute "cd " . a:dir
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
NERDTree
wincmd p
endif
endif
endfunction
command -nargs=1 -complete=file ChangeDir :call ChangeDirectory(<f-args>)
cabbrev cd <c-r>=(getcmdtype()==':' && getcmdpos()==1 ? 'ChangeDir' : 'cd')<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment