diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 0374478..5fcae94 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -228,43 +228,67 @@ function! Bibtex_ls(...) return 'bibtex-ls -cache ' . g:bibtex_cache . ' ' . g:bibtex_source . ' ' . join(a:000, ' ') endfunction +" insert citation from insert mode at cursor 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> "'}) + \ 'options': '--ansi --multi --prompt "Cite> "'}) + +" insert citation from normal mode at cursor +function! s:bibtex_cite_sink(lines) + let r=system("bibtex-cite ", 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 --multi --prompt "Cite> "' + \ }) + +" insert pretty formatted markdown reference +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=* CitePretty call skim#run({ + \ 'source': Bibtex_ls(), + \ 'sink*': function('bibtex_markdown_sink'), + \ 'up': '25%', + \ 'options': '--ansi --multi --prompt "Markdown> "' + \ }) + +" edit the document info.yaml +" needs papis to function +" could be abstracted out to work with .bib file or the papis .yaml +" TODO THESE FUNCTIONS DO NOT WORK YET. NEED TO FIND A WAY TO GO FROM fzf -> +" papis -> editor +function! s:bibtex_edit_info_sink(lines) + echom "edit info sink: " . join(a:lines, ",") + let r=system("bibtex-cite ", a:lines) + let s=system("papis edit ref=\"" . join(a:lines,"") . "\"") + " execute ':e s' + echo s +endfunction +command! -bang -nargs=* CiteEdit call skim#run({ + \ 'source': Bibtex_ls(), + \ 'sink*': function('bibtex_edit_info_sink'), + \ 'up': '25%', + \ 'options': join([ + \ '--ansi', + \ '--with-nth=..', + \ '--preview-window=:wrap', + \ '--prompt "Edit> "', + \ '--preview=''papis edit -e cat ref="echo {} | bibtex-cite" '' ', + \ ]) + \}) " PLUGIN: vim-go " change the tabstops for go to use tabs and a width of 4