-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotvimrc-home
282 lines (230 loc) · 6.65 KB
/
dotvimrc-home
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
"
" Matt / Juicebox .vimrc
" Mostly for macOS
" General
syntax on
filetype indent on
colorscheme molokai
set termguicolors
set background=dark
set laststatus=2
set encoding=utf-8
set shell=/bin/zsh
set mouse=a
set nocompatible
set autoindent
set wildmenu
set hidden
set noerrorbells
set number
set relativenumber
set shiftround " shift stuff
set nowrap
set textwidth=79
set colorcolumn=85
set scrolloff=8
set signcolumn=yes
set cmdheight=1
set updatetime=40
" Tab settings
set softtabstop=4
set shiftwidth=4
set tabstop=4
set expandtab
set smartindent
" Searches
set incsearch
set nohlsearch
set ignorecase smartcase
" Folding
set foldenable
set foldlevelstart=20
set foldnestmax=10
set foldmethod=indent
" Cursors
set cuc
set cul
set ruler
" Backups and swaps
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
" Show “invisible” characters
set list
set listchars=tab:▸\ ,trail:·,eol:¬,nbsp:_
" Spelling
set nospell
set spelllang=en_gb
hi SpellBad cterm=underline gui=underline,bold
"
" Plug-in Management
"
packadd minpac
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('vim-airline/vim-airline')
call minpac#add('vim-airline/vim-airline-themes')
call minpac#add('preservim/nerdtree') " Nerdtree
call minpac#add('davidhalter/jedi-vim') " Autocompletion
call minpac#add('airblade/vim-gitgutter') " Git stuff in gutter
call minpac#add('Yggdroot/indentLine') " Shows indentation lines
call minpac#add('godlygeek/tabular') " Better tabs
call minpac#add('luochen1990/rainbow') " Rainbow parenthesis
call minpac#add('python-mode/python-mode') " Python stuff
call minpac#add('hashivim/vim-terraform') " Terraform stuff
call minpac#add('vim-syntastic/syntastic') " Syntax highlighting
call minpac#add('tpope/vim-fugitive') " Basic Git integration
call minpac#add('tpope/vim-commentary') " Better commenting
call minpac#add('tmhedberg/SimpylFold') " Better code folding
call minpac#add('plasticboy/vim-markdown') " Better Markdown support
call minpac#add('junegunn/fzf') " Fuzzy finder
call minpac#add('junegunn/fzf',{'do': {->fzf#install()}}) " Better Markdown support
call minpac#add('junegunn/fzf.vim') " Fuzzy finder
" Managed plug ins (automatically installed and updated via "Pu" and "Pc")
command! Pu call minpac#update()
command! Pc call minpac#clean()
" Leader Mappings
let mapleader=" "
" Quit/Save
noremap <Leader>w :w<CR>
nnoremap <Leader>wq :wq<CR>
nnoremap <Leader>q :q<CR>
nnoremap <Leader>e :q!<CR>
" Mappings - buffers
nmap <Leader>bn :enew<CR>
nmap <Leader>bl :buffers<CR>
nmap <leader>bq :bp <BAR> bd #<CR>
nnoremap <Leader>. :bnext<CR>
nnoremap <Leader>, :bprevious<CR>
" OS clipboard
vnoremap <Leader>y "+y
nnoremap <Leader>y "+y
nnoremap <Leader>p "+p
vnoremap <Leader>p "+p
" Vertical split and swap to it
nnoremap <Leader>v <C-w>v<C-w>l
" Scrollbind
nnoremap <Leader>sb :set scrollbind<CR>
nnoremap <Leader>nsb :set noscrollbind<CR>
" Scratchpad
noremap <Leader>n :Scratch<CR>
" Clear highlighting
nnoremap <Leader>h :nohl<CR>
" Spelling
nnoremap <Leader>ss :set spell<CR>
nnoremap <Leader>ns :set nospell<CR>
nnoremap <Leader>s ]s
nnoremap <Leader>z 1z=
" Nerdtree
nnoremap <Leader>t :NERDTreeFocus<CR>
" Code folding
nnoremap <Leader>f zo
nnoremap <Leader>g zc
" Commentary
nnoremap <Leader>c :Commentary<CR>
" FZF
nnoremap <Leader>ff :Files<CR>
nnoremap <Leader>fb :Buffers<CR>
nnoremap <Leader>fg :GFiles<CR>
"
" Other mappings
"
" FZF Open
nnoremap <C-p> :Files .<CR>
" Move lines
nnoremap <C-j> :m .+1<CR>==
nnoremap <C-k> :m .-2<CR>==
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
" reselect pasted text
nnoremap gp `[v`]
" NO escape
inoremap jk <Esc>
" Nerdtree
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-s> :NERDTreeFind<CR>
" Better copying
nnoremap Y y$
" Keep things centred
nnoremap n nzzzv
nnoremap N Nzzzv
nnoremap J mzJ`z
" Better undoing
inoremap , ,<c-g>u
inoremap . .<c-g>u
inoremap ! !<c-g>u
inoremap ? ?<c-g>u
inoremap " "<c-g>u
"
" Plugin Settings
"
"Rainbow parenthesis
let g:rainbow_active = 1
" airline settings
let g:airline_theme = 'molokai'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_powerline_fonts = 1
" Syntastic
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_python_checkers = ['pylint', 'flake8']
let g:syntastic_aggregate_errors = 1
let g:syntastic_auto_jump=1
let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
" Python-mode
let g:pymode_rope_lookup_project = 0
let g:pymode_rope_completion = 0
let g:pymode_rope_complete_on_dot = 0
let g:pymode_python = 'python3'
let g:pymode_rope_completion_bind = '<C-Space>'
let g:pymode_lint_ignore = "E501,W,E101,C901"
" Jedi-vim
let g:jedi#use_splits_not_buffers = "right"
let g:jedi#completions_enabled = 1
let g:jedi#popup_select_first = 1
let g:jedi#completions_command = "<Leader>h"
" Terraform
let g:terraform_align=1
let g:terraform_fold_sections=1
let g:terraform_remap_spacebar=1
let g:terraform_fmt_on_save=1
" indentLine
let g:indentLine_char = '┊'
" Markdown
let g:vim_markdown_conceal = 2
let g:vim_markdown_conceal_code_blocks = 0
let g:vim_markdown_math = 1
let g:vim_markdown_toml_frontmatter = 1
let g:vim_markdown_frontmatter = 1
let g:vim_markdown_strikethrough = 1
let g:vim_markdown_autowrite = 1
let g:vim_markdown_edit_url_in = 'tab'
let g:vim_markdown_follow_anchor = 1
" FZF
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'relative': v:true } }
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
let g:fzf_buffers_jump = 1
" Disable auto commenting
autocmd BufNewFile,BufRead * setlocal formatoptions-=ro
" YAML indentation
au! BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType yml setlocal ts=2 sts=2 sw=2 expandtab
" Start NERDTree when Vim is started without file arguments.
"autocmd StdinReadPre * let s:std_in=1
"autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif
" flag extra white space
au BufRead,BufNewFile .py,.pyw,.c,.h match BadWhitespace /\s+$/
" Jedi-vim disable docstring window
autocmd FileType python setlocal completeopt-=preview
" Markdown
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd FileType markdown set conceallevel=2
autocmd FileType markdown setlocal spell spelllang=en_gb