Migrate pandoc 'AnkiDeck' function to neovim
parent
5b08b04332
commit
22e23ba416
|
@ -0,0 +1,15 @@
|
||||||
|
-- NOTE: May want to move this, as it is more specific to wiki than to pandoc
|
||||||
|
vim.api.nvim_create_user_command("AnkiDeck", function()
|
||||||
|
local handle = io.popen("get-anki-decks")
|
||||||
|
local decks = {}
|
||||||
|
for line in handle:lines() do
|
||||||
|
table.insert(decks, line)
|
||||||
|
end
|
||||||
|
handle:close()
|
||||||
|
|
||||||
|
vim.ui.select(decks, { prompt = "Select Anki deck" }, function(choice)
|
||||||
|
if choice then
|
||||||
|
vim.api.nvim_put({ choice }, "", true, true)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end, {})
|
|
@ -17,9 +17,3 @@ func! GetContext()
|
||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
com! -nargs=0 GetContext :call GetContext()
|
com! -nargs=0 GetContext :call GetContext()
|
||||||
|
|
||||||
function! Put(str)
|
|
||||||
put = a:str
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
com! -nargs=0 AnkiDeck call fzf#run(fzf#wrap({'source': 'get-anki-decks', 'sink': function('Put')}))
|
|
||||||
|
|
Loading…
Reference in New Issue