Skip to content

Instantly share code, notes, and snippets.

@roelbondoc
Created July 6, 2011 14:20
Show Gist options
  • Save roelbondoc/1067332 to your computer and use it in GitHub Desktop.
Save roelbondoc/1067332 to your computer and use it in GitHub Desktop.
roelbondoc's vimrc
set nocompatible " use vim defaults
set et
set sw=2
set ts=2
set smarttab
set scrolloff=3 " keep 3 lines when scrolling
set cindent " cindent
set smartindent " smart indent
set autoindent " always set autoindenting on
set showcmd " display incomplete commands
set hlsearch " highlight searches
set incsearch " do incremental searching
set ruler " show the cursor position all the time
"set number " show line numbers
set ignorecase " ignore case when searching
set ttyfast " smoother changes
set wildmenu
set nocursorline
"set background=dark
"colorscheme solarized
set autoread
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=1
set nowrap
set statusline=%t "tail of the filename
set statusline+=%h "help file flag
set statusline+=%m "modified flag
set statusline+=%r "read only flag
set statusline+=%y "filetype
set statusline+=%{fugitive#statusline()}
set statusline+=%= "left/right separator
set statusline+=%c, "cursor column
set statusline+=%l/%L "cursor line/total lines
set statusline+=\ %P "percent through file
set laststatus=2
let mapleader = ","
let g:project_dir = expand("%:p:h")
let g:netrw_cursorline=0
filetype on
syntax on
function! CHANGE_CURR_DIR()
exec "cd " . g:project_dir
let _dir = expand("%:p:h")
exec "cd " . _dir
unlet _dir
endfunction
autocmd BufEnter * call CHANGE_CURR_DIR()
let g:SaveUndoLevels = &undolevels
let g:BufSizeThreshold = 1000000
if has("autocmd")
" Store preferred undo levels
au VimEnter * let g:SaveUndoLevels = &undolevels
" Don't use a swap file for big files
au BufReadPre * if getfsize(expand("<afile>")) >= g:BufSizeThreshold | setlocal noswapfile | endif
" Upon entering a buffer, set or restore the number of undo levels
au BufEnter * if getfsize(expand("<afile>")) < g:BufSizeThreshold | let &undolevels=g:SaveUndoLevels | hi Cursor term=reverse ctermbg=black guibg=black | else | set undolevels=-1 | hi Cursor term=underline ctermbg=red guibg=red | endif
endif
autocmd BufNewFile,BufRead *.thor set syntax=ruby
autocmd BufNewFile,BufRead Gemfile set syntax=ruby
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment