Skip to content

Instantly share code, notes, and snippets.

@sebastianvera
Created November 5, 2014 20:31
Show Gist options
  • Save sebastianvera/7031316c5fc4a9583bd0 to your computer and use it in GitHub Desktop.
Save sebastianvera/7031316c5fc4a9583bd0 to your computer and use it in GitHub Desktop.
" ========================================================================
" Vundle stuff
" ========================================================================
set nocompatible "Required by vundle
filetype off "Required by vundle
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Let Vundle manage Vundle (required)!
Plugin 'gmarik/Vundle.vim'
" My bundles
Plugin 'danro/rename.vim'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-markdown'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-fugitive'
Plugin 'godlygeek/tabular'
Plugin 'vim-scripts/matchit.zip'
Plugin 'ervandew/supertab'
Plugin 'tomtom/tcomment_vim'
Plugin 'scrooloose/nerdtree'
" All of your Plugins must be added before the following line
call vundle#end() "required
filetype plugin indent on "required
" =====================================================
syntax on
let mapleader = ","
set t_Co=256
set autoindent
set autoread
set backspace=indent,eol,start
set et
set encoding=utf-8
set fileencoding=utf-8
set gdefault
set hlsearch
set history=500
set ignorecase
set incsearch
set laststatus=2
set nofoldenable
set number
set relativenumber
set ruler
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
set smartcase
set smarttab
set showmatch
set showcmd
set smartindent
set ts=2
set vb
set bg=dark
" (Hopefully) removes the delay when hitting esc in insert mode
set noesckeys
set ttimeout
set ttimeoutlen=1
set timeoutlen=500
" Highlight the status line
highlight StatusLine ctermfg=blue ctermbg=yellow
" Make the omnicomplete text readable
highlight PmenuSel ctermfg=black
" Color scheme
colorscheme default
" Remove trailing whitespace on save for ruby files.
au BufWritePre *.rb :%s/\s\+$//e
nmap <leader>h :nohlsearch<cr>
vmap <leader>a: :Tabularize /:<cr>
vmap <leader>a= :Tabularize /=<cr>
command! Q q
map Q <Nop>
map K <Nop>
" Switch between the last two files
nnoremap <leader><leader> <c-^>
nmap <leader>k :NERDTreeToggle<cr>
inoremap <Tab> <C-P>
map <C-s> <esc>:w<CR>
imap <C-s> <esc>:w<CR>
map <C-t> <esc>:tabnew<CR>
map <Leader>gac :Gcommit -am ""<LEFT>
map <Leader>gc :Gcommit -m ""<LEFT>
map <Leader>w <c-w>w
set completeopt=longest,menu
set complete=.,w,b,u,t
set wildmenu
set wildmode=list:full
map <Leader>vi :tabe ~/.vimrc<CR>
" Window navigation
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-L> <C-W><C-L>
nmap <C-H> <C-W><C-H>
"
" " Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
nmap <Leader>bi :source ~/.vimrc<cr>:PluginInstall<cr>
" Don't add the comment prefix when I hit enter or o/O on a comment line.
set formatoptions-=or
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
set wildignore=*.o,*.obj,tmp,.git,node_modules,bower_components,build
" Display extra whitespace
set list listchars=tab:»·,trail:·
" Make it more obvious which paren I'm on
hi MatchParen cterm=none ctermbg=black ctermfg=yellow
" ========================================================================
" End of things set by me.
" ========================================================================
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
autocmd BufRead *_spec.rb syn keyword rubyRspec describe context it specify
\ it_should_behave_like before after setup subject its shared_examples_for shared_context expect let
highlight def link rubyRspec Function
autocmd FileType ruby,eruby,yaml setlocal colorcolumn=80
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
endif " has("autocmd")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment