-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
281 lines (232 loc) · 6.94 KB
/
init.vim
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
set nocompatible " be iMproved, required
set backspace=indent,eol,start
filetype off " required
" Specify a directory for plugins
call plug#begin('~/.local/share/nvim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'ervandew/supertab'
Plug 'tpope/vim-surround'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'ntpeters/vim-better-whitespace'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'jiangmiao/auto-pairs'
Plug 'mattn/webapi-vim'
Plug 'chriskempson/base16-vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'editorconfig/editorconfig-vim'
Plug 'DataWraith/auto_mkdir'
"Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'mileszs/ack.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'mustache/vim-mustache-handlebars'
Plug 'christoomey/vim-tmux-navigator'
Plug 'vim-scripts/nagios-syntax'
Plug 'jpalardy/vim-slime'
Plug 'reedes/vim-thematic'
Plug 'jnurmine/zenburn'
Plug 'kristijanhusak/vim-hybrid-material'
Plug 'Shougo/deoplete.nvim'
Plug 'padawan-php/deoplete-padawan'
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
Plug 'neomake/neomake'
Plug 'othree/jspc.vim'
Plug 'edkolev/tmuxline.vim'
Plug 'wincent/loupe'
Plug 'Shougo/denite.nvim'
Plug 'chemzqm/vim-easygit'
Plug 'chemzqm/denite-git'
Plug 'cakebaker/scss-syntax.vim'
Plug 'leafgarland/typescript-vim'
Plug 'sbdchd/neoformat'
call plug#end() " required
filetype plugin indent on
syntax on
set cursorline
set scrolloff=3
" Activate deoplete by default
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_ignore_case = 1
let g:deoplete#enable_smart_case = 1
let g:deoplete#enable_camel_case = 1
let g:deoplete#enable_refresh_always = 1
let g:deoplete#auto_completion_start_length = 1
"let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{})
"let g:deoplete#omni#input_patterns.php = [
"\'[^. \t0-9]\->\w*',
"\'[^. \t0-9]\::\w*',
"\]
let g:deoplete#ignore_sources = {}
call deoplete#custom#set('_', 'matchers', ['matcher_full_fuzzy'])
"call deoplete#custom#set('omni', 'mark', '')
"let g:deoplete#omni#functions = {}
"let g:deoplete#omni#functions.javascript = [
"\ 'tern#Complete',
"\ 'jspc#omni'
"\]
"let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
let g:neomake_javascript_enabled_makers = ['eslint']
let g:neomake_php_enabled_makers = ['php', 'phpcs']
let g:deoplete#sources#padawan#server_autostart=0
let mapleader=","
set background=dark
let base16colorspace=256
"colorscheme base16-ocean
" Line numbers - Use relative line numbers except for current line
set relativenumber
set number
set hlsearch " highlight search
set incsearch " search incrementally
set autoread " automatically read changes from the filesystem
" Turn off backups and their ilk
set nobackup
set noswapfile
" Smart indentation
set autoindent
set smartindent
" Ignore case when searching
set ignorecase
" Ignore case only when pattern is all lowercase
set smartcase
" Turn off the ugly pipes separating splits
set fillchars=""
" Automatically write when overwriting a buffer. #yolo
set autowriteall
" No bells, visual or otherwise
set noerrorbells visualbell t_vb=
" Show the cmd at the bottom of the screen
set showcmd
" splits the right way
set splitright
set splitbelow
" e Sane tabs
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
" Ensure file saves get picked up properly by webpack, et al
set backupcopy=yes
" Lower update time for git-gutter's sake
set updatetime=1000
" Always show status
set laststatus=2
" Use system clipboard for yanks, deletes, puts
set clipboard+=unnamedplus
" Airline settings
let g:airline_powerline_fonts = 1
let g:airline_theme='base16'
let g:airline_right_sep = ''
function! AirlineInit()
let g:airline_section_x = ''
let g:airline_section_y = ''
let g:airline_section_z = ''
endfunction
autocmd User AirlineAfterInit call AirlineInit()
" JSX
let g:jsx_ext_required = 0
highlight link xmlEndTag xmlTag
" needed so you can jump to files from hound results
set includeexpr=substitute(v:fname,'_','/','g')
set suffixesadd+=.php
" UltiSnips
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsListSnippets = '<c-tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
let g:UltiSnipsSnippetsDir = "~/.vim/UltiSnips"
" ack.vim
" Use silver searcher if available
if executable('ag')
let g:ackprg = 'ag --nogroup --nocolor --column'
endif
" mustache abbreviations
let g:mustache_abbreviations = 1
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": "default", "target_pane": ":.2"}
let g:slime_dont_ask_default = 1
let g:thematic#defaults = {
\ 'airline-theme': 'base16',
\ 'background': 'dark',
\ }
let g:thematic#themes = {
\ 'ocean': {'colorscheme': 'base16-ocean',
\ },
\ 'zen': {'colorscheme': 'zenburn',
\ },
\ 'material': {'colorscheme': 'hybrid_reverse',
\ 'airline-theme': 'serene',
\ },
\ }
let g:thematic#theme_name = 'material'
let g:NERDTreeShowHidden = 1
" Mappings
nmap <Leader>ev :e $MYVIMRC<cr>
nmap <Leader>1 :NERDTreeToggle<cr>
nmap <Leader>f :NERDTreeFind<cr>
nmap <c-R> :BTags<cr>
nmap <c-E> :History<cr>
nnoremap <Leader>b :Buffers<cr>
nmap <Leader><space> :nohlsearch<cr>
nmap <c-P> :Files<cr>
nmap <c-S> :w<cr>
noremap <leader>x :bd<CR>
noremap <leader>w :w<CR>
nnoremap j gj
nnoremap k gk
nnoremap ; :
inoremap jj <ESC>
inoremap kk <ESC>:w<CR>
" map 0 to first non-blank character
map 0 ^
" b/c shift-4 is not comfortable
map 4 $
" Move lines up/down
inoremap <c-j> <Esc>:m .+1<CR>==gi
inoremap <c-k> <Esc>:m .-2<CR>==gi
vnoremap <c-j> :m '>+1<CR>gv=gv
vnoremap <c-k> :m '<-2<CR>gv=gv
" Sane window navigation
nnoremap <C-J> <C-W>j<C-W>_
nnoremap <C-K> <C-W>k<C-W>_
map <C-L> <C-W>l<C-W>_
map <C-H> <C-W>h<C-W>_
" Auto indent pasted text
nnoremap p p=`]<C-o>
nnoremap P P=`]<C-o>
" Creating file in current buffer's directory
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" Replace current word
nnoremap <Leader>r :%s/\<<C-r><C-w>\>//g<Left><Left>
" Quick indendation fix for the current line
nnoremap > <S-V>><Esc>
nnoremap < <S-V><<Esc>
autocmd FileType typescript setlocal formatprg=prettier\ --parser\ typescript\ --stdin\ --single-quote\ --trailing-comma\ es5
autocmd FileType javascript setlocal formatprg=prettier\ --stdin\ --single-quote\ --trailing-comma\ es5
let g:neoformat_try_formatprg = 1
" Autosource .vimrc after changes
augroup autosourcing
autocmd!
autocmd BufWritePost init.vim source %
autocmd BufWritePre * StripWhitespace
autocmd BufEnter,BufWritePost * Neomake
autocmd BufWritePre *.ts,*.js Neoformat
augroup END
if has("persistent_undo")
set undodir=~/.undodir/
set undofile
endif
"
" MACROS
"
" Convert node requires to ES6 imports
let @e='0ciwimportf=ciwfromwdf(f)xj'
let $FZF_DEFAULT_COMMAND = 'ag -l -g ""'
let g:python_host_prog = '/usr/bin/python'