Skip to content

Instantly share code, notes, and snippets.

@cloud8421
Created January 7, 2012 12:31
Show Gist options
  • Save cloud8421/1574640 to your computer and use it in GitHub Desktop.
Save cloud8421/1574640 to your computer and use it in GitHub Desktop.
Minimal .vimrc configuration for server use
set nocompatible " Use Vim settings, rather then Vi settings
set nobackup
set nowritebackup
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set expandtab
" Display extra whitespace
set list listchars=tab:»·,trail:·
highlight NonText guibg=#060606
highlight Folded guibg=#0A0A0A guifg=#9090D0
" Numbers
set number
set numberwidth=5
" Folding
set foldmethod=syntax
set foldlevelstart=99
set wildmode=list:longest,list:full
set complete=.,w,d,i,t
"Saves time; maps the spacebar to colon
nmap <space> :
"Bubble single lines (kicks butt)
"http://vimcasts.org/episodes/bubbling-text/
nmap <C-Up> ddkP
nmap <C-Down> ddp
"Bubble multiple lines
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
"whitespace
autocmd BufRead * silent! %s/[\r \t]\+$//
autocmd BufEnter *.rb :%s/[ \t\r]\+$//e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment