Fix pandoc fzf citation adding location
Pandoc citations added through fzf (with the :CiteRef command) were added in place, with an i. The usual case however is to write a sentence, or part of a sentence, going out of insertion mode and wanting the citation to appear *after* what was written. Same story for insert mode citation (automatically called by typing `@@`); also simplified its calling function somewhat. Added simple maps for fzf finding note files from anywhere, searching through wiki tags.
This commit is contained in:
parent
7917b45859
commit
90dfacf7bd
2 changed files with 31 additions and 28 deletions
|
|
@ -16,10 +16,11 @@ function! s:bibtex_ls(...)
|
|||
return source_cmd
|
||||
endfunction
|
||||
|
||||
" NORMAL MODE CITATION
|
||||
" insert citation from normal mode at cursor (with brackets)
|
||||
function! s:bibtex_cite_sink(lines)
|
||||
let r=system("bibtex-cite ", a:lines)
|
||||
execute ':normal! i[' . r . ']'
|
||||
execute ':normal! a[' . r . ']'
|
||||
endfunction
|
||||
command! -bang -nargs=* CiteRef call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(<q-args>),
|
||||
|
|
@ -27,17 +28,21 @@ command! -bang -nargs=* CiteRef call fzf#run(fzf#wrap({
|
|||
\ 'up': '25%',
|
||||
\ 'options': '--ansi --multi --prompt "Cite> "'
|
||||
\ }))
|
||||
|
||||
" INSERT MODE CITATION
|
||||
" insert citation from insert mode at cursor (no brackets inserted)
|
||||
function! s:bibtex_cite_sink_insert(lines)
|
||||
let r=system("bibtex-cite ", a:lines)
|
||||
execute ':normal! i' . r
|
||||
call feedkeys('a', 'n')
|
||||
endfunction
|
||||
|
||||
" MARKDOWN CITATION
|
||||
" insert markdown formatted reference
|
||||
function! s:bibtex_markdown_sink(lines)
|
||||
let r=system("bibtex-markdown -cache " . g:fzf_bibtex_cache . ' ' . join(g:fzf_bibtex_sources), a:lines)
|
||||
echo join(a:lines, '; ')
|
||||
execute ':normal! i' . r
|
||||
execute ':normal! a' . r
|
||||
endfunction
|
||||
command! -bang -nargs=* CiteMarkdown call fzf#run(fzf#wrap({
|
||||
\ 'source': <sid>bibtex_ls(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue