Created
August 23, 2012 10:05
-
-
Save gglanzani/3435030 to your computer and use it in GitHub Desktop.
my vimrc
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
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/vundle | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
" My Bundles here: | |
" | |
" original repos on github | |
Bundle 'tpope/vim-fugitive' | |
Bundle 'tpope/vim-surround.git' | |
Bundle 'tpope/vim-markdown.git' | |
Bundle 'tpope/vim-repeat.git' | |
Bundle 'wincent/Command-T.git' | |
Bundle 'Raimondi/delimitMate.git' | |
Bundle 'docunext/closetag.vim.git' | |
Bundle 'scrooloose/nerdcommenter.git' | |
Bundle 'altercation/vim-colors-solarized.git' | |
Bundle 'tsaleh/vim-align.git' | |
Bundle 'mileszs/ack.vim.git' | |
Bundle 'skammer/vim-css-color.git' | |
Bundle 'michaeljsmith/vim-indent-object.git' | |
Bundle 'ervandew/supertab' | |
Bundle 'Lokaltog/vim-easymotion.git' | |
Bundle 'Lokaltog/vim-powerline.git' | |
Bundle 'orenhe/pylint.vim.git' | |
Bundle 'nvie/vim-pep8.git' | |
Bundle 'sjl/badwolf.git' | |
Bundle 'sjl/gundo.vim.git' | |
Bundle 'sjl/clam.vim.git' | |
Bundle 'othree/xml.vim.git' | |
Bundle 'aliva/vim-fish.git' | |
Bundle 'nathanaelkane/vim-indent-guides.git' | |
Bundle 'tomtom/tlib_vim.git' | |
Bundle 'MarcWeber/vim-addon-mw-utils.git' | |
Bundle 'gglanzani/vim-tomorrow-theme.git' | |
Bundle 'gglanzani/ultisnips-snippets.git' | |
Bundle 'rgarver/Kwbd.vim.git' | |
Bundle 'guns/ultisnips' | |
Bundle 'spolu/dwm.vim.git' | |
" vim script repos | |
Bundle 'taglist.vim' | |
Bundle 'ZoomWin' | |
Bundle 'L9' | |
Bundle 'FuzzyFinder' | |
Bundle 'YankRing.vim' | |
Bundle 'Latex-Text-Formatter' | |
" non github repos | |
Bundle 'git://vim-latex.git.sourceforge.net/gitroot/vim-latex/vim-latex' | |
filetype plugin indent on | |
set number | |
set ruler | |
syntax on | |
" Set encoding | |
set encoding=utf-8 | |
" Whitespace stuff | |
set nowrap | |
set expandtab | |
set list listchars=tab:\ \ ,trail:· | |
" Searching | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Tab completion | |
set wildmode=list:longest,list:full | |
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
" Without setting this, ZoomWin restores windows in a way that causes | |
" equalalways behavior to be triggered the next time CommandT is used. | |
" This is likely a bludgeon to solve some other issue, but it works | |
set noequalalways | |
let g:Powerline_symbols = 'fancy' | |
" set the mapleader to comma | |
let mapleader="," | |
" Command-T configuration | |
let g:CommandTMaxHeight=20 | |
" ZoomWin configuration | |
map <Leader>z :ZoomWin<CR> | |
" CTags | |
map <Leader>rt :!ctags --extra=+f -R *<CR><CR> | |
map <C-\> :tnext<CR> | |
" Remember last location in file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal g'\"" | endif | |
endif | |
function s:setupWrapping() | |
set wrap | |
set wrapmargin=2 | |
set textwidth=79 | |
endfunction | |
function s:setupMarkup() | |
call s:setupWrapping() | |
map <buffer> <Leader>p :Hammer<CR> | |
endfunction | |
" make uses real tabs | |
au FileType make set noexpandtab | |
" fish filetype | |
au BufNewFile,BufRead *.fish set ft=fish | |
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby | |
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby | |
" md, markdown, and mk are markdown and define buffer-local preview | |
au BufRead,BufNewFile *.{com,txt,md,markdown,mdown,mkd,mkdn} set ft=markdown | |
au BufRead,BufNewFile *.{com,txt,md,markdown,mdown,mkd,mkdn} call s:setupMarkup() | |
" add json syntax highlighting | |
au BufNewFile,BufRead *.json set ft=javascript | |
au BufRead,BufNewFile *.{txt,tex,md,markdown,mdown,mkd,mkdn} call s:setupWrapping() | |
au BufRead,BufNewFile *.{tex,md,markdown,mdown,mkd,mkdn} setlocal spell | |
autocmd FileType gitcommit setlocal spell | |
au BufRead,BufNewFile *.tex set ft=tex | |
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ ) | |
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79 | |
" allow backspacing over everything in insert mode | |
set backspace=indent,eol,start | |
" VIM-LATEX | |
" TIP: if you write your \label's as \label{fig:something}, then if you | |
" type in \ref{fig: and press <C-n> you will automatically cycle through | |
" all the figure labels. Very useful! | |
set iskeyword+=: | |
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to | |
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded. | |
" The following changes the default filetype back to 'tex': | |
let g:Tex_flavor='xelatex' | |
let g:Tex_DefaultTargetFormat='pdf' | |
set guioptions=aAce | |
let g:Tex_ViewRuleComplete_pdf = 'open -a Skim $*.pdf' | |
let g:Tex_CompileRule_pdf = 'vimlatex latexmk -pdf -file-line-error' | |
let g:Tex_GotoError = 0 | |
nnoremap <leader>t :set ft=tex<CR> | |
omap lp ?^$\\|^\s*\(\\begin\\|\\end\\|\\label\)?1<CR>//-1<CR>.<CR>:nohlsearch<Bar>:echo<CR> | |
au BufRead,BufNewFile *.tex TCTarget pdf | |
au BufRead,BufNewFile *.tex set softtabstop=2 tabstop=2 shiftwidth=2 textwidth=79 | |
" <leader>lk will save and compile latex | |
nmap <leader>lk :w<cr><leader>ll | |
set wildmode=list:longest,list:full | |
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set smartindent | |
set autoindent | |
set guicursor+=a:blinkon0 | |
" Open Marked on <leader>m | |
nnoremap <leader>m :silent !open -a Marked.app %:p<CR> | |
" Press Space to turn off highlighting and clear any message already displayed. | |
:nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR> | |
nnoremap <F6> :GundoToggle<CR> | |
" open a split a switch to it | |
nnoremap <leader>w <C-w>v<C-w>l | |
set encoding=utf-8 | |
set undodir=~/.vim/undodir | |
set undofile | |
set undolevels =1000 "maximum number of changes that can be undone | |
set undoreload =10000 "maximum number lines to save for undo on a buffer reload | |
set viminfo='100,:100,<50,s10,h | |
" <leader>o open FufFile | |
nnoremap <leader>o :FufFile<CR> | |
let g:fuf_file_exclude = '\v\~$|\.(o|exe|gz|fdb_latexmk|dll|bak|orig|swp|aux|out)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])' | |
" some sanity | |
inoremap jj <ESC> | |
" evaluate .gvimrc on save | |
autocmd bufwritepost .gvimrc source % | |
let loaded_delimitMate = 0 | |
let delimitMate_autoclose = 1 | |
let delimitMate_matchpairs = "(:),[:],{:},<:>" | |
let delimitMate_expand_space = 0 | |
let delimitMate_quotes = "\" ' ` *" | |
au FileType python let b:delimitMate_quotes = "\" `" | |
au FileType markdown let b:delimitMate_quotes = "\" ` *" | |
au FileType tex let b:delimitMate_quotes = "'" | |
au BufRead,BufNewFile *.{txt} let b:delimitMate_quotes = "` \"" | |
let delimitMate_nesting_quotes = ['"','`'] | |
au FileType python let b:delimitMate_nesting_quotes = ['"'] | |
let delimitMate_excluded_ft = "mail,txt" | |
" <leader>cd makes the directory containing the buffer the current directory | |
nnoremap <leader>cd :cd %:p:h<CR> | |
" Highlight the screen line of the cursor with CursorLine | |
set cursorline | |
set laststatus=2 | |
" Opens an edit command with the path of the currently edited file filled in | |
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR> | |
" Opens a tab edit command with the path of the currently edited file filled in | |
map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR> | |
" Inserts the path of the currently edited file into a command | |
cmap <C-P> <C-R>=expand("%:p:h") . "/" <CR> | |
" gist-vim defaults | |
if has("mac") | |
let g:gist_clip_command = 'pbcopy' | |
elseif has("unix") | |
let g:gist_clip_command = 'xclip -selection clipboard' | |
endif | |
let g:gist_detect_filetype = 1 | |
let g:gist_open_browser_after_post = 1 | |
" Use modeline overrides | |
set modeline | |
set modelines=10 | |
" Default color scheme | |
syntax enable | |
" Directories for swp files | |
set backupdir=~/.vim/backup | |
set directory=~/.vim/backup | |
" Show (partial) command in the status line | |
set showcmd | |
autocmd FileType html,htmldjango,jinjahtml,eruby,mako let b:closetag_html_style=1 | |
set foldopen+=search | |
set hidden | |
" Remove any trailing whitespace that is in the file | |
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif | |
set foldmethod=marker | |
" <D-j>/<D-k> insert white lines below/above cursor | |
nnoremap <silent><D-j> :set paste<CR>m`o<Esc>``:set nopaste<CR> | |
nnoremap <silent><D-k> :set paste<CR>m`O<Esc>``:set nopaste<CR> | |
let g:FoldMethod = 0 | |
map <leader>fo :call ToggleFold()<cr> | |
fun! ToggleFold() | |
if g:FoldMethod == 0 | |
exe 'set foldmethod=indent' | |
let g:FoldMethod = 1 | |
else | |
exe 'set foldmethod=marker' | |
let g:FoldMethod = 0 | |
endif | |
endfun | |
set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap to | |
set scrolloff=3 " minimum lines to keep above and below cursor | |
set gdefault " the /g flag on :s substitutions by default | |
nnoremap j gj | |
nnoremap k gk | |
nnoremap ; : | |
" Yank from the cursor to the end of the line, to be consistent with C and D. | |
function! YRRunAfterMaps() | |
nnoremap Y :<C-U>YRYankCount 'y$'<CR> | |
endfunction | |
let g:yankring_replace_n_pkey = '<m-p>' | |
let g:yankring_replace_n_nkey = '<m-n>' | |
" keep the cursor in place when you join lines with J | |
nnoremap J mzJ`z | |
""" Code folding options | |
nmap <leader>f0 :set foldlevel=0<CR> | |
nmap <leader>f1 :set foldlevel=1<CR> | |
nmap <leader>f2 :set foldlevel=2<CR> | |
nmap <leader>f3 :set foldlevel=3<CR> | |
nmap <leader>f4 :set foldlevel=4<CR> | |
nmap <leader>f5 :set foldlevel=5<CR> | |
nmap <leader>f6 :set foldlevel=6<CR> | |
nmap <leader>f7 :set foldlevel=7<CR> | |
nmap <leader>f8 :set foldlevel=8<CR> | |
nmap <leader>f9 :set foldlevel=9<CR> | |
autocmd FileType python map <buffer> <F3> :call Pep8()<CR> | |
" switch to the last opened buffer | |
nnoremap <leader>3 :b#<CR> | |
autocmd BufRead *.log set ar " reload log files automagically | |
autocmd BufLeave,FocusLost * silent! wall " autosave on BufLeave of FocusLost | |
" for CSS, also have things in braces indented: | |
autocmd FileType css set smartindent | |
" for HTML, generally format text, but if a long line has been created | |
" leave it alone when editing: | |
autocmd FileType html set formatoptions+=tl | |
" for both CSS and HTML, use genuine tab characters for | |
" indentation, to make files a few bytes smaller: | |
autocmd FileType html,css setlocal noexpandtab shiftwidth=2 tabstop=2 | |
" 'y' will copy the selected text to the clipboard | |
set clipboard=unnamed | |
" relative line number in normal mode | |
set rnu | |
au InsertEnter * :set nu | |
au InsertLeave * :set rnu | |
au FocusLost * :set nu | |
au FocusGained * :set rnu | |
" how big the indent guide should be | |
let g:indent_guides_guide_size = 1 | |
" SuperTab is <c-space> | |
let g:SuperTabMappingForward = '<c-space>' | |
let g:SuperTabMappingBackward = '<s-c-space>' | |
" Ultisnips uses tab | |
let g:UltiSnipsJumpForwardTrigger = '<tab>' | |
" location for ultisnips snippets | |
let g:UltiSnipsSnippetDirectories=["my_snippets"] | |
" close file, but not buffer | |
nmap <leader>d <Plug>Kwbd | |
" close file and buffer | |
nmap <leader>k :bd<CR> | |
" open YankRing window | |
noremap <leader>y :YRShow<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment