Skip to content

Commit

Permalink
feat: add list of filetypes where smear is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
sphamba committed Dec 10, 2024
1 parent 2d5f8f2 commit 65d8cfe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/smear_cursor/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ M.hide_target_hack = true
-- Number of windows that stay open for rendering.
M.max_kept_windows = 50

-- List of filetypes where the plugin is disabled.
M.filetypes_disabled = {}

M.time_interval = 17 -- milliseconds

-- Smear configuration ---------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions lua/smear_cursor/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ M.listen = function()
]],
{}
)

if #config.filetypes_disabled > 0 then
vim.api.nvim_exec2(
[[
augroup SmearCursorIgnore
autocmd!
autocmd BufEnter * lua require("smear_cursor").enabled = not vim.tbl_contains(require("smear_cursor").filetypes_disabled, vim.bo.filetype)
augroup END
]],
{}
)
end
end

M.unlisten = function()
Expand Down

0 comments on commit 65d8cfe

Please sign in to comment.