Skip to content

Commit

Permalink
Add paste()
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Cook committed Apr 5, 2023
1 parent f008158 commit 8fc5741
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/bidi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ function M.buf_disable_bidi(bufnr)
end
end

-- Paste contents piped through fribidi
-- @tparam str|nil reg The register to paste from
function M.paste(reg)
local buf = M.active_bufs[tostring(vim.api.nvim_win_get_buf(0))]
if buf ~= nil then
local bidi_reg = M.fribidi({ vim.fn.getreg(reg) }, buf.base_dir, {})
vim.api.nvim_paste(table.concat(bidi_reg, '\n'), {}, -1)
else
notify('ERROR', 'Bidi-Mode must be enabled to utilize Bidi-Paste')
end
end

-- Get Bidi-Mode status for buffer via <bufnr>
-- @param int The buffer number
-- NOTE: This is currently a function
Expand Down

0 comments on commit 8fc5741

Please sign in to comment.