Skip to content

Instantly share code, notes, and snippets.

@roelbondoc
Created February 7, 2011 20:24
Show Gist options
  • Save roelbondoc/815113 to your computer and use it in GitHub Desktop.
Save roelbondoc/815113 to your computer and use it in GitHub Desktop.
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 cursorline
set background=light
"colorscheme ir_black
set autoread
filetype on
syntax on
function! CHANGE_CURR_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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment