-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrcnew
More file actions
256 lines (213 loc) · 7.05 KB
/
Copy pathvimrcnew
File metadata and controls
256 lines (213 loc) · 7.05 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
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
set nocompatible
set showcmd " show number of lines selected
set relativenumber " show line numbers relative to current
scriptencoding utf-8
set encoding=utf-8
set ignorecase " search by default case insensitive
set smartcase " if there is an upper char, search sensitive
set textwidth=80
set foldmethod=syntax |
set foldlevelstart=20
set spell spelllang=en_gb
set hidden " allow to switch buffer without saving
source ~/.vimrclocal
filetype plugin indent on
syntax on
fun! SetupVAM()
let c = get(g:, 'vim_addon_manager', {})
let g:vim_addon_manager = c
let c.plugin_root_dir = expand('$HOME', 1) . '/.vim/vim-addons'
" Force your ~/.vim/after directory to be last in &rtp always:
" let g:vim_addon_manager.rtp_list_hook = 'vam#ForceUsersAfterDirectoriesToBeLast'
" most used options you may want to use:
" let c.log_to_buf = 1
" let c.auto_install = 0
let &rtp.=(empty(&rtp)?'':',').c.plugin_root_dir.'/vim-addon-manager'
if !isdirectory(c.plugin_root_dir.'/vim-addon-manager/autoload')
execute '!git clone --depth=1'
\ 'https://github.com/MarcWeber/vim-addon-manager'
\ shellescape(c.plugin_root_dir.'/vim-addon-manager', 1)
endif
" This provides the VAMActivate command, you could be passing plugin names, too
call vam#ActivateAddons([], {})
endfun
call SetupVAM()
VAMActivate The_NERD_Commenter Solarized
VAMActivate github:fholgado/minibufexpl.vim bufkill
VAMActivate github:itchyny/lightline.vim
VAMActivate a
VAMActivate github:lervag/vimtex
VAMActivate github:leafOfTree/vim-vue-plugin
VAMActivate github:vim-autoformat/vim-autoformat
VAMActivate lua%4344
"#VAMActivate github:pangloss/vim-javascript
" VAMActivate github:leafgarland/typescript-vim
"VAMActivate github:peitalin/vim-jsx-typescript
"#VAMActivate github:styled-components/vim-styled-components
"#VAMActivate github:jparise/vim-graphql
VAMActivate UltiSnips
VAMActivate vim-snippets
" VAMActivate github:Yggdroot/indentLine
VAMActivate github:nathanaelkane/vim-indent-guides
" VAMActivate vim-misc
" VAMActivate clang
" call vam#ActivateAddons(['bufkill'])
" call vam#ActivateAddons(['Supertab']) " for smart tab key
" " call vam#ActivateAddons(['auctex'])
" " call vam#ActivateAddons(['github:honza/vim-snippets'])
" " call vam#ActivateAddons(['github:MarcWeber/ultisnips'])
" " Find a better replacement for this one
" call vam#ActivateAddons(['AutomaticLaTeXPlugin'])
set expandtab
" set tabstop=2
set shiftwidth=2
set softtabstop=2
" if !has('gui_running')
set t_Co=16
" endif
" Solarized
" let g:solarized_termtrans = 1
" set t_Co=256
set background=dark
colorscheme solarized
" lightline Setup
" set guifont=Liberation\ Mono\ for\ Powerline\ 12
set laststatus=2 " Launch airline with single tab open
" colorscheme could also be solarized, but this one is nicer
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&readonly?"":""}',
\ },
\ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
\ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }
\ }
" REMAPPINGS
" Use , for the leader key as opposed to \
let mapleader = ","
let maplocalleader = ","
" Ctrl-C and Ctrl-V systemwide
map <C-V> "+gP
cmap <C-V> <C-R>+
vnoremap <C-C> "+y
set clipboard=unnamedplus
" Ultisnips
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsListSnippets = "<c-l>"
let g:UltiSnipsJumpForwardTrigger = "<c-j>"
let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
" IndentLine
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_start_level = 3
" Comment settings
let g:NERDSpaceDelims = 1
if &term =~ '^screen'
" tmux will send xterm-style keys when its xterm-keys option is on
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
endif
map <C-left> :bp<CR>
map <C-right> :bn<CR>
nnoremap <Leader>b :bp<CR>
nnoremap <Leader>f :bn<CR>
nnoremap <Leader>1 :1b<CR>
nnoremap <Leader>2 :2b<CR>
nnoremap <Leader>3 :3b<CR>
nnoremap <Leader>4 :4b<CR>
nnoremap <Leader>5 :5b<CR>
nnoremap <Leader>6 :6b<CR>
nnoremap <Leader>7 :7b<CR>
nnoremap <Leader>8 :8b<CR>
nnoremap <Leader>9 :9b<CR>
nnoremap <Leader>0 :10b<CR>
nnoremap <Leader>q :BW<CR>
" Make ; work same as :. No more shift :)
nnoremap ; :
" Use <leader><space> to clean highlights
nnoremap <leader><space> :noh<cr>
" Easy out of insert mode with double i.
inoremap ii <ESC>
" Some syntax highlighting to annoy me if I mistype.
set colorcolumn=80
highlight ColorColumn guibg=#073642
highlight TrailingWhitespace guibg=#b58900
highlight ExtraWhitespace guibg=#b58900
highlight TrailingWhitespace ctermbg=3
highlight ColorColumn ctermbg=0
highlight ExtraWhitespace ctermbg=3
autocmd Syntax * call matchadd('TrailingWhitespace', '\s\+$')
" Automatically remove trailing whitespace from certain filetypes.
autocmd FileType c,cpp,java,json,php,markdown,sh,python,tex,lua,vue autocmd BufWritePre <buffer> :%s/\s\+$//e
" JSON indentation to 4
autocmd Filetype json setlocal ts=4 sw=4 expandtab
" Latex / vim-latex settings
let g:latex_complete_close_braces = 1
let g:latex_latexmk_quickfix = 0
"here is a more exotic version of my original Kwbd script
"delete the buffer; keep windows; create a scratch buffer if no buffers left
function s:Kwbd(kwbdStage)
if(a:kwbdStage == 1)
if(!buflisted(winbufnr(0)))
bd!
return
endif
let s:kwbdBufNum = bufnr("%")
let s:kwbdWinNum = winnr()
windo call s:Kwbd(2)
execute s:kwbdWinNum . 'wincmd w'
let s:buflistedLeft = 0
let s:bufFinalJump = 0
let l:nBufs = bufnr("$")
let l:i = 1
while(l:i <= l:nBufs)
if(l:i != s:kwbdBufNum)
if(buflisted(l:i))
let s:buflistedLeft = s:buflistedLeft + 1
else
if(bufexists(l:i) && !strlen(bufname(l:i)) && !s:bufFinalJump)
let s:bufFinalJump = l:i
endif
endif
endif
let l:i = l:i + 1
endwhile
if(!s:buflistedLeft)
if(s:bufFinalJump)
windo if(buflisted(winbufnr(0))) | execute "b! " . s:bufFinalJump | endif
else
enew
let l:newBuf = bufnr("%")
windo if(buflisted(winbufnr(0))) | execute "b! " . l:newBuf | endif
endif
execute s:kwbdWinNum . 'wincmd w'
endif
if(buflisted(s:kwbdBufNum) || s:kwbdBufNum == bufnr("%"))
execute "bd! " . s:kwbdBufNum
endif
if(!s:buflistedLeft)
set buflisted
set bufhidden=delete
set buftype=
setlocal noswapfile
endif
else
if(bufnr("%") == s:kwbdBufNum)
let prevbufvar = bufnr("#")
if(prevbufvar > 0 && buflisted(prevbufvar) && prevbufvar != s:kwbdBufNum)
b #
else
bn
endif
endif
endif
endfunction
command! Kwbd call s:Kwbd(1)
nnoremap <silent> <Plug>Kwbd :<C-u>Kwbd<CR>
if v:version >= 700
au BufLeave * let b:winview = winsaveview()
au BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif
endif
" Create a mapping (e.g. in your .vimrc) like this:
nmap <leader>q <Plug>Kwbd