Created
November 16, 2012 06:41
-
-
Save nihilismus/4084854 to your computer and use it in GitHub Desktop.
My .vimrc file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" $HOME/.vimrc | |
" | |
" Author: Antonio Hernández Blas | |
" Contact: [email protected], https://twitter.com/nihilipster | |
" | |
" Description: this is my .vimrc file which make use of various Vim scripts from GitHub | |
" (The-NERD-tree, vim-colors-solarized, UltiSnips, etc) but specially Vundle (a Vim plugin manager) | |
" so please take your time to read its basic documentation at https://github.com/gmarik/vundle | |
" | |
" Instructions: | |
" 1) Create the required directories: | |
" user@localhost:~$ mkdir -p ~/.vim/bundle/vundle/ ~/.vim/undodir ~/.vim/backups | |
" 2) Install Vundle (important!) | |
" user@localhost:~$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle | |
" Cloning into '/home/user/.vim/bundle/vundle'... | |
" ... | |
" 3) Copy this file (nihilismus.vimrc) to your $HOME as .vimrc (if already exists, do a back up!) | |
" user@localhost:~$ cat nihilismus.vimrc > ~.vimrc | |
" 4) Open vim. You will get the next error but do not worry: | |
" E185: Cannot find color scheme solarized | |
" just press ENTER. | |
" 5) Once inside Vim, execute: | |
" :BundleInstall! | |
" this will install all the Vim scripts from GitHub and if at some point you want to update | |
" them just execute once again this command inside Vim. | |
" 6) Exit Vim | |
" 7) Open Vim once again | |
" 8) Enjoy! ;) | |
""""""""""""""""""""""""""""""" | |
" VI iMproved | |
set nocompatible | |
""""""""""""""""""""""""""""""" | |
" Vundle is short for Vimbundle and is a Vim plugin manager. | |
filetype off | |
filetype plugin indent off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
" A tree explorer plugin for vim. | |
Bundle 'vim-scripts/The-NERD-tree' | |
nnoremap <F8> :NERDTreeToggle<CR> | |
let NERDChristmasTree=1 | |
let NERDTreeChDirMode=2 | |
let NERDTreeHighlightCursorline=1 | |
let NERDTreeIgnore=[] | |
let NERDTreeStatusline = "%{substitute(getcwd(), $HOME, '~','')}" | |
let NERDTreeWinSize=30 | |
let NERDTreeMinimalUI=1 | |
let NERDTreeDirArrows=1 | |
"autocmd VimEnter * NERDTree | |
"autocmd VimEnter * wincmd p | |
" A plugin that allows for easy commenting of code for many filetypes. | |
Bundle 'vim-scripts/The-NERD-Commenter' | |
" Toggles the mouse focus between Vim and your terminal emulator | |
Bundle 'nvie/vim-togglemouse' | |
" CVS/SVN/SVK/git/hg/bzr integration plugin. | |
Bundle 'vim-scripts/vcscommand.vim' | |
" Beautiful dual light/dark, selective contrast, GUI/256/16 colorscheme. | |
Bundle '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 | |
Bundle 'vim-ruby/vim-ruby' | |
" Ruby on Rails power tools. | |
Bundle 'tpope/vim-rails' | |
" The ultimate snippet solution for python enabled Vim. | |
Bundle 'vim-scripts/UltiSnips' | |
let g:UltiSnipsUsePythonVersion = 2 | |
" Is the buffer's indentation consistent and does it conform to tab settings?. | |
Bundle 'vim-scripts/IndentConsistencyCop' | |
" A filetype, syntax and indent plugin for Clojure. | |
Bundle 'vim-scripts/VimClojure' | |
let g:vimclojure#HighlightBuiltins=1 | |
let g:vimclojure#ParenRainbow=1 | |
" This is a simple script that shows a tabs-like list of buffers in the bottom of the window. | |
Bundle '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,..) | |
Bundle '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) | |
Bundle '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 | |
"""""""""""""""""""""""""""""""""""""" | |
" Set all options | |
set ruler | |
set number | |
set mouse=r | |
"""""""""""""""""""""""""""""""""""""" | |
filetype plugin indent on | |
syntax on | |
set ofu=syntaxcomplete#Complete | |
"""""""""""""""""""""""""""""""""""""" | |
" 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=2 shiftwidth=2 expandtab | |
" => Javascript | |
autocmd BufEnter *.js set tabstop=4 shiftwidth=4 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment