-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc-mini
executable file
·316 lines (265 loc) · 8.32 KB
/
vimrc-mini
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
" vim-plug "
call plug#begin('~/.vim/plugged')
" Generals
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-speeddating'
Plug 'jamessan/vim-gnupg'
Plug 'easymotion/vim-easymotion'
Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'
Plug 'mhinz/vim-sayonara', { 'on': 'Sayonara' }
Plug 'dahu/vim-fanfingtastic'
Plug 'tpope/vim-eunuch'
Plug 'mhinz/vim-startify'
" Zettel
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | Plug 'junegunn/fzf.vim'
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
Plug 'dyng/ctrlsf.vim'
Plug 'dkarter/bullets.vim'
Plug 'blay/vim-pandoc-syntax'
Plug 'vim-voom/VOoM'
Plug 'vimwiki/vimwiki'
Plug 'jceb/vim-orgmode'
Plug 'chrisbra/NrrwRgn'
Plug 'masukomi/vim-markdown-folding'
Plug 'vim-pandoc/vim-pandoc'
Plug 'inkarkat/vim-SpellCheck' | Plug 'inkarkat/vim-ingo-library'
" Themes
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'kristijanhusak/vim-hybrid-material'
Plug 'ayu-theme/ayu-vim'
Plug 'altercation/vim-colors-solarized'
Plug 'rhysd/try-colorscheme.vim'
Plug 'cormacrelf/vim-colors-github'
call plug#end()
" General Settings "
language en_US.utf8
set shell=zsh
set termguicolors
set background=dark
let g:airline_theme = "hybrid"
"let ayucolor="light" " for light version of theme
let ayucolor="mirage" " for mirage version of theme
"let ayucolor="dark" " for dark version of theme
"colorscheme hybrid_material
colorscheme ayu
"colorscheme solarized
" Airline conf
let g:airline_section_b = ''
let g:airline_section_y = ''
let g:airline_skip_empty_sections = 1
" Search conf
let g:Lf_ShowDevIcons = 0
"" A few remaps
" change the mapleader from \ to ,
"let mapleader=","
map <space> <leader>
map "," <leader>
" Ö as colon
nmap ö :
" Switch : and .
nnoremap . :
nnoremap ; .
" Better Undo
noremap U <C-R>
noremap <C-R> :LeaderfHistoryCmd<CR>
" Yank filename to clipboard
nnoremap <leader>y :let @+ = expand("%:t")<CR>
" Yank uid to clipboard
nnoremap <leader>Y :let @+ = expand("%:t")<CR>:silent ! uidpaste<CR>
" make Y consistent with C and D.
nnoremap Y y$
" Paste brackets
nnoremap <leader>v i[[]]<Esc>hP
nnoremap <leader>V i[[<Esc>Ea]]<Esc>
" Paste without pastemode
set clipboard+=unnamed
nnoremap p p`]<Esc>
" Multiple Cursors Paragraph
nnoremap <leader>m vip<C-n>i
" Insert empty line before and after
nnoremap <C-k> O<Esc>
nnoremap <C-j> o<Esc>
" Insert blank space before and after
nnoremap <C-l> a<space><Esc>
nnoremap <C-h> i<space><Esc>l
" Soft line navigation
noremap j gj
noremap k gk
noremap gj j
noremap gk k
" make J, K, L, and H move the cursor MORE.
nnoremap J }
nnoremap K {
nnoremap L g_
nnoremap H ^
" Navigate buffers
nnoremap <Leader>j :bn<CR>
nnoremap <Leader>k :b#<CR>
nnoremap <Leader>h :Buffers<CR>
nnoremap <Leader>l :History<CR>
nnoremap <Leader>L :LeaderfMru<CR>
nnoremap <Leader>bd :bd<CR>
nnoremap <Leader>q :Sayonara<CR>
nnoremap <Leader>Q :only<CR>
nnoremap <Leader>w :w<CR>
map <leader>n :new<CR>
" Navigate buffer
let g:EasyMotion_smartcase = 1
map <leader>s :BLines<CR>
map <leader>S <Plug>(easymotion-overwin-f)
map <leader>- <Plug>(easymotion-overwin-f)[
nmap - <Plug>(easymotion-overwin-f)[
map <leader>G :e <cfile><CR>
map <leader>g gF
map <leader>ö f[w
" Better split positions
set splitbelow
set splitright
" Tab between buffers
noremap <leader><tab> :tabNext<CR>
" These will make it so that going to the next one in a
" search will center on the line it's found in.
map N Nzz
map n nzz
" Clear search
nmap <silent> <leader>/ :let @/ = ""<CR>
" Save with sudo
cmap w!! w !sudo tee % >/dev/null
" Stop accidental recording
noremap <C-q> q
noremap q <Nop>
set nofoldenable " start unfolded
set number " Line numbers
set relativenumber " Relative line numbers
set hlsearch " hilight search results
set showmatch " set show matching parenthesis
set expandtab " tab is just spaces
set shiftwidth=2 " Indent two spaces
set tabstop=4 " a tab is four spaces
set smartcase " ignore case if search pattern is all lowercase
set linebreak " Break at word boundaries
set wrap " Wrap all text
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set clipboard=unnamedplus " System clipboard
set mouse=a " mouse support
set hidden " hide buffers
set confirm " confirm unsaved
set isfname+=32 " space in filenames
let @/ = ""
"Transparent background in terminal
hi Normal guibg=NONE ctermbg=NONE
" color linenumbers
highlight LineNr ctermfg=lightblue
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" Quickly edit/reload the vimrc file
"nmap <silent> <leader>ev :find $MYVIMRC<CR>
nmap <silent> <leader>ev :find ~/.vimrc<CR>
nmap <silent> <leader>er :so $MYVIMRC<CR>
" VimWiki stuff
let wiki_1 = {}
let wiki_1.path = '~/notes/vimwiki/wiki'
let wiki_1.path_html = '~/notes/vimwiki/html'
let wiki_1.ext = '.gpg'
let g:vimwiki_list = [wiki_1]
let g:vimwiki_table_mappings = 0
" GPG settings
let g:GPGPreferArmor=1
let g:GPGDefaultRecipients=["[email protected]"]
" Search
map <leader>a :lcd ~/zettel<CR>:Leaderf rg<CR>
map <leader>A :lcd ~/zettel<CR>:CtrlSF -R -G "*20*" '<C-R><C-R>+'<CR>
map <leader>f :LeaderfFile ~/zettel<CR>
map <leader>F :LeaderfFileCword<CR>
map <Leader>H :LeaderfFile ~/notes<CR>
" Backlinks
map <leader>C <leader>Y:vnew<CR>:read !zfile <C-R><C-R>+\|zwiki<CR>:set filetype=pandoc<CR>
map <leader>c <leader>Y<leader>A
map <leader>Ö <leader>Y:silent !zdisp <C-R><C-R>+<CR>
" Agenda
map <leader>p :e ~/zettel/.agenda.md<CR>:loadview<CR>
map <leader>P :silent exec "!agenda > ~/zettel/.agenda.md"<CR>
" CtrlSF
let g:ctrlsf_default_root = "project"
let g:ctrlsf_default_view_mode = 'compact'
let g:ctrlsf_auto_focus = {
\ "at": "done",
\ "duration_less_than": 1000
\ }
let g:ctrlsf_ackprg = 'rg'
let g:ctrlsf_extra_backend_args = {
\ 'rg': '--no-hidden'
\ }
" todo Search
map <leader>T :lcd ~/zettel<CR>:CtrlSF -R -G "*20*" @todo:[b]<CR>
map <leader>t :lcd ~/zettel<CR>:CtrlSF -R -G "*20*" @todo:[a]<CR>
map <leader><CR> :lcd ~/zettel<CR>:CtrlSF -R -G "*20*" @todo:[a]
" Git search
map <leader>å :Gblame<CR>
map <leader>Å :GV! -p<CR>:BLines<CR>
" VimRoom
nnoremap <silent> <Leader>r :Goyo<CR>:Limelight!!<CR>
let g:limelight_conceal_ctermfg = 'gray'
let g:limelight_conceal_ctermfg = 240
nnoremap <silent> <Leader>R :Limelight!!<CR>
" Voom
map <leader>i :Voom pandoc<CR>
nmap <S-Tab> zi
" Spellcheck
set spelllang=en,sv
set nospell
au BufNew,BufRead * set nospell
"autocmd BufRead,BufNewFile * setlocal nospell
"map <leader>c :setlocal spell!<CR>
map <leader>z :SpellCheck<CR>
" Bullets.vim
let g:bullets_outline_levels = ['ROM', 'ABC', 'num', 'abc', 'rom', 'std-']
let g:bullets_enabled_file_types = [
\ 'pandoc',
\ 'markdown'
\]
" Pandoc Settings
autocmd FileType pandoc setlocal commentstring=<!--\ %s\ -->
let g:pandoc#modules#disabled = ["formatting", "keyboard"]
let g:pandoc#folding#mode = "relative"
let g:pandoc#spell#enabled = 0
let g:pandoc#syntax#conceal#use = 1
let g:pandoc#syntax#conceal#urls = 1
let g:pandoc#syntax#style#underline_special = 0
let g:pandoc#syntax#style#emphases = 0
set conceallevel=2
" Insert Pandoc Link
nnoremap <leader>I i[]<Esc>Pla()<Esc>
" Pandoc everything
au BufNewFile,BufRead *.md set filetype=pandoc
au BufNewFile,BufRead *.md set syntax=pandoc
" Bibtex
let $FZF_BIBTEX_SOURCES = '/home/svartfax/notes/zotero.bib'
function! s:bibtex_cite_sink(lines)
let r=system("bibtex-cite ", a:lines)
execute ':normal! i' . r
endfunction
nnoremap <leader>d :call fzf#run({
\ 'source': 'bibtex-ls',
\ 'sink*': function('<sid>bibtex_cite_sink'),
\ 'up': '40%',
\ 'options': '--ansi --multi --prompt "Cite> "'})
function! s:bibtex_markdown_sink(lines)
let r=system("bibtex-markdown ", a:lines)
execute ':normal! i' . r
endfunction
nnoremap <leader>D :call fzf#run({
\ 'source': 'bibtex-ls',
\ 'sink*': function('<sid>bibtex_markdown_sink'),
\ 'up': '40%',
\ 'options': '--ansi --multi --prompt "Markdown> "'})<CR>