Created
August 27, 2012 22:11
-
-
Save romanofski/3492790 to your computer and use it in GitHub Desktop.
romanofskis 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
_snippets: snippets | |
ln -s $(shell pwd)/$< $(HOME)/.vim/snippets | |
.vimrc: vimrc | |
mkdir -p $(HOME)/.vim | |
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
ln -s $(shell pwd)/$< $(HOME)/$@ | |
install: .vimrc snippets | |
vim +PluginInstall +qall | |
uninstall: | |
rm $(HOME)/.vimrc | |
rm -rf $(HOME)/.vim |
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
# [link][] | |
snippet [] | |
[${1:link_id}][]${2} | |
# [link][id] | |
snippet [[ | |
[${1:link}][${2:id}]${3} | |
# [link](url) | |
snippet [( | |
[${1:link}](http://${2:url})${3} | |
# [link](email) | |
snippet [@ | |
[${1:link}(mailto:${2:email})${3} | |
# [link](url "title") | |
snippet [(" | |
[${1:link}](${2:url} "${3:title}")${4} | |
# [id]: url "title" | |
snippet [: | |
[${1:id}]: http://${2:url} "${3:title}" | |
# [id]: email "title" | |
snippet [:@ | |
[${1:id}]: mailto:${2:url} "${3:title}" | |
# ![alt][id] | |
snippet ![ | |
![${1:alt}][${2:id}]${3} | |
# ![alt](url) | |
snippet !( | |
![${1:alt}](${2:url})${3} | |
# ![alt](url "title") | |
snippet !(" | |
![${1:alt}](${2:url} "${3:title}")${4} | |
# *emphasis* or _emphasis_ | |
snippet * | |
*${1}*${2} | |
snippet _ | |
_${1}_${2} | |
# **strong** or __strong__ | |
snippet ** | |
**${1}**${2} | |
snippet __ | |
__${1}__${2} | |
# `code` | |
snippet ` | |
\`${1}\`${2} |
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
snippet fdeb | |
File.open(ENV['HOME'] + '/public_html/foo.html', 'w'){|f| f.write(${1})} | |
snippet def "method definition" | |
def ${1:method_name} | |
${2} | |
end | |
snippet b "block" | |
{ |${1:var}| ${2} } | |
snippet test "test block" | |
test "${1:test_name}" do | |
${2} | |
end | |
snippet do "block" | |
do | |
${1} | |
end |
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
" Needed for additional vim plugins | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Let Vundle manage Vundle | |
" required! | |
Plugin 'gmarik/Vundle.vim' | |
" everything else | |
Plugin 'MarcWeber/vim-addon-mw-utils' | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'bling/vim-airline' | |
Plugin 'corntrace/bufexplorer' | |
Plugin 'elixir-lang/vim-elixir' | |
Plugin 'garbas/vim-snipmate' | |
Plugin 'gmarik/vundle' | |
Plugin 'godlygeek/tabular' | |
Plugin 'janx/vim-rubytest' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'tomtom/tlib_vim' | |
Plugin 'tpope/vim-abolish' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-markdown' | |
Plugin 'tpope/vim-rails' | |
Plugin 'vim-misc' | |
Plugin 'xolox/vim-session' | |
Plugin 'xolox/vim-easytags' | |
call vundle#end() | |
filetype plugin indent on | |
" Vim settings | |
set smartcase | |
set shiftwidth=4 | |
set tabstop=2 | |
set softtabstop=4 | |
set backspace=2 | |
set ai | |
set nocompatible | |
set nobackup | |
set confirm | |
set ruler | |
set syntax=on | |
set incsearch "jump to search results | |
set hlsearch | |
set showmatch | |
set showmode | |
set expandtab | |
set vb | |
set foldmethod=indent | |
set foldnestmax=2 | |
set foldlevel=0 | |
" we're using a terminal which supports 256 colors | |
set t_Co=256 | |
"set encoding=UTF-8 | |
set wildmode=longest,list,full | |
set wildmenu | |
" jump 5 lines when we hit bottom | |
set scrolljump=5 | |
" we don't need to hit the exact bottom to trigger the scrolljump | |
set scrolloff=3 | |
"see :help wrap | |
set sidescroll=5 | |
set listchars=tab:_¸,trail:· | |
set list | |
set tw=72 | |
set spelllang=en | |
set spell | |
" set the buffer as hidden, so that vim don't pesters evertime about | |
" saving when switching between buffers | |
set hidden | |
set tags=tags;/ | |
" colour the textwidth | |
set statusline=%{fugitive#statusline()}<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)'%02b'%{&enc}%h> | |
" Always show the status line | |
set laststatus=2 | |
" I like a fancy cursorline | |
set cursorline | |
" enable filetype plugins such those for editing XML files | |
filetype plugin on | |
filetype indent on | |
" for handling mouse events in xterm | |
set ttymouse=xterm2 | |
colo default | |
syntax on | |
" pep8 plugin: ignore a few errors which are currently not *work* | |
" compatible: multiple spaces after ',' and line too long. | |
let g:pep8_ignore="E501,E241" | |
"" Map Python trickery to function keys and commands | |
map <F8> :Explore<CR> | |
map ,tex :r !cat /home/roman/.vim/templates/artcl.tex.templ | |
nnoremap <cr> :noh<cr><cr> | |
inoremap ,a ä | |
inoremap ,o ö | |
inoremap ,u ü | |
inoremap ,A Ä | |
inoremap ,O Ö | |
inoremap ,U Ü | |
inoremap ,s ß | |
augroup filetypedetect | |
au! BufNewFile,BufRead *.pt set ft=xml shiftwidth=2 softtabstop=2 | |
au! BufNewFile,BufRead *.zcml set ft=xml shiftwidth=2 softtabstop=2 | |
au! BufNewFile,BufRead *.zpt set ft=xml shiftwidth=2 softtabstop=2 | |
au! BufNewFile,BufRead *.xml set ft=xml shiftwidth=2 softtabstop=2 | |
au! BufNewFile,BufRead *.css.dtml set syntax=css | |
au! BufNewFile,BufRead ChangeLog set shiftwidth=8 tabstop=8 noexpandtab | |
au! BufNewFile,BufRead *.txt set ft=markdown | |
autocmd BufRead *.vala set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m | |
autocmd BufRead *.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m | |
au! BufRead,BufNewFile *.vala setfiletype vala | |
au! BufRead,BufNewFile *.vapi setfiletype vala | |
au BufRead,BufNewFile *.rb set ts=2 sts=2 sw=2 expandtab | |
augroup END | |
autocmd FileType html map <F2> <Esc>:1,$!tidy -q -i --show-errors 0<CR> | |
autocmd FileType python map <F9> :ToggleSliceBuffer<CR> | |
autocmd FileType python vmap g/ :call SortMultipleLines()<CR> | |
autocmd FileType python vmap m/ :call DeMartinify()<CR> | |
autocmd FileType python iab pdb import pdb; pdb.set_trace() | |
autocmd FileType ruby iab pdb require 'ruby-debug'; debugger | |
" delete with Strg+D all to signature | |
autocmd FileType mail map <C-d> :.;/^-- $/d<CR>O-- <UP><End><CR> | |
" Automatically delete trailing whitespace in python files | |
command! -nargs=0 TidyWhiteSpace :call s:tidy_whitespace() | |
function s:tidy_whitespace() | |
exe ':%s/\s\+$//e' | |
endfunction | |
" abbreviations | |
ab impytest import pytest; pytest.set_trace() | |
ab cbred border: 1px solid red | |
" disable F1 for immediately open the help -- make a choice | |
inoremap <F1> <Esc> | |
noremap <F1> :call MapF1()<cr> | |
function! MapF1() | |
if &buftype == "help" | |
exec 'quit' | |
else | |
exec 'help' | |
endif | |
endfunction | |
" Use a differen color for pyflakes | |
highlight SpellBad cterm=bold ctermbg=none ctermfg=brown | |
" Sort multiline imports | |
function! SortMultipleLines() range | |
let save_cursor = getpos(".") | |
execute a:firstline . "," . a:lastline . 's/\\\@<=\n/|' | |
execute a:firstline . "," . a:lastline . 'sort' | |
execute a:firstline . "," . a:lastline . 's/\\\@<=|/\r/g' | |
call setpos('.', save_cursor) | |
endfunction | |
" de-martinify the code, basically resetting the formatting to be more | |
" pep8 alike | |
function! DeMartinify() range | |
" trim whitespace from open parenthesis | |
silent! execute a:firstline . "," . a:lastline . 's/\(\w(\)\s/\1/g' | |
" ... close parenthesis | |
silent! execute a:firstline . "," . a:lastline . 's/\s)/)/g' | |
" keyword assignments in parenthesis, e.g. dict(foo = bar) | |
silent! execute a:firstline . "," . a:lastline . 's/\((.*\)\s\(=\{1,2}\)\s/\1\2/g' | |
endfunction | |
set background=dark | |
colorscheme solarized | |
" https://gist.github.com/287147 | |
" http://vimcasts.org/episodes/aligning-text-with-tabular-vim/ | |
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) | |
endif | |
endfunction | |
" vim-airline | |
let g:airline_powerline_fonts=1 | |
" vim-rubytest | |
let g:rubytest_in_quickfix = 1 | |
" vim-session | |
let g:session_autosave = 'yes' | |
let g:session_autoload = 'yes' | |
" ctrlp | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\v(eggs|parts|coverage)', | |
\ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment