-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_vimrc
213 lines (166 loc) · 4.82 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
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
scriptencoding utf-8
set encoding=utf-8
source ~/.vim/_include
""""""""""""""""""""""""""""
" Enable Syntax Colors
""""""""""""""""""""""""""""
" in GUI mode we go with fruity and Monaco 12
" in CLI mode desert looks better (fruity is GUI only)
syntax on
if has("gui_running")
colorscheme evening
" set guifont=Monaco:h12
else
set t_Co=256 " enable 256 colors support in vim
let g:molokai_original = 1
let g:rehash256 = 1
set background=dark
colorscheme molokai
" presentation mode
" colorscheme leya
endif
" stop webpack from ignoring changed files
set backupcopy=yes
""""""""""""""""""""""""""""
" Setting cursor line highlighting
""""""""""""""""""""""""""""
set cursorline " doesn't remove from blured windows, need extra hack
autocmd WinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
""""""""""""""""""""""""""""
" Tab Settings
""""""""""""""""""""""""""""
set tabstop=4
set smarttab
set shiftwidth=4
" adding visual cues to folds
set foldcolumn=1
" marking files when folds available
set foldmethod=marker
" complete paths on tab
set wildmode=list:longest,full
" show tabs, end of lines,etc
" irritates eyes
set list
set listchars=tab:▸\ ,eol:¬
" normal movement, through screen lines instead of file lines
nnoremap j gj
nnoremap k gk
" doing scroll without moving cursor on screen position
noremap <C-j> j<C-e>
noremap <C-k> k<C-y>
" binding Ctrl_W+E to the NERDTree
nmap -- :call BenIndent()<cr>
map <C-W>e :NERDTreeToggle .<cr>
" Generally, 'smartindent' or 'cindent' should only be set manually if you're
" not satisfied with how file type based indentation works.
set autoindent
filetype off
filetype plugin indent on
set wrap
set nowrapscan
nnoremap n nzz
nnoremap N Nzz
" wrap lines longer 80 chars
"set textwidth=79
" show if line longer than 89 chars
" Onnly for vim 7.3
" set colorcolumn=85
" Statusbar and Linenumbers
set laststatus=2
" bells suck
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" start searching when typed
set incsearch
" highlight search
set hlsearch
function! PrepareXML( )
" Deleting lines
exec 'g/^\s*$/d'
" Joing lines
exec '0,$j'
exec "%s/> </>\r</g"
exec "%s/></>\r</g"
exec "set ft=xml"
exec 'BenIndent'
endfunction
command! PrepareXML :call PrepareXML()
function! PrepareJSON( )
exec '%!python -m json.tool'
endfunction
command! PrepareJSON :call PrepareJSON()
fun BenIndent()
let oldLine=line('.')
normal(gg=G)
execute ':' . oldLine
endfun
map -- :call BenIndent()<cr>
command! BenIndent :call BenIndent()
" spelling
setlocal spell spelllang=en_us
set spell
" toggle between visible 80-length mode
nnoremap <silent> <Leader>l
\ :if exists('w:long_line_match') <Bar>
\ silent! call matchdelete(w:long_line_match) <Bar>
\ unlet w:long_line_match <Bar>
\ elseif &textwidth > 0 <Bar>
\ let w:long_line_match = matchadd('ErrorMsg', '\%>'.&tw.'v.\+', -1) <Bar>
\ else <Bar>
\ let w:long_line_match = matchadd('ErrorMsg', '\%>80v.\+', -1) <Bar>
\ endif<CR>
" When vimrc is edited, reload it
autocmd! bufwritepost vimrc source ~/.vimrc
"
" session management handling
"
function! RestoreSession()
if argc() == 0 "vim called without arguments
execute 'source ~/.vim/Session.vim'
end
endfunction
" autocmd VimEnter * call RestoreSession()
function! SaveSession()
exec ':mksession! ~/vim/Session.vim'
exec 'wqa'
endfunction
command! SW :call SaveSession()
set ruler "Always show current position
""""""""""""""""""""""""""""""""""
" experiments
""""""""""""""""""""""""""""""""""
" highlight lines longer than 73 chars with ErrorMsg group color
" match ErrorMsg /\%>73v.\+/
" to define own group color
" highlight MyGroup ctermbg=red guibg=red gctermfg=yellow guifg=yellow term=bold
" searching for a template file for new files
" autocmd BufNewFile * silent! 0r ~/.vim/templates/%:e.tpl
" Changing to current dir of the file, so that :e gives us correct path
set autochdir
" Setting tasklist shortacts
" map T :TaskList<CR>
" making diff colors looks better
" highlight DiffDelete ctermfg=black ctermbg=yellow
" highlight DiffAdd ctermfg=black ctermbg=white
let g:ctrlp_map = '<c-p>'
" let g:ctrlp_match_window_bottom = 0
" let g:ctrlp_match_window_reversed = 0
let g:ctrlp_custom_ignore = '\v\~$|node_modules|\.(o|swp|pyc|wav|mp3|ogg|blend)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|__init__\.py'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_dotfiles = 0
let g:ctrlp_switch_buffer = 0
"
" Setting up vim-test
"
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
nmap <silent> <leader>a :TestSuite<CR>
nmap <silent> <leader>l :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
let g:ale_javascript_prettier_use_local_config = 1