diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 69197d1..0374478 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -219,6 +219,53 @@ endfunction autocmd! User GoyoEnter nested call goyo_enter() autocmd! User GoyoLeave nested call goyo_leave() +" PLUGIN: fzf-bibtex +" Citation and Bibtex utilities +let g:bibtex_cache = '/home/marty/.cache/' +let g:bibtex_source = '/home/marty/Nextcloud/Library/academia/academia.bib' + +function! Bibtex_ls(...) + return 'bibtex-ls -cache ' . g:bibtex_cache . ' ' . g:bibtex_source . ' ' . join(a:000, ' ') +endfunction + +function! s:bibtex_cite_sink_insert(lines) + let r=system("bibtex-cite ", a:lines) + execute ':normal! i' . r + call feedkeys('a', 'n') +endfunction + +function! s:bibtex_cite_sink(lines) + let r=system("bibtex-cite ", a:lines) + execute ':normal! i' . r +endfunction + +function! s:bibtex_markdown_sink(lines) + let r=system("bibtex-markdown " . g:bibtex_source, a:lines) + echo join(a:lines, '; ') + execute ':normal! i' . r +endfunction + +command! -bang -nargs=* CiteRef call skim#run({ + \ 'source': Bibtex_ls(), + \ 'sink*': function('bibtex_cite_sink'), + \ 'up': '25%', + \ 'options': '--ansi --tac --multi --prompt "Cite> "' + \ }) + +" pretty-cite a source by turning it into markdown +command! -bang -nargs=* CitePretty call skim#run({ + \ 'source': Bibtex_ls(), + \ 'sink*': function('bibtex_markdown_sink'), + \ 'up': '25%', + \ 'options': '--ansi --tac --multi --prompt "Markdown> "' + \ }) + +inoremap @@ u:call skim#run({ + \ 'source': Bibtex_ls(), + \ 'sink*': function('bibtex_cite_sink_insert'), + \ 'up': '25%', + \ 'options': '--ansi --layout=reverse-list --multi --prompt "Cite> "'}) + " PLUGIN: vim-go " change the tabstops for go to use tabs and a width of 4 " this conforms with the gofmt expectations @@ -470,8 +517,11 @@ noremap :Rg noremap n :NV noremap N :NV! +" FZF git diff +noremap gd :GFiles? + " Configure notational-fzf-vim -let g:nv_search_paths = [ '~/Nextcloud/Notes/' ] +let g:nv_search_paths = [ g:wiki_root ] let g:nv_wrap_preview_text=1 " Dictionary with string keys and values. Must be in the form 'ctrl-KEY': " 'command' or 'alt-KEY' : 'command'. See examples below. @@ -499,6 +549,11 @@ nnoremap wF :execute(":call SearchWiki()") nnoremap wf :execute(":call RgWiki()") vnoremap CtrlSFVwordPath +" insert a citation of a source using bib ref (uses academia library) +nnoremap c :CiteRef +" insert a pretty printed Markdown version of a reference +nnoremap CM :CitePretty + " Mostly dealing with Prose writing from here on out " Format current Paragraph (esp useful in prose writing) nnoremap q gqap