Skip to content

Commit

Permalink
feat: QuartoSendAbove and QuartoSendAll commands to send code to
Browse files Browse the repository at this point in the history
vim-slime
  • Loading branch information
jmbuhr committed Apr 20, 2023
1 parent 34ab2dd commit cb2bb7d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lua/quarto/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,31 @@ M.setup = function(opt)
})
end

local function concat(ls)
local s = ''
for _,l in ipairs(ls) do
if l ~= '' then
s = s..'\n'..l
end
end
return s..'\n'
end

M.quartoSendAbove = function ()
local lines = otterkeeper.get_language_lines_to_cursor()
if lines == nil then return end
lines = concat(lines)
vim.fn['slime#send'](lines)
end


M.quartoSendAll = function ()
local lines = otterkeeper.get_language_lines()
if lines == nil then return end
lines = concat(lines)
vim.fn['slime#send'](lines)
end



return M
2 changes: 2 additions & 0 deletions plugin/quarto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ api.nvim_create_user_command('QuartoDiagnostics', quarto.enableDiagnostics, {})
api.nvim_create_user_command('QuartoActivate', quarto.activate, {})
api.nvim_create_user_command('QuartoHelp', quarto.searchHelp, { nargs = 1 })
api.nvim_create_user_command('QuartoHover', quarto.quartoHover, {})
api.nvim_create_user_command('QuartoSendAbove', quarto.quartoSendAbove, {})
api.nvim_create_user_command('QuartoSendAll', quarto.quartoSendAll, {})

vim.treesitter.language.register('markdown', 'quarto')

0 comments on commit cb2bb7d

Please sign in to comment.