Skip to content

Commit

Permalink
Add option to disable plugin - close declancm#17
Browse files Browse the repository at this point in the history
  • Loading branch information
declancm committed Dec 4, 2022
1 parent 7594df8 commit c406ffd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ override_keymaps = false, -- The plugin keymaps will override any existing keyma
-- OPTIONS:
always_scroll = false, -- Scroll the cursor even when the window hasn't scrolled.
centered = true, -- Keep cursor centered in window when using window scrolling.
disabled = false, -- Disables the plugin.
default_delay = 7, -- The default delay (in ms) between each line when scrolling.
hide_cursor = false, -- Hide the cursor while scrolling. Requires enabling termguicolors!
horizontal_scroll = true, -- Enable smooth horizontal scrolling when view shifts left or right.
Expand Down
1 change: 1 addition & 0 deletions lua/cinnamon/config.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
return {
default_keymaps = true,
disabled = false,
extra_keymaps = false,
extended_keymaps = false,
override_keymaps = false,
Expand Down
6 changes: 6 additions & 0 deletions lua/cinnamon/scroll.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ local saved_guicursor = vim.opt.guicursor:get()
local warning_given = false

M.scroll = function(command, scroll_win, use_count, delay_length, deprecated_arg)
-- Check if plugin is disabled.
if config.disabled then
vim.cmd('norm! ' .. command)
return
end

if deprecated_arg ~= nil and not warning_given then
utils.error_msg('Argument 5 for the Cinnamon Scroll API function is now deprecated.', 'Warning', 'WARN')
warning_given = true
Expand Down

0 comments on commit c406ffd

Please sign in to comment.