Skip to content

Commit

Permalink
Add redraw function
Browse files Browse the repository at this point in the history
  • Loading branch information
gen740 committed Feb 1, 2024
1 parent 3ff0710 commit 150a494
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion lua/smoothcursor/callbacks/default.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ local callback = require('smoothcursor.callbacks')
local buffer = callback.buffer

local config = require('smoothcursor.config')
local last_positions = require('smoothcursor.last_positions')
local debug_callback = require('smoothcursor.debug').debug_callback

-- Default cursor callback. buffer["prev"] is always integer
Expand Down
15 changes: 15 additions & 0 deletions lua/smoothcursor/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,21 @@ sc.smoothcursor_fancy_off = function()
sc.smoothcursor_fancy_set(false)
end

---@param bufname string
sc.smoothcursor_redraw = function(bufname)
bufname = bufname or vim.fn.bufname()
for _, sign in ipairs(vim.fn.sign_getplaced(bufname, { group = 'SmoothCursor' })[1].signs) do
vim.fn.sign_unplace('SmoothCursor', { buffer = bufname, id = sign.id })
vim.fn.sign_place(
0,
'SmoothCursor',
sign.name,
bufname,
{ lnum = sign.lnum, priority = config.value.priority }
)
end
end

sc.set_smoothcursor_highlight = function()
if vim.api.nvim_get_namespaces().SmoothCursor == nil then
vim.api.nvim_create_namespace('SmoothCursor')
Expand Down

0 comments on commit 150a494

Please sign in to comment.