Skip to content

Instantly share code, notes, and snippets.

@rodreegez
Created May 12, 2011 10:46
Show Gist options
  • Save rodreegez/968311 to your computer and use it in GitHub Desktop.
Save rodreegez/968311 to your computer and use it in GitHub Desktop.
my vim settings, use at your own risk
set nocompatible " Must come first because it changes other options.
call pathogen#runtime_append_all_bundles() " Pathogen
runtime macros/matchit.vim " ruby text blocks
syntax enable
set background=dark
colorscheme solarized
filetype plugin indent on " Turn on file type detection.
set showcmd " Display incomplete commands.
set backspace=indent,eol,start " Intuitive backspacing.
set hidden " Handle multiple buffers better.
" tab completion
set wildmode=longest,full
set wildmode=list:longest
set wildignore+=*.o,*.obj,.git,*.rbc
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
set hlsearch " Highlight matches.
" dismiss search results with space
:nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
set wrap " Turn on line wrapping.
set scrolloff=3 " Show 3 lines of context around the cursor.
" invisibles
set list listchars=tab:▸\ ,trail:·,eol:¬
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup " And again.
set noswapfile
set tabstop=2 " Global tab width.
set shiftwidth=2 " And again, related.
set expandtab " Use spaces instead of tabs
set laststatus=2 " Show the status line all the time
" ask to create a new file if it doesn't exist
au BufNewFile * :exe ': !mkdir -p ' . escape(fnamemodify(bufname('%'),':p:h'),'#% \\')
" .ru's and Gemdiles are ruby
au BufRead,BufNewFile {Gemfile,Rakefile,config.ru} set ft=ruby
" .html.erb is eruby
au BufRead,BufNewFile *.html.erb set filetype=eruby
" strip whitespace when saving ruby files
autocmd BufWritePre {*.html,*.erb,*.rb} :%s/\s\+$//e
" Convert tabs to spaces when saving ruby files
" autocmd BufWritePre {*.html,*.erb,*.rb} :%s/\t/ /g
command! W :w " :W is the same as :w
command! Q :q " :Q is the same as :q
command! Wq :wq " :Wq is the same as :wq
command! Wqa :wqa " guess
command! Qa :qa " :Qa is the same as :qa
" Opens an edit command with the path of the currently edited file filled in
" Normal mode: <Leader>e
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" ack for current word under cursor
map <Leader>aw :Ack <cword><CR>
" set text wrapping to 72 cols
function s:setupWrapping()
set wrap
set wm=2
set textwidth=72
endfunction
" spellingz (h/t https://github.com/peteog/dotfiles/blob/master/vimrc#L128)
map <F7> :setlocal spell! spelllang=en_gb<CR>
" gundo
nnoremap <F5> :GundoToggle<CR>
" set paste toggle
set pastetoggle=<f12>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment