Last active
April 5, 2016 21:37
-
-
Save simonista/8605335 to your computer and use it in GitHub Desktop.
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
set nocompatible | |
filetype off " needed to load vundle | |
" Manage plugins with vundle | |
" run :PluginInstall (or vim +PluginInstall +qall on cli) | |
set rtp+=~/.vim/bundle/Vundle.vim/ | |
call vundle#rc() | |
Plugin 'gmarik/vundle' | |
" Security | |
set modelines=0 | |
set number | |
set ruler | |
set visualbell | |
" Leader | |
let mapleader = "," | |
" Encoding | |
set encoding=utf-8 | |
" Whitespace | |
set wrap | |
set textwidth=79 | |
set formatoptions=tcqrn1 | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
set noshiftround | |
map <leader>l :set list!<CR> " Toggle tabs and EOL | |
" set list " To enable by default | |
set listchars=tab:▸\ ,eol:¬ " Same symbols as TextMate for tabs and EOL | |
" Persistent Undo | |
set undodir=~/.vim/undo | |
set undofile | |
" Store backup stuff elsewhere | |
set backupdir=~/.vim/backup | |
set directory=~/.vim/swap | |
" Tab completion | |
set wildmenu | |
set wildmode=list:longest,full | |
set wildignore+=*.swp,*.bak,*.pyc,*.class | |
" Cursor motion | |
set scrolloff=3 | |
" set autoindent | |
set backspace=indent,eol,start | |
set matchpairs+=<:> " use % to jump between pairs | |
runtime macros/matchit.vim | |
nmap <tab> % | |
" vmap <tab> % | |
" Move up/down editor lines | |
nnoremap j gj | |
nnoremap k gk | |
" Easy buffer navigation | |
map <C-h> <C-w>h | |
map <C-j> <C-w>j | |
map <C-k> <C-w>k | |
map <C-l> <C-w>l | |
map <leader>w <C-w>v<C-w>l | |
" Allow hidden buffers | |
set hidden | |
" Rendering | |
set ttyfast | |
" Status bar | |
set laststatus=2 | |
" Last line | |
set showmode | |
set showcmd | |
" Searching | |
nnoremap / /\v | |
vnoremap / /\v | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
set showmatch | |
map <leader><space> :let @/=''<cr> " clear search | |
" Substitution | |
set gdefault " sub all on line by default | |
" Remap help key. | |
inoremap <F1> <ESC>:set invfullscreen<CR>a | |
nnoremap <F1> :set invfullscreen<CR> | |
vnoremap <F1> :set invfullscreen<CR> | |
" Remember last location in file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal g'\"" | endif | |
endif | |
" Treat Actionscript(.as) and JSON(.json) files like javascript | |
au BufNewFile,BufRead *.as set ft=javascript | |
au BufNewFile,BufRead *.json set ft=javascript | |
" Various syntax stuff | |
au BufRead,BufNewFile *.less set ft=less | |
au BufRead,BufNewFile *.scss set ft=scss | |
au BufRead,BufNewFile /etc/nginx/conf/* set ft=nginx | |
au BufRead,BufNewFile /etc/nginx/sites-available/* set ft=nginx | |
au BufRead,BufNewFile /usr/local/etc/nginx/sites-available/* set ft=nginx | |
" Thorfile, Rakefile and Gemfile are Ruby | |
au BufRead,BufNewFile {Gemfile,Rakefile,Capfile,Thorfile,Guardfile,Vagrantfile,Puppetfile,config.ru} set ft=ruby | |
" md, markdown, and mk are markdown and define buffer-local preview | |
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} map <buffer> <Leader>p :Mm <CR> | |
function s:pythonSettings() | |
setlocal sw=4 | |
setlocal ts=4 | |
setlocal sts=4 | |
setlocal expandtab | |
endfunction | |
autocmd BufReadPost *.py call s:pythonSettings() | |
" Clean whitespace | |
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
let _s = @/ | |
%s/\s\+$//e | |
let @/ = _s | |
call cursor(l, c) | |
endfun | |
map <leader>W :call <SID>StripTrailingWhitespaces()<CR> | |
" :au InsertEnter * match Todo /\s\+\%#\@<!$/ | |
" :au InsertLeave * match Todo /\s\+$/ | |
" Taglist with Exuberant ctags! | |
let Tlist_Ctags_Cmd = "/usr/local/bin/ctags" | |
let Tlist_WinWidth = 50 | |
let Tlist_Use_Right_Window = 1 | |
map <F4> :TlistToggle<cr> | |
map <Leader>rt :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<cr> | |
map <leader>] :vsp <CR>:exec("tag ".expand("<cword>"))<CR> | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'powerline/powerline', {'rtp': 'powerline/bindings/vim/'} | |
" Plugin 'Lokaltog/vim-powerline' | |
" let g:Powerline_symbols = 'fancy' | |
" dependency for gist.vim | |
Plugin 'mattn/webapi-vim' | |
Plugin 'mattn/gist-vim' | |
let g:gist_clip_command = 'pbcopy' | |
let g:gist_detect_filetype = 1 | |
Plugin 'ctrlpvim/ctrlp.vim' | |
let g:ctrlp_map = '<leader>t' | |
let g:ctrlp_use_caching = 1 | |
let g:ctrlp_clear_cache_on_exit = 0 | |
let g:ctrlp_cache_dir = $HOME.'/.vim/ctrlpcache' | |
" map <leader>tx :CtrlPClearCache<cr> | |
Plugin 'scrooloose/nerdtree' | |
map <leader>n :NERDTreeToggle<cr> | |
let NERDTreeIgnore=['.vim$', '\~$', '.*\.pyc$', 'pip-log\.txt$'] | |
" let g:NERDTreeBookmarks = $HOME.'/.vim/.NERDTreeBookmarks' | |
Plugin 'nathanaelkane/vim-indent-guides' | |
" <Leader>ig (default mapping) | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'mileszs/ack.vim' | |
" :Ack [options] {pattern} [{directory}] | |
" Use Ag with ack.vim | |
let g:ackprg = 'ag --nogroup --nocolor --column' | |
Plugin 'fatih/vim-go' | |
" format with goimports instead of gofmt | |
" let g:go_fmt_command = "goimports" | |
" Plugin 'Valloric/YouCompleteMe' | |
Plugin 'ap/vim-css-color' | |
Plugin 'tpope/vim-rails' | |
Plugin 'jergason/scala.vim' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'kchmck/vim-coffee-script' | |
Plugin 'tpope/vim-markdown' | |
Plugin 'tpope/vim-haml' | |
Plugin 'mustache/vim-mustache-handlebars' | |
Plugin 'juvenn/mustache.vim' | |
Plugin 'skwp/vim-rspec' | |
Plugin 'tpope/vim-git' | |
Plugin 'rodjek/vim-puppet' | |
" Colorschemes | |
Plugin 'chriskempson/tomorrow-theme', {'rtp': 'vim/'} | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'vim-scripts/desert256.vim' | |
Plugin 'vim-scripts/bclear' | |
syntax on | |
filetype plugin indent on | |
" Yankring | |
" let g:yankring_history_dir = expand('$HOME/.vim/bundle/yankring_110') | |
" nnoremap <silent> <F3> :YRShow<cr> | |
" nnoremap <silent> <leader>y :YRShow<cr> | |
" Formatting, TextMate-style | |
map <leader>q gqip | |
nmap <leader>m :make<cr> | |
" Run spec under the cursor | |
nmap <leader>r :wa <CR> :execute "!bundle exec rspec " . expand('%') . ':' . line('.')<CR> | |
" Easier linewise reselection | |
map <leader>v V`] | |
" Faster Esc | |
inoremap kj <ESC> | |
" Scratch | |
nmap <leader><tab> :Sscratch<cr><C-W>x<C-j>:resize 15<cr> | |
" Edit .vimrc | |
nmap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr> | |
" Sudo to write | |
cmap w!! w !sudo tee % >/dev/null | |
" Shouldn't need shift | |
nnoremap ; : | |
" Save when losing focus | |
au FocusLost * :wa | |
" Stop it, hash key | |
inoremap # X<BS># | |
" Stop it, Y | |
nnoremap Y y$ | |
map <D-t> :CtrlP<CR> | |
imap <D-t> <Esc>:CtrlP<CR> | |
" Color scheme (terminal) | |
set t_Co=256 | |
set guifont=Menlo\ for\ Powerline:h14 | |
set background=dark | |
let g:solarized_termcolors=256 | |
let g:solarized_termtrans=1 | |
colorscheme solarized | |
" colorscheme desert | |
" colorscheme mustang | |
" colorscheme Tomorrow-Night-Eighties |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment