Skip to content

Commit

Permalink
chore: rebase fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tris203 committed May 5, 2024
1 parent 210a55d commit 3fe03eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lua/precognition/horizontal_motions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ end
---@param str string
---@param cursorcol integer
---@param linelen integer
---@return integer | nil
---@return Precognition.PlaceLoc
function M.matching_bracket(str, cursorcol, linelen)
local supportedBrackets = {
open = { "(", "[", "{" },
Expand All @@ -144,7 +144,7 @@ function M.matching_bracket(str, cursorcol, linelen)
and not vim.tbl_contains(supportedBrackets.close, under_cursor)
then
-- walk until we find a bracket
return nil
return 0
end
local idxFound = false
local bracketIdx
Expand All @@ -169,7 +169,7 @@ function M.matching_bracket(str, cursorcol, linelen)
end

if not idxFound then
return nil
return 0
end

local openBracket = supportedBrackets.open[bracketIdx]
Expand Down Expand Up @@ -213,7 +213,7 @@ function M.matching_bracket(str, cursorcol, linelen)
end

if offset < 0 or offset > linelen then
return nil
return 0
end
return offset
end
Expand Down
8 changes: 7 additions & 1 deletion lua/precognition/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ local M = {}
---@field w Precognition.HintOpts
---@field e Precognition.HintOpts
---@field b Precognition.HintOpts
---@field Zero Precognition.HintOpts
---@field Caret Precognition.HintOpts
---@field Dollar Precognition.HintOpts
---@field MatchingPair Precognition.HintOpts

---@class Precognition.GutterHintConfig
---@field G Precognition.HintOpts
Expand All @@ -39,6 +41,7 @@ local M = {}
---@field b Precognition.PlaceLoc
---@field Caret Precognition.PlaceLoc
---@field Dollar Precognition.PlaceLoc
---@field MatchingPair Precognition.PlaceLoc

---@class (exact) Precognition.GutterHints
---@field G Precognition.PlaceLoc
Expand All @@ -48,8 +51,10 @@ local M = {}

---@type Precognition.HintConfig
local defaultHintConfig = {
Caret = { text = "^", prio = 1 },
Caret = { text = "^", prio = 2 },
Dollar = { text = "$", prio = 1 },
MatchingPair = { text = "%", prio = 5 },
Zero = { text = "0", prio = 1 },
w = { text = "w", prio = 10 },
b = { text = "b", prio = 9 },
e = { text = "e", prio = 8 },
Expand Down Expand Up @@ -204,6 +209,7 @@ local function on_cursor_hold()
w = hm.next_word_boundary(cur_line, cursorcol, line_len),
e = hm.end_of_word(cur_line, cursorcol, line_len),
b = hm.prev_word_boundary(cur_line, cursorcol, line_len),
MatchingPair = hm.matching_bracket(cur_line, cursorcol, line_len),
Dollar = hm.line_end(cur_line, cursorcol, line_len),
}

Expand Down

0 comments on commit 3fe03eb

Please sign in to comment.