-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
247 lines (210 loc) · 8.02 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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
set nocompatible " be iMproved, required
" -------------------------------------------------------------------
" Begin Plugins
" -------------------------------------------------------------------
" Use 'junegunn/vim-plug' for package management
call plug#begin('~/.vim/plugged')
" Fuzzy File Finding
" Let's try fzf for new goodness
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
" Navigation
Plug 'wincent/ferret' " Enhanced multi-file search via an :Ack command for searching across multiple files using The Silver Searcher
Plug 'jeetsukumaran/vim-filebeagle' " similar to vim-vinegar, but avoids nasty netrw bug leaving buffers open
" Commands
Plug 'tomtom/tcomment_vim' " file-type sensible default comments
Plug 'ervandew/supertab' " tab-completion (code completion see YouCompleteMe)
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat' " allows vim-surround to be repeated with the . command
Plug 'moll/vim-bbye' " :Bdelete command that behaves like a well designed citizen
Plug 'janson/bufonly.vim'
" UI Additions
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'kien/rainbow_parentheses.vim'
" Language Additions
" Language pack
" Plug 'sheerun/vim-polyglot' " un-maintained as of 2017
" Backend
Plug 'vim-ruby/vim-ruby'
Plug 'StanAngeloff/php.vim'
" Middle
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
" Front
Plug 'othree/html5.vim'
Plug 'Glench/Vim-Jinja2-Syntax' " for twig
" Other
Plug 'elzr/vim-json'
Plug 'plasticboy/vim-markdown'
" Lint
Plug 'w0rp/ale'
Plug 'editorconfig/editorconfig-vim'
" Color
Plug 'w0ng/vim-hybrid'
Plug 'lifepillar/vim-solarized8' " instead of 'official' @altercation
Plug 'arcticicestudio/nord-vim'
" Writing
"Plug 'reedes/vim-pencil'
"Plug 'reedes/vim-colors-pencil'
"Plug 'junegunn/goyo.vim'
" Add plugins to &runtimepath
call plug#end()
" -------------------------------------------------------------------
" Global VIM Settings (No Plugins Needed)
" -------------------------------------------------------------------
filetype on
syntax on
set ruler
set re=1 " use a non-broken regex engine
set encoding=utf-8
" ---------------------------------
" Whitespace stuff
" ---------------------------------
set tabstop=2
set softtabstop=2
set shiftwidth=2
set shiftround " indents to the next multiple of 'shiftwidth'
set expandtab
set wrap
set linebreak " don't wrap words
set textwidth=0 " don't break lines that are too long
set backspace=indent,eol,start " allow backspacing over everying in insert
set autoindent " always set autoindenting on
set clipboard+=unnamed " yank to system clipboard
" ---------------------------------
" Searching
" ---------------------------------
set incsearch " highlight while searching with / or ?
set ignorecase
set smartcase
set hlsearch " keep matches highlighted
nmap <leader>q :nohlsearch<CR> " clear the highlight
set showcmd " display incomplete commands
set showmatch " show matching braces
" ---------------------------------
" Tab completion
" ---------------------------------
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc " keep out source control & related
set wildignore+=*/tmp/*,*/cache/*,*.so,*.swp
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
set iskeyword+=- " adds hyphen and en dash to list of characters considered _part_ of a word
set complete=.,w,b,u,t
set completeopt=longest,menuone,preview
" ---------------------------------
" History
" ---------------------------------
set history=500 " keep 500 lines of command line history
set autowrite " write before hiding a buffer
set hidden " retains state of unsaved buffer w/out writing to disk
set undolevels=1000 " 1000 undo levels
set noswapfile " nah, I don't want a swap file
" ---------------------------------
" Bling
" ---------------------------------
set timeoutlen=250 " time to wait after ESC
set ttyfast " faster redrawing
set lazyredraw " only redraw when necessary
set cf " Enable error files & error jumping.
set wildmenu " show other options for tab completion
set title " sets terminal title
set visualbell " visual indication instead of audible
set t_Co=256 " enable 256 colorschemes in non gui
set cursorline " highlights current line, visually speaking
set list " show invisible chars
set listchars=tab:▸\ ,eol:¬ " add extra bling for tabs & end of lines
set termguicolors
" ---------------------------------
" Folding
" ---------------------------------
set foldmethod=indent " why is syntax so unreliable?
set foldlevelstart=3
set foldignore='' " default settings ignore '#' used in css
" ---------------------------------
" Bindings
" ---------------------------------
" Remap stupid Ex mode shortcut to repeat the last used macro.
nmap Q @@
" rebind ESC to something a) more ergonomic b) not likely to be used
" can also use CTRL-[, which is built into vim
"inoremap jk <Esc>
"cnoremap jk <Esc>
"vnoremap jk <Esc>
" train the remapping, idea borrowed from
" http://learnvimscriptthehardway.stevelosh.com/chapters/10.html
"inoremap <esc> <nop>
" up-down by row, not line
nmap j gj
nmap k gk
" Command-][ to increase/decrease indentation
vmap <D-]> >gv
vmap <D-[> <gv
" Reformat JSON
nmap <Leader>j :%!python -m json.tool
" ---------------------------------
" File Types
" ---------------------------------
au BufRead,BufNewFile {Gemfile,Rakefile,Isolate,config.ru} set ft=ruby
au BufRead,BufNewFile {htaccess} set ft=apache
au BufRead,BufNewFile *.twig set ft=jinja.html
" Constraining columns in commit messages to 72 cols.
" cref. https://chris.beams.io/posts/git-commit/
autocmd FileType gitcommit set textwidth=72
autocmd FileType gitcommit set colorcolumn=73
" ---------------------------------
" Writing
" ---------------------------------
"augroup pencil
"autocmd!
"autocmd FileType markdown,mkd,text call pencil#init()
"colorscheme pencil
"let g:airline_theme = 'pencil'
"augroup END
" -------------------------------------------------------------------
" Plugin Settings
" -------------------------------------------------------------------
" Fuzzy-find with fzf
nmap ; :Buffers<CR>
nmap <Leader>t :Files<CR>
nmap <Leader>r :Tags<CR>
" tcomment_vim
" leader-c is the prefix for code related mappîngs
" instead of `gc`
noremap <silent> <Leader>cc :TComment<CR>
" vim-bbye
noremap :BD :Bdelete
" vim-javascript
let javascript_enable_domhtmlcss=1
" vim-json
let g:vim_json_syntax_conceal = 0
" vim-markdown
let g:vim_markdown_initial_foldlevel=2
" netrw
"let g:netrw_liststyle = 3 " tree style listing
let g:netrw_liststyle = 1 " single list w/ detail
" file-beagle
let g:filebeagle_show_hidden = 1 " Show hidden and (wild-)ignored files by default (can be toggled when viewing a directory using 'gh').
" Powerline / Airline
set ttimeoutlen=10 " speed up delay when entering normal mode
set laststatus=2 " Always show the statusline
" Airline
let g:airline_skip_empty_sections = 1 " Do not draw separators for empty sections (only for the active window)
let g:airline_powerline_fonts = 0 " automatically populate g:airline_symbols with powerline symbols
"let g:airline_section_a = '' " defaults are: mode, crypt, paste, spell, iminsert
let g:airline_section_y = '' " defaults are: fileencoding, fileformat
let g:airline_section_warning = '' " defaults are: ycm_warning_count, whitespace
let g:airline#extensions#tagbar#enabled = 0 " Disable airline tagbar for faster opening times
" Colorschemes
if !has('gui_running')
"set background=dark
" - modified solarized
let g:solarized_term_italics = 1 " set to 1 to enable italics in the terminal (default is 0)
let g:solarized_visibility = "low" " less in-yo-face invisible chars
colorscheme solarized8_high
" - nord (dark)
"let g:nord_italic = 1
"let g:nord_italic_comments = 1
"colorscheme nord " all settings need to be set prior to scheme activation
endif