Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
237 lines (183 sloc) 4.78 KB
" Set up packages with Pathogen "
source ~/dotfiles/vim/bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect('bundle/{}', '~/dotfiles/vim/bundle/{}')
runtime macros/matchit.vim
set nocompatible
if has("autocmd")
filetype plugin indent on
autocmd BufNewFile,BufRead *.es6 set filetype=javascript
"autocmd FileType html,php setlocal expandtab shiftwidth=4 softtabstop=4
" Settings "
set encoding=utf-8
scriptencoding utf-8
set backspace=eol,start,indent
set display+=lastline
set guitablabel=%t
set history=100
set hlsearch
set iskeyword+=-
set laststatus=2
set magic
set number
set relativenumber
set nocursorline
set nowrap
set ruler
set showmatch
set showmode
set textwidth=0
set whichwrap+=<,>,h,l
set wildmenu
set backupdir=~/.vim/tmp/backup
set directory=~/.vim/tmp/swap
set undodir=~/.vim/tmp/undo
set nobackup
set nowritebackup
set noswapfile
" Code folding "
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=2
" Syntax Highlighting "
syntax enable
let html_no_rendering=1
"let base16colorspace=256
"colorscheme base16-ocean
set background=dark
set guifont=Hack:h16
highlight Comment cterm=italic
" Whitespace "
set expandtab
set shiftwidth=2
set smarttab
set tabstop=2
set ai " Auto indent
set si " Smart indent
set wrap " Wrap lines
" Mappings "
let mapleader="\<Space>"
" Edit vimrc file
nmap <Leader>vr :sp $MYVIMRC<CR>
nmap <Leader>so :source $MYVIMRC<CR>
" Duplicate line
nmap <Leader>d yyp
" Move lines
nmap <Leader>j ddp
nmap <Leader>k kddpk
" Clear line
nmap <Leader>co cc<Esc>
" Open line under current line
nmap <Leader>o o<Esc>
" Tab/pane shortcuts
nmap <Leader>tn :tabnew<CR>
nmap <Leader>tc :tabc<CR>
nmap <Leader>pv :vsplit<CR>
nmap <Leader>ph :split<CR>
nmap <Leader>pc :close<CR>
" Moving in tabs
nmap <C-H> :tabp<CR>
nmap <C-L> :tabn<CR>
" Moving tabs
nmap <Leader>th :tabm -1<CR>
nmap <Leader>tl :tabm +1<CR>
" Exit modes more easily
imap jk <Esc>
imap kj <Esc>
" Quick jump to start/end of lines
nmap <Leader>l $
nmap <Leader>h ^
" Clear highlighted search
nmap <silent> <Leader>/ :nohlsearch<CR>
" Make splits a bit more manageable
nnoremap <Leader>1 :vs<CR><C-w>l
nnoremap <Leader>2 :split<CR><C-w>j
nnoremap <C-Up> :bn<CR>
nnoremap <C-Down> :bp<CR>
" Strip all trailing spaces
nmap <Leader>sw :StripWhitespace<CR>
" Copy/paste inside quotes
nmap <Leader>y yi"
nmap <Leader>p vi"p
cnoreabbrev w. w %:h/
" Open file in Finder "
function! s:RevealInFinder()
if filereadable(expand("%"))
let l:command = "open -R %"
elseif getftype(expand("%:p:h")) == "dir"
let l:command = "open %:p:h"
let l:command = "open ."
execute ":silent! !" . l:command
" For terminal Vim not to look messed up.
command! Reveal call <SID>RevealInFinder()
nmap <Leader>r :Reveal<CR>
" Plugins "
map <C-n> :NERDTreeToggle<CR>
map <Leader>e :NERDTreeFind<CR>
let g:NERDTreeIgnore=['\~$', '^tmp$[[dir]]', '^.git$[[dir]]', '^.sass-cache$[[dir]]', '.DS_Store']
let g:NERDTreeShowHidden=1
let g:NERDSpaceDelims=1
let g:NERDCommentEmptyLines=1
let g:NERDTrimTrailingWhitespace=1
let g:ctrlp_map='<c-p>'
let g:ctrlp_cmd='CtrlP'
let g:ctrlp_switch_buffer=0
let g:ctrlp_working_path_mode=0
let g:ctrlp_use_caching=0
let g:ctrlp_show_hidden=1
if executable('ag')
let g:ackprg='ag --vimgrep --case-sensitive'
let g:ctrlp_user_command='ag %s --nocolor --nogroup --hidden
\ --ignore .git
\ --ignore .svn
\ --ignore .hg
\ --ignore .DS_Store
\ --ignore .svg
\ --ignore "**/*.pyc"
\ -g ""'
cnoreabbrev Ack Ack!
nnoremap <Leader>a :Ack!<Space>
cnoreabbrev Ag Ack!
cnoreabbrev Ag! Ack!
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.map,*.svg
let g:netrw_liststyle=3
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#fnamemod=':t'
let g:airline#extensions#tabline#show_buffers=0
let g:airline#extensions#tabline#fnamecollapse=0
let g:airline#extensions#tabline#show_tab_nr=1
let g:airline#extensions#tabline#tab_nr_type=1 " tab number
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list=1
let g:syntastic_auto_loc_list=1
let g:syntastic_check_on_open=1
let g:syntastic_check_on_wq=0
let g:syntastic_ignore_files=['\.html$', '\c\.h$', '\.css$', '\.hbs', '\.scss', '\.erb']
let g:syntastic_ruby_mri_exec = '~/.rvm/rubies/ruby-2.2.4/bin/ruby'
let g:mustache_abbreviations=1
let g:markdown_fenced_languages=['html', 'python', 'ruby', 'bash=sh', 'css']