forked from vitorleal/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
232 lines (162 loc) · 4.3 KB
/
.vimrc
File metadata and controls
232 lines (162 loc) · 4.3 KB
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
" no vi compatibility
set nocp
" PLUGINS
" ==============================================
" my plugins config file path
let $MYPLUGINS = '~/.vim/plugins.vim'
" load plugins managed by vundle
exe 'so '.$MYPLUGINS
" EDITION
" ==============================================
syntax enable
" basic edition stuff on
syntax on
filetype on
filetype plugin on
filetype indent on
"color options
set background=dark
let g:gruvbox_contrast_dark="hard"
color gruvbox
" use unix as standard file type
set fileformats=unix,dos,mac
" always set autoindenting on
set autoindent
" good when starting a new line
set smartindent
" fill tabs with spaces
set expandtab
" 2 spaces everywhere please!
set tabstop=2
set softtabstop=2
set shiftwidth=2
" copy the previous indentation on autoindenting
set copyindent
" don't wrap lines
set nowrap
" show line numbers
set number
" highlight current line
set cursorline
" auto load files when hanged outside of Vim
set autoread
" allow hidden buffers
set hidden
" color trailing whitespace
hi TrailWhitespace ctermbg=198 guibg=#f62c73
match TrailWhitespace /\s\+$\| \+\ze\t/
" use many undos
set undolevels=1000
" do not syntax highlight too long lines
set synmaxcol=500
" keep selection to indent/outdent
vnoremap < <gv
vnoremap > >gv
" join lines with cursor staying in place
nnoremap J mzJ`z
set backupskip=/tmp/*,/private/tmp/*
" SCROLLING
" ==============================================
" show more lines around cursor when at the edge of file
set scrolloff=3
set sidescrolloff=5
" scroll viewport faster
nnoremap <c-e> 5<c-e>
nnoremap <c-y> 5<c-y>
vnoremap <c-e> 5<c-e>
vnoremap <c-y> 5<c-y>
" keep cursor in position when moving around
set nostartofline
" MAPPINGS
" ==============================================
" change the mapleader from \ to ,
let mapleader=","
" delete all buffers
map <silent> <leader>wp :1,9999bwipeout<cr>
" SPLITS
" ==============================================
" always do vertical splits at right side
" and horizontal splits below
set splitright splitbelow
" equally resize splits on window resize
au! VimResized * :wincmd =
" only have cursorline in current window
au! WinLeave * set nocursorline
au! WinEnter * set cursorline
" open all buffers in vertical split
map <silent> <leader>vb :vertical :ball<cr>
" SEARCH
" ==============================================
" ignore case when searching
set ignorecase
" ignore case if search pattern is all lowercase, case-sensitive otherwise
set smartcase
" highlight search when typing
set incsearch
" highlight search terms
set hlsearch
" do not highlight when vim starts
nohls
" hide search highlight
nnoremap <silent> <leader>0 :nohls<cr>
" center search
nmap n nzz
nmap N Nzz
" TERMINAL
" ==============================================
" wider number width
set numberwidth=6
" disable blinking cursor
set guicursor=a:blinkon0
" always show status bar
set laststatus=2
" higher command line
set cmdheight=2
" get rid of separation chars
set fillchars=""
" http://items.sjbach.com/319/configuring-vim-right
set wildmenu
" set terminal title
set title
" auto cd to the current buffer directory
set autochdir
" no backup/swap files
set nobackup noswapfile
" shorten vim messages
" see :h shortmess for the breakdown of what this changes
set shortmess=atI
" stop annoying noise
set visualbell
" restore messed up vim and splits
map <F5> :redraw!<cr><c-w>=
" FOLDS
" ==============================================
set foldmethod=syntax
" do not fold automatically
set nofoldenable
" SIDEBAR
" =============================================
map <Leader>s :NERDTreeToggle<CR>
let NERDTreeIgnore = ['\.pyc$']
" NAVIGATION
" ==============================================
" easy window 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
" move the cursor in insert mode
imap <c-h> <c-o>h
imap <c-j> <c-o>j
imap <c-k> <c-o>k
imap <c-l> <c-o>l
" AUTOCOMMANDS
" ==============================================
" remove unwanted trailling spaces on save
au! BufWritePre * :%s/\s\+$//e
" set current path to current file parent directory for better use of :find
au! BufEnter * silent! let &path = expand('%:p:h') . '/**'
au BufNewFile,BufRead *.ejs set filetype=html
" CONTROL P
" ==============================================
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)|(node_modules|ENV|bower_components)$'