Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lua/demicolon/jump.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ local M = {}
---@param opts demicolon.jump.opts | table Options to pass to the function. Make sure to include the `forward` boolean
---@param additional_args? any[]
function M.repeatably_do(func, opts, additional_args)
local ts_repeatable_move = require('nvim-treesitter.textobjects.repeatable_move')
local ok, ts_repeatable_move = pcall(require, 'nvim-treesitter-textobjects.repeatable_move')
if not ok then
ts_repeatable_move = require('nvim-treesitter.textobjects.repeatable_move')
end

opts = opts or {}
additional_args = additional_args or {}
Expand All @@ -24,7 +27,10 @@ end
---@param key 't' | 'T' | 'f' | 'F'
---@return fun(): string
function M.horizontal_jump(key)
local ts_repeatable_move = require('nvim-treesitter.textobjects.repeatable_move')
local ok, ts_repeatable_move = pcall(require, 'nvim-treesitter-textobjects.repeatable_move')
if not ok then
ts_repeatable_move = require('nvim-treesitter.textobjects.repeatable_move')
end

return function()
return ts_repeatable_move['builtin_' .. key .. '_expr']()
Expand Down
5 changes: 4 additions & 1 deletion lua/demicolon/listen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ function M.listen_for_repetable_bracket_motions(disabled_keys)
end

if motion then
local ts_repeatable_move = require('nvim-treesitter.textobjects.repeatable_move')
local ok, ts_repeatable_move = pcall(require, 'nvim-treesitter-textobjects.repeatable_move')
if not ok then
ts_repeatable_move = require('nvim-treesitter.textobjects.repeatable_move')
end
ts_repeatable_move.last_move = {
func = function(opts)
local new_motion = motion_from_direction(opts.forward, motion)
Expand Down
5 changes: 4 additions & 1 deletion lua/demicolon/repeat_jump.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
local ts_repeatable_move = require('nvim-treesitter.textobjects.repeatable_move')
local ok, ts_repeatable_move = pcall(require, 'nvim-treesitter-textobjects.repeatable_move')
if not ok then
ts_repeatable_move = require('nvim-treesitter.textobjects.repeatable_move')
end

local M = {}

Expand Down