-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
163 lines (135 loc) · 4.1 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
set nocompatible
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'chriskempson/base16-vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'gabesoft/vim-ags'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'scrooloose/nerdtree'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-syntastic/syntastic'
call vundle#end() " required
filetype plugin indent on " required
syntax on
" General
set autoindent
set autoread
set encoding=utf-8
set expandtab
set history=1000
set hlsearch
set ignorecase
set incsearch
set laststatus=2 " always show status line
set noswapfile
set number
set ruler
set scrolloff=3 " always have 3 lines showing above/below scroll pos
set shiftwidth=2
set showcmd " extra info in the bottom bar when in visual mode
set showmatch
set smartcase " only do case-sensitive search if there's a cap in the pattern
set softtabstop=2
set tabstop=2
set undofile " remember undo history
set undodir=~/.vim/undofile/
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,node_modules/ " MacOSX/Linux
set wildmenu " fancy autocomplete for commands (try :color <tab> for demo)
set wildmode=longest,list,full
" Security
set modelines=0
set number
set visualbell
set encoding=utf-8
" Mouse/scroll
:set mouse=a
if exists('$TMUX') " Support resizing in tmux
set ttymouse=xterm2
endif
" Paste from clipboard
set clipboard+=unnamed " use the clipboards of vim and win
set paste " Paste from a windows or from vim
set go+=a " Visual selection automatically copied to the clipboard
" Automatically rebalance windows on vim resize
autocmd VimResized * :wincmd =
" Highlight extra (trailing) whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+\%#\@<!$/
" Color stuffs
if &term =~ '256color'
" Disable Background Color Erase (BCE) so that color schemes
" work properly when Vim is used inside tmux and GNU screen.
" See also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
endif
" Remap shortcuts
let mapleader = ','
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" NerdTree
let NERDTreeShowBookmarks=1
let NERDTreeChDirMode=0
let NERDTreeQuitOnOpen=0
let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.pyc','\~$','\.swo$','\.swp$','\.git$','\.hg','\.svn','\.bzr', '\.DS_Store']
let NERDTreeKeepTreeInNewTab=1
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Silver searcher
if executable('ag')
let g:ackprg = 'ag --nogroup --column' " Use in Ack.vim
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' " Use in CtrlP
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|node_modules\|public\/images\|public\/system\|data\|log\|tmp$',
\ 'file': '\.exe$\|\.so$\|\.dat$'
\ }
" 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>
endif
" Syntastic
let g:syntastic_always_populate_loc_list=1
let g:syntastic_auto_loc_list=1
let g:syntastic_enable_signs=0
let syntastic_mode_map = { 'passive_filetypes': ['html', 'less'] }
let g:syntastic_python_checkers=['pyflakes']
let g:syntastic_javascript_checkers=['jshint']
" JSXHint, used for React JSX files
if executable('jsxhint')
let g:syntastic_javascript_checkers=['jsxhint']
endif
" Virtualenvs
let g:virtualenv_auto_activate = 1
" Cursor motion
set scrolloff=3
set backspace=indent,eol,start
set matchpairs+=<:> " use % to jump between pairs
runtime! macros/matchit.vim
" Allow hidden buffers
set hidden
" Rendering
set ttyfast
" 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