Skip to content

Instantly share code, notes, and snippets.

@twosevenzero
Created July 18, 2015 02:23
Show Gist options
  • Save twosevenzero/99048212108d00975a9e to your computer and use it in GitHub Desktop.
Save twosevenzero/99048212108d00975a9e to your computer and use it in GitHub Desktop.
vimrc
" ========================================================================
" Vundle stuff
" ========================================================================
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Let Vundle manage Vundle (required)!
Bundle 'gmarik/vundle'
" Bundles
Bundle 'bling/vim-airline'
Bundle 'chriskempson/base16-vim'
Bundle 'ervandew/supertab'
Bundle 'groenewege/vim-less'
Bundle 'kana/vim-textobj-user'
Bundle 'kchmck/vim-coffee-script'
Bundle 'mattn/emmet-vim'
Bundle 'mustache/vim-mustache-handlebars'
Bundle 'nanotech/jellybeans.vim'
Bundle 'nelstrom/vim-textobj-rubyblock'
Bundle 'othree/html5.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'skwp/greplace.vim'
Bundle 'thoughtbot/vim-rspec'
Bundle 'tomtom/tcomment_vim'
Bundle 'tpope/vim-bundler'
Bundle 'tpope/vim-endwise'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-haml'
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-unimpaired'
Bundle 'vim-ruby/vim-ruby'
Bundle 'wincent/command-t'
syntax on " Enable syntax highlighting
filetype plugin indent on " Enable filetype-specific indenting and plugins
" ================
" Ruby stuff
" ================
augroup myfiletypes
" Clear old autocmds in group
autocmd!
" autoindent with two spaces, always expand tabs
autocmd FileType ruby,eruby,yaml setlocal ai sw=2 sts=2 et
autocmd FileType ruby,eruby,yaml setlocal path+=lib
augroup END
" Enable built-in matchit plugin
runtime macros/matchit.vim
" ================
" Leader stuff
" ================
let mapleader = ","
" Begin leaderKey mappings.
map <leader>cc :TComment<CR>
map <leader>cb :TCommentBlock<CR>
map <leader>ci :TCommentInline<CR>
map <leader>gr :!clear;grunt<CR>
map <leader>jk :!clear;jekyll serve<CR>
map <leader>jn :!clear;jasmine-node *.spec.js<CR>
map <leader>lt i<%= link_to %>
map <leader>m :NERDTreeToggle<CR>
map <leader>nb :vsp ~/Dropbox/Notebook/notebook.txt<CR>Go<CR><CR>
map <leader>nn :!clear; node %<CR>
map <leader>nt :!clear; npm test<CR>
map <leader>rr :!clear; bundle exec rspec<CR>
map <leader>rs :call RunCurrentSpecFile()<CR>
map <leader>rn :call RunNearestSpec()<CR>
map <leader>rl :call RunLastSpec()<CR>
imap <C-c> <C-y>,
" =============
" RSpec stuffs
" =============
let g:rspec_command = '!clear; bundle exec rspec {spec}'
" Split Navigation Ctrl + direction
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>
" Disable arrows to force myself to use hjkl
" map <left> <nop>
" map <down> <nop>
" map <up> <nop>
" map <right> <nop>
" =========================
syntax enable
set nocompatible
set autoindent
set backspace=indent,eol,start
set colorcolumn=80
" set cursorline
set encoding=utf-8
set fileencoding=utf-8
set gdefault
set guifont=Inconsolata\ for\ Powerline:h20
set guioptions-=Be
set guioptions=aAc
set hlsearch
set ignorecase
set incsearch
"set list
"set listchars=eol:¬,nbsp:⋅
set noswapfile
set nowrap
set number
set relativenumber
set shell=/bin/sh
set showmatch
set smartcase
"set smartindent
set splitbelow
set splitright
set term=screen-256color
set ts=2 sts=2 sw=2 expandtab
set visualbell
set winheight=999
set winheight=5
set winminheight=5
set winwidth=84
" Show syntax highlighting groups for word under cursor
nmap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
set background=dark
colorscheme base16-default
".ru files are Ruby.
au BufRead,BufNewFile *.ru set filetype=ruby
au BufRead,BufNewFile [vV]agrantfile set filetype=ruby
" Markdown gets auto textwidth
au Bufread,BufNewFile *.md set textwidth=79
" .feature files are Cucumber.
au Bufread,BufNewFile *.feature set filetype=cucumber
hi User1 ctermbg=white ctermfg=black guibg=#89A1A1 guifg=#002B36
hi User2 ctermbg=red ctermfg=white guibg=#aa0000 guifg=#89a1a1
function! GetCWD()
return expand(":pwd")
endfunction
function! IsHelp()
return &buftype=='help'?' (help) ':''
endfunction
function! GetName()
return expand("%:t")==''?'<none>':expand("%:t")
endfunction
"function! s:zen_html_tab()
" let line = getline('.')
" if match(line, '<.*>') >= 0
" return "\<c-y>n"
" endif
" return "\<c-y>,"
"endfunction
"autocmd FileType html imap <buffer><expr><tab> <sid>zen_html_tab()
set statusline=%1*[%{GetName()}]\
set statusline+=%<pwd:%{getcwd()}\
set statusline+=%2*%{&modified?'\[+]':''}%*
set statusline+=%{IsHelp()}
set statusline+=%{&readonly?'\ (ro)\ ':''}
set statusline+=[
set statusline+=%{strlen(&fenc)?&fenc:'none'}\|
set statusline+=%{&ff}\|
set statusline+=%{strlen(&ft)?&ft:'<none>'}
set statusline+=]\
set statusline+=%=
set statusline+=c%c
set statusline+=,l%l
set statusline+=/%L\
set laststatus=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment