Skip to content

Commit

Permalink
[fix]: Keymaps for the plugin itself were incorrectly saved
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Feb 3, 2024
1 parent 06a0bd2 commit 3d4a409
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lua/LspUI/pos_abstract.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local main_namespace = api.nvim_create_namespace("LspUI_main")
local seconday_namespace = api.nvim_create_namespace("LspUI_seconday")

-- key is buffer id, value is the map info
--- @type { [integer]: { [string]: any } } the any should be the result of maparg
local buffer_keymap_history = {}

-- function for push tagstack
Expand Down Expand Up @@ -194,10 +195,12 @@ local main_view_keybind = function()
true
)

buffer_keymap_history[M.main_view_buffer()] = {
[config.options.pos_keybind.main.back] = back_map,
[config.options.pos_keybind.main.hide_secondary] = hide_map,
}
if not buffer_keymap_history[M.main_view_buffer()] then
buffer_keymap_history[M.main_view_buffer()] = {
[config.options.pos_keybind.main.back] = back_map,
[config.options.pos_keybind.main.hide_secondary] = hide_map,
}
end

-- back keybind
api.nvim_buf_set_keymap(
Expand Down Expand Up @@ -1120,6 +1123,7 @@ local find_position_from_params = function(params)
local file_lnum = nil
local code_lnum = nil

--- @type integer|nil
local tmp = nil

for uri, data in pairs(M.datas()) do
Expand Down Expand Up @@ -1147,7 +1151,9 @@ local find_position_from_params = function(params)
code_lnum = lnum
end
else
tmp = val
tmp = math.abs(
val.start.character - params.position.character
)
code_lnum = lnum
end
end
Expand Down

0 comments on commit 3d4a409

Please sign in to comment.