Skip to content

Instantly share code, notes, and snippets.

@nihilismus
Created January 26, 2013 04:24
Show Gist options
  • Save nihilismus/4640183 to your computer and use it in GitHub Desktop.
Save nihilismus/4640183 to your computer and use it in GitHub Desktop.
" $HOME/.vimrc
"""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""
" VI iMproved
set nocompatible
filetype off
filetype plugin indent off
"""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""
" An on-demand runtimepath manager and plugin loader for vim
runtime bundles/tplugin_vim/macros/tplugin.vim
" Fuzzy/Partial pattern explorer for buffer/file/MRU/command/bookmark/tag/etc.
call vam#ActivateAddons(['hg:https://bitbucket.org/ns9tks/vim-l9'])
call vam#ActivateAddons(['hg:https://bitbucket.org/ns9tks/vim-fuzzyfinder'])
" A plugin that allows for easy commenting of code for many filetypes.
call vam#ActivateAddons(['github:vim-scripts/The-NERD-Commenter'])
" Toggles the mouse focus between Vim and your terminal emulator
call vam#ActivateAddons(['github:nvie/vim-togglemouse'])
" CVS/SVN/SVK/git/hg/bzr integration plugin.
call vam#ActivateAddons(['github:vim-scripts/vcscommand.vim'])
" Beautiful dual light/dark, selective contrast, GUI/256/16 colorscheme.
call vam#ActivateAddons(['github:altercation/vim-colors-solarized'])
set t_Co=256
set background=light
let g:solarized_termtrans=0
let g:solarized_bold=0
let g:solarized_underline=0
let g:solarized_italic=0
colorscheme solarized
" Vim/Ruby Configuration Files
call vam#ActivateAddons(['github:vim-ruby/vim-ruby'])
" The ultimate snippet solution for python enabled Vim.
call vam#ActivateAddons(['github:vim-scripts/UltiSnips'])
let g:UltiSnipsUsePythonVersion = 2
" Is the buffer's indentation consistent and does it conform to tab settings?.
call vam#ActivateAddons(['github:vim-scripts/IndentConsistencyCop'])
" foreplay.vim: Clojure REPL tease
call vam#ActivateAddons(['github:tpope/vim-foreplay.git', 'github:tpope/vim-classpath.git', 'github:guns/vim-clojure-static.git'])
" This is a simple script that shows a tabs-like list of buffers in the bottom of the window.
call vam#ActivateAddons(['github:vim-scripts/buftabs'])
set laststatus=2
let g:right_statusline='%= %#Visual# [%{strlen(&filetype)?&filetype:"?"}]'
let g:right_statusline.=' [%{&encoding}%{&bomb?" (BOM) ":" "}(%{v:ctype}), %{&fileformat}, %l/%L, %c%V %P]'
let g:buftabs_only_basename=1
let g:buftabs_in_statusline=1
let g:buftabs_active_highlight_group="ErrorMsg"
let g:buftabs_inactive_highlight_group="Folded"
" dbext: Provides database access to many dbms (Oracle, Sybase, Microsoft, " MySQL, DBI,..)
call vam#ActivateAddons(['github:vim-scripts/dbext.vim'])
" MySQL
let g:dbext_default_profile_mysql_local = 'type=MYSQL:user=root:passwd='':dbname=mysql:bin_path=/usr/bin/'
" PostgreSQL
let g:dbext_default_profile_postgres_local = 'type=PGSQL:user=postgres:passwd='':dbname=postgres:bin_path=/usr/bin/'
" Unload/delete/wipe a buffer, keep its window(s), display last accessed buffer(s)
call vam#ActivateAddons(['github:vim-scripts/bufkill.vim'])
""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""
" Persisten undo
set undodir=~/.vim/undodir
set undofile
set undolevels=1000
set undoreload=10000
""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""
" Backups directory
set backupdir=~/.vim/backups
""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""
" UTF-8
set encoding=utf-8
set fileencoding=utf-8
set fencs="ucs-bom,utf-8"
set fileencodings="ucs-bom,utf-8"
set termencoding=utf-8
""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""
" Paste toggle
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""
" Tab configuration
" => C
autocmd BufEnter *.c set softtabstop=8 shiftwidth=8 noexpandtab
" => Java
autocmd BufEnter *.java set softtabstop=4 shiftwidth=4 expandtab
" => PHP
autocmd BufEnter *.php set softtabstop=4 shiftwidth=4 expandtab
" => Python
autocmd BufEnter *.py set tabstop=4 shiftwidth=4 expandtab
" => Ruby
autocmd BufEnter *.rb set tabstop=2 shiftwidth=2 expandtab
" => Shell (bash,sh,ksh)
autocmd BufEnter *.bash,*.sh,*.ksh set tabstop=4 shiftwidth=4 expandtab
" => Javascript
autocmd BufEnter *.js set tabstop=4 shiftwidth=4 expandtab
" => HTML
autocmd BufEnter *.htm,*.html set tabstop=2 shiftwidth=2 expandtab
""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""
" Spell Check
let b:myLang=0
let g:myLangList=["nospell","es","en"]
function! ToggleSpell()
let b:myLang=b:myLang+1
if b:myLang>=len(g:myLangList) | let b:myLang=0 | endif
if b:myLang==0
setlocal nospell
else
execute "setlocal spell spelllang=".get(g:myLangList, b:myLang)
endif
echo "spell checking language:" g:myLangList[b:myLang]
endfunction
nmap <silent> <F7> :call ToggleSpell()<CR>
hi SpellBad term=reverse ctermfg=white ctermbg=darkred
hi SpellCap ctermfg=white ctermbg=darkyellow
hi SpellRare ctermfg=white ctermbg=darkblue
hi SpellLocal term=reverse ctermfg=black ctermbg=darkgreen
""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""
" Final options
set ruler
set number
set mouse=r
filetype plugin indent on
syntax on
set ofu=syntaxcomplete#Complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment