Skip to content

Instantly share code, notes, and snippets.

@mikaa123
Created October 10, 2014 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaa123/6c65f1b5bc3362cba571 to your computer and use it in GitHub Desktop.
Save mikaa123/6c65f1b5bc3362cba571 to your computer and use it in GitHub Desktop.
.vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
Plug 'whatyouhide/vim-gotham'
Plug 'https://github.com/kien/ctrlp.vim.git'
Plug 'tpope/vim-sensible'
Plug 'https://github.com/vim-scripts/Smart-Tabs'
Plug 'bling/vim-airline'
Plug 'git://github.com/tpope/vim-fugitive.git'
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/syntastic'
Plug 'git://github.com/tpope/vim-surround.git'
Plug 'https://github.com/scrooloose/nerdtree.git'
Plug 'https://github.com/vim-scripts/HTML-AutoCloseTag'
Plug 'mattn/emmet-vim'
Plug 'https://github.com/wavded/vim-stylus'
call plug#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
colorscheme gotham
set cursorline
set hlsearch
" Indent using tabs
set shiftwidth=4
set tabstop=4
" This shows hidden characters
set list
" Other
set number
set colorcolumn=80
" No backup/swap
set nobackup
set noswapfile
set ignorecase smartcase
" History
set hidden
set history=1000
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Configurations
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = ","
" Switch back and forth from buffer
map ,, <C-^>
" Fast approximative movement
map <c-j> 10j
map <c-k> 10k
" Ctrl D in insert mode is Del
imap <C-D> <C-O>x
" Makes sure pressing C-c triggers events
imap <C-c> <Esc>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Syntax checker
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:syntastic_javascript_checkers = ['jshint', 'jscs']
" Makes sure json files are treated as such.
au BufRead,BufNewFile *.json set filetype=json
let g:syntastic_json_checkers = ['jsonlint']
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Better searching with The Silver Searcher
" http://robots.thoughtbot.com/faster-grepping-in-vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
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
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" bind \ (backward slash) to grep shortcut
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag<SPACE>
" Clear the search buffer when hitting space
function! MapSpace()
nnoremap <space> :nohlsearch<cr>
endfunction
call MapSpace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment