Skip to content

Instantly share code, notes, and snippets.

@panterch
Created December 22, 2008 11:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panterch/38961 to your computer and use it in GitHub Desktop.
Save panterch/38961 to your computer and use it in GitHub Desktop.
vimrc
" gui settings
set noanti guifont=Monaco:h10
set transparency=0
colorscheme macvim
set background=dark
" no toolbar in guimode
set guioptions-=T
if has("gui_macvim")
macmenu &File.New\ Tab key=<nop>
map <D-t> :CommandT<CR>
endif
set fileencodings=ucs-bom,utf-8,latin1
set encoding=utf-8
syntax on
" * UI settings
"colorscheme default
" term.app is white, makes especially comments readable (dark)
"set background=dark
" display the current mode and partially-typed commands in the status line:
set showmode
set showcmd
" have the mouse enabled all the time
" set mouse=a
" show line numbers
" set number
" only use visual bell
set noeb vb
" gui settings
" set noanti guifont=Monaco:h10
" a status line
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%04l,%04v]\ [LEN=%L]
set laststatus=2
" * Search & Replace
" show the `best match so far' as search strings are typed:
set incsearch
" highlight search result
set hls
" assume the /g flag on :s substitutions to replace all matches in a line:
set gdefault
" * Text Fromatting
" most copied from http://www.vex.net/~x/python_and_vim.html
" don't make it look like there are line breaks where there aren't:
set nowrap
" A four^H^H^H^Htwo-space indent width is the prefered coding style for
" Python^H^H^H^H^H^HRuby
set tabstop=2
" This allows you to use the < and > keys from VIM's visual (marking) mode to
" block indent/unindent regions
set shiftwidth=2
set smarttab
" Insert spaces instead of <TAB> character when the <TAB> key is pressed.
set expandtab
" makes VIM see multiple space characters as tabstops, and so <BS> does the
" right thing and will delete two spaces
set softtabstop=2
" the indent of the new line will match that of the previous line
set autoindent
set textwidth=80
" allow deletion w/ backspace over all 'boundries'
set backspace=2
" enable filetype detection:
filetype on
" enable filetype indent by plugins. this is really helpful when editing
" source code: it will indent lines automatically depending on the type of
" sourcecode you are editing
filetype plugin indent on
" * Key rebindings
" rebind omnicomplete to Ctrl-Space
" inoremap <Nul> <C-x><C-o>
" Tab navigation, see http://vim.wikia.com/wiki/VimTip1221
" in vim 7 tab navigation is done w/ <c-Page[Down|Up]>
" do not know if this is really needed, but if not it does no harm
autocmd FileType ruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
" when writing mails in vim the following is handy
" vim +':set textwidth=77' +':set wrap' +':setlocal spell spelllang=de_ch'
" helptags ~/.vim/doc
" some rubycomplete functionality
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1
" ruby code indenter, see http://antono.info/en/50
nmap <leader>rci :%!/opt/local/bin/ruby-code-indenter<cr>
" Load matchit (% to bounce from do to end, etc.)
runtime! macros/matchit.vim
" haml syntax file (vim script 1773)
au! BufRead,BufNewFile *.haml setfiletype haml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment