Skip to content

Instantly share code, notes, and snippets.

@christianrojas
Created September 7, 2014 14:00
Show Gist options
  • Save christianrojas/ba5e84587d6473f9d07d to your computer and use it in GitHub Desktop.
Save christianrojas/ba5e84587d6473f9d07d to your computer and use it in GitHub Desktop.
.vimrc Sept 2014
" Example Vim configuration.
" Copy or symlink to ~/.vimrc or ~/_vimrc.
"Pathogen configuration
execute pathogen#infect()
:let mapleader = " "
set autoindent
set nocompatible " Must come first because it changes other options.
filetype plugin indent on " Turn on file type detection.
syntax enable " Turn on syntax highlighting.
runtime macros/matchit.vim " Load the matchit plugin.
set showcmd " Display incomplete commands.
set showmode " Display the mode you're in.
set backspace=indent,eol,start " Intuitive backspacing.
set hidden " Handle multiple buffers better.
set wildmenu " Enhanced command line completion.
set wildmode=list:longest " Complete files like a shell.
set ignorecase " Case-insensitive searching.
set smartcase " But case-sensitive if expression contains a capital letter.
set number " Show line numbers.
set ruler " Show cursor position.
set incsearch " Highlight matches as you type.
set hlsearch " Highlight matches.
set wrap " Turn on line wrapping.
set scrolloff=3 " Show 3 lines of context around the cursor.
set title " Set the terminal's title
set visualbell " No beeping.
" Setting shell for vim
set shell=sh
" Syntax Completion
filetype plugin on
set ofu=syntaxcomplete#Complete
" syntastic
let g:syntastic_go_checkers = []
" Supertab
let g:SuperTabDefaultCompletionType = "context"
set nobackup " Don't make a backup before overwriting a file.
set nowritebackup " And again.
set noswapfile
set directory=.,$TEMP " Keep swap files in one location
set backupdir=.,$TEMP " Keep swap files in one location
" UNCOMMENT TO USE
set expandtab " Use spaces instead of tabs
set laststatus=2 " Show the status line all the time
" Useful status information at bottom of screen
set statusline=[%n]\ %<%.99f\ %h%w%m%r%y\ %{exists('*CapsLockStatusline')?CapsLockStatusline():''}%=%-16(\ %l,%c-%v\ %)%P
" NERDTree
let NERDTreeShowHidden=0
map <Leader>n :NERDTreeToggle
" CtrlP
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and
" respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" Color Scheme
set background=dark " you can use `dark` or `light` as your background
syntax on
color badwolf
" color Tomorrow-Night
hi Search term=reverse cterm=reverse gui=reverse ctermfg=237
" Map cursor for insert mode
let &t_SI .= "\<Esc>[5 q"
" solid block
let &t_EI .= "\<Esc>[2 q"
" 1 or 0 -> blinking block
" 3 -> blinking underscore
" Recent versions of xterm (282 or above) also support
" 5 -> blinking vertical bar
" 6 -> solid vertical bar
" Splitting
map <Leader>- :split<CR>
map <Leader><bar> :vsplit<CR>
map <leader>n :NERDTreeToggle<cr>
map <leader>g :Git<Space>
map <leader>c :CtrlPClearAllCaches<cr>
map <leader>/ :Ack<Space>
map <leader>p :YRShow<cr>
" Removing search highlighting
nnoremap <ESC><ESC> :nohlsearch<CR>
" split naviagation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Zencoding
let g:user_zen_expandabbr_key='<C-e>'
let g:user_zen_settings = { 'erb': { 'extends': 'html' } }
" disable arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" Relative line numbers
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
nnoremap <C-n> :call NumberToggle()<cr>
let g:go_disable_autoinstall = 1
" Edit the README_FOR_APP (makes :R commands work)
map <Leader>R :e README.md<CR>
" Leader shortcuts for Rails commands
map <Leader>m :Rmodel
map <Leader>c :Rcontroller
map <Leader>v :Rview
map <Leader>u :Runittest
map <Leader>f :Rfunctionaltest
map <Leader>tm :RTmodel
map <Leader>tc :RTcontroller
map <Leader>tv :RTview
map <Leader>tu :RTunittest
map <Leader>tf :RTfunctionaltest
map <Leader>sm :RSmodel
map <Leader>sc :RScontroller
map <Leader>sv :RSview
map <Leader>su :RSunittest
map <Leader>sf :RSfunctionaltest
" Hide search highlighting
map <Leader>h :set invhls <CR>
map <Leader>c "+y
map <Leader>p "+p
" Set paste mode
map <Leader>cp :set paste
:nnoremap <Leader>q :Bdelete<CR>
" vim-airline
let g:airline_powerline_fonts = 1
" let g:airline#extensions#tabline#enabled = 1
"
" RSpec.vim mappings
let g:rspec_runner = "os_x_iterm"
let g:rspec_command = "!spring rspec {spec}"
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" Send more characters for redraws
set ttyfast
" Enable mouse use in all modes
set mouse=a
set ttymouse=xterm2
let g:badwolf_tabline = 3
let g:badwolf_darkgutter = 3
let g:badwolf_tabline = 3
let g:badwolf_css_props_highlight = 1
set autoindent
filetype plugin indent on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment