-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
337 lines (283 loc) · 8.69 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
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Plugin 'tpope/vim-sensible'
Plugin 'posva/vim-vue' " Highlighting for vue components
Plugin 'ctrlpvim/ctrlp.vim'
" Plugin 'blueshirts/darcula'
" Plugin 'guns/jellyx.vim'
Plugin 'robertmeta/nofrils'
Plugin 'pangloss/vim-javascript' " Better js highlighting
Plugin 'isRuslan/vim-es6' " Better es6 highlighting
Plugin 'captbaritone/better-indent-support-for-php-with-html'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'othree/html5.vim'
Plugin 'Yggdroot/indentLine' " Adds vertical guides
Plugin 'tmhedberg/matchit' " Extends % for tags, etc
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Plugin 'SirVer/ultisnips' " Snippets
Plugin 'honza/vim-snippets' " Needed for ultisnips
Plugin 'vim-airline/vim-airline'
Plugin 'gioele/vim-autoswap' " Removes nasty swap thingy in vim
Plugin 'moll/vim-bbye' " Adds :Bclose command that closed buffer
Plugin 'tpope/vim-bundler'
" Plugin 'alvan/vim-closetag'
Plugin 'kchmck/vim-coffee-script'
" Plugin 'xolox/vim-easytags' " Automatic ctags generation
Plugin 'tpope/vim-endwise' " Adds 'end' completion in ruby
Plugin 'tommcdo/vim-exchange' " Adds methods to swap text (exchange)
Plugin 'tpope/vim-fugitive' " Git commands in vim
" Plugin 'takac/vim-hardtime'
Plugin 'austintaylor/vim-indentobject' " To manipilate objects on same indent level
Plugin 'briancollins/vim-jst' " For jst/ejs syntax
Plugin 'tpope/vim-repeat' " Extends dot capabilities
Plugin 'vim-ruby/vim-ruby'
" Plugin 'xolox/vim-session' " For remembering working session
Plugin 'tpope/vim-sleuth' " For auto adjusting tab width
Plugin 'tpope/vim-surround'
Plugin 'xolox/vim-misc'
" Plugin 'ap/vim-buftabline' " Tabline
Plugin 'preservim/nerdcommenter'
" Plugin 'scrooloose/syntastic'
" Plugin 'mtscout6/syntastic-local-eslint.vim'
Plugin 'maksimr/vim-jsbeautify'
" Plugin 'mattn/emmet-vim'
Plugin 'tpope/vim-vinegar'
Plugin 'elixir-lang/vim-elixir'
Plugin 'jlanzarotta/bufexplorer'
" Plugin 'roxma/vim-paste-easy'
Plugin 'vim-autoformat/vim-autoformat'
call vundle#end()
set encoding=utf8
set background=dark
set t_Co=256
colorscheme nofrils-dark
" set timeoutlen=100
" Defaults
set autoindent
set backspace=indent,eol,start
set complete-=i
set smarttab
set incsearch
set laststatus=2
set ruler
set wildmenu
syntax enable
set regexpengine=1
" Set terminal
" set term=screen-256color
" Show line numbers
set relativenumber
set number
" Highlight search results
set hlsearch
" Smart case. Details `:h smartcast`
set ignorecase
set smartcase
" Default encoding utf8
set termencoding=utf8
" Turn on incompatibility for vi settings, bacause we wont need vi
set nocompatible
" Show unfinished commands in status bar
set showcmd
" Folding by indents
set foldenable
set foldlevel=100
set foldmethod=indent
" Turn off sounds
set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=
" Support for a mouse
set mouse=
"set mousemodel=popup
" Do not write buffer while switching to another
" This lets to edit multiple files without need to save each time before
" switching
set hidden
" Hide panel and scrollbars in gui version
set guioptions-=T
set guioptions-=r
set guioptions-=l
set guioptions-=L
" Command panel one line high
set ch=1
" Hide mouse pointer while typing
set mousehide
" Do not force new line
set nowrap
" Tab to space
set expandtab
" Tab default width
set shiftwidth=4
set softtabstop=4
set tabstop=4
" Turn on smart indents. For example, an indent after `{`
set smartindent
" Display metching symbols
set showmatch
" Default window size
"set lines=50
"set columns=140
" Russian symbols navigation. Next\prev word , etc
set iskeyword=@,48-57,_,192-255
" Highlight line where cursor is positioned
set cursorline
"highlight CursorLine guibg=lightblue ctermbg=lightgray
"highlight CursorLine term=none cterm=none
" Special symbols display
set list listchars=tab:→\ ,trail:·
" Turn on side plugins
filetype plugin on
" Switch leader-button to comma
let mapleader=","
" Disable automatic new line at the end of file
set noeol
set nofixendofline
" Keep undo history across sessions by storing it in a file
let vimDir = '$HOME/.vim'
let &runtimepath.=','.vimDir
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undodir')
" Create dirs
call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undofile
set undolevels=1000
set undoreload=10000
endif
" Quick open .vimrc
nmap <leader>ev :e $MYVIMRC<CR>
nmap <leader>es :source $MYVIMRC<CR>
" Auto-source Vimrc on save
autocmd BufWritePost vimrc source %
autocmd BufRead,BufNewFile *.blade.php set filetype=html
function! SuperCleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-p>"
endif
endfunction
inoremap <Tab> <C-R>=SuperCleverTab()<cr>
map <C-n> :NERDTreeToggle<CR>
map <C-\> :NERDTreeFind<CR>
let NERDTreeQuitOnOpen=1
" noremap <C-l> :bn<CR>
" noremap <C-h> :bp<CR>
" Autoformat options
let g:formatters_ejs = ['htmlbeautify']
let g:formatters_eruby = ['htmlbeautify']
let g:php_cs_fixer_level = "symfony"
"let g:php_cs_fixer_fixers_list = "-indentation"
function! MyAutoformat()
if &filetype == 'php'
:call PhpCsFixerFixFile()
else
:Autoformat
endif
endfunction
noremap <F3> :call MyAutoformat()<CR>
function! Paste()
:set paste!
endfunction
" function! Paste()
" :set paste
" :call feedkeys("i\<D-v>\<esc>")
" :set nopaste
" endfunction
nnoremap <F7> :call Paste()<CR>
" Indent lines
noremap <F9> :IndentLinesToggle<CR>
let g:indentLine_enabled = 0
" Easy Motion
" let g:EasyMotion_do_mapping = 0
" map <Leader> <Plug>(easymotion-prefix)
" map <Space> <Plug>(easymotion-bd-w)
" map <Leader><Space> <Plug>(easymotion-s2)
" nmap s <Plug>(easymotion-s)
" let g:EasyMotion_smartcase = 1
" Russian language support, switch layout on Ctrl-^
" set keymap=russian-jcukenwin
set iminsert=0
set imsearch=0
set statusline+=%#warningmsg#
" Buffer close
:nnoremap <Leader>q :Bdelete<CR>
" Clear highlighting by esc
nnoremap <esc> :noh<return><esc>
nnoremap <esc>^[ <esc>^[
" let g:Powerline_symbols = 'fancy'
let javascript_enable_domhtmlcss = 1
" CTAGS auto update
let g:easytags_async = 1
let g:easytags_auto_update = 0
let g:easytags_always_enabled = 0
let g:easytags_opts = ['--exclude=node_modules', '--exclude=.git']
" Sessions
" let g:session_autosave = 'no'
" let g:session_autoload = 'yes'
" let g:session_directory = xolox#misc#path#merge('~/.vim/sessions', getcwd())
" let g:session_lock_enabled = 0
"autocmd BufLeave * :SaveSession!
" :nnoremap <Leader>ss :SaveSession!<CR>
" FOR NVIM
" :nnoremap <Leader>ss :SessionsSave! ~/.config/nvim/sessions/ + vim.fn['getcwd']()<CR>
let g:slime_target = "tmux"
" Enable hard mode by default
let g:hardtime_default_on = 0
let g:hardtime_ignore_buffer_patterns = [ "NERD.*", "__Tagbar__" ]
let g:hardtime_timeout = 50
let g:hardtime_allow_different_key = 1
let g:list_of_disabled_keys = ["<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"]
let g:list_of_normal_keys = ["h", "j", "k", "l", "<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"]
" Add delimeter to nerd tree commenting
let NERDSpaceDelims=1
" Set ultisnips directory
let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnips'
" let g:UltiSnipsSnippetDirectories = ['~/.vim/UltiSnips']
" let g:UltiSnipsExpandTrigger = "<tab>"
" Indent guides
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
let g:indent_guides_auto_colors = 0
hi IndentGuidesOdd ctermbg=black
hi IndentGuidesEven ctermbg=darkgrey
" Closetags
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.blade.php,*.ejs,*.html.erb"
let g:ctrlp_custom_ignore = '\v[\/]\.(git|node_modules|svn)$'
set wildignore+=*\\node_modules\\*,*.so,*.swp,*.zip
" Let ctrl p index more files
let g:ctrlp_max_files=0
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
let g:ctrlp_user_command = 'find %s -type f'
" if executable('ag')
" let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" endif
" Remove concealing in markdown
:set conceallevel=0
nmap <Leader>m :e database/migrations<CR>
nmap <Leader>t :UpdateTags<CR>
" Allow to copy/paste between VIM instances
" "copy the current visual selection to ~/.vbuf
vmap <Leader>y :w! ~/.vbuf<CR>
" "copy the current line to the buffer file if no visual selection
nmap <Leader>y :.w! ~/.vbuf<CR>
" "paste the contents of the buffer file
nmap <Leader>p :r ~/.vbuf<CR>
nmap <Leader>n :cn<CR>
nmap <Leader>b :cp<CR>
" Map ctrl-movement keys to window switching
map <C-k> <C-w><Up>
map <C-j> <C-w><Down>
map <C-l> <C-w><Right>
map <C-h> <C-w><Left>
nnoremap <silent> <bs> <C-w><Left>
" if $DOTFILES_SIMPLE_THEME != 1
" let g:airline_powerline_fonts = 1
" let g:Powerline_symbols = 'fancy'
" endif
" autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css
let g:loaded_python3_provider = 0
let g:loaded_perl_provider = 0
source ~/.vim/nerdcommenter-vue.vim