Skip to content

Commit

Permalink
bugfix: #308 mode can be a table
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-x committed Jul 3, 2024
1 parent 8a43aba commit db3ac40
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lua/navigator/lspclient/mapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ local key_maps = {
{ key = '<Leader>k', func = require('navigator.dochighlight').hi_symbol, desc = 'hi_symbol' },
{ key = '<Space>wa', func = require('navigator.workspace').add_workspace_folder, desc = 'add_workspace_folder' },
{ key = '<Space>wr', func = require('navigator.workspace').remove_workspace_folder, desc = 'remove_workspace_folder' },
{ key = '<Space>ff', func = vim.lsp.buf.format, mode = 'n', desc = 'format' },
{ key = '<Space>ff', func = vim.lsp.buf.format, mode = 'v', desc = 'range format', opts = {silent = true} },
{ key = '<Space>ff', func = vim.lsp.buf.format, mode = {'n', 'v', 'x'}, desc = 'format' },
{ key = '<Space>gm', func = require('navigator.formatting').range_format, mode = 'n', desc = 'range format operator e.g gmip' },
{ key = '<Space>wl', func = require('navigator.workspace').list_workspace_folders, desc = 'list_workspace_folders' },
{
Expand Down Expand Up @@ -245,9 +244,9 @@ local function set_mapping(lsp_attach_info)
helper_msg = val.func
end

local item = (val.mode or 'n') .. '|' .. val.key .. '|' .. helper_msg
local item = vim.inspect(val.mode or 'n') .. '|' .. val.key .. '|' .. helper_msg
if not vim.tbl_contains(key_maps_help, item) then
table.insert(key_maps_help, (val.mode or 'n') .. '|' .. val.key .. '|' .. helper_msg)
table.insert(key_maps_help, vim.inspect(val.mode or 'n') .. '|' .. val.key .. '|' .. helper_msg)
end
end

Expand Down

0 comments on commit db3ac40

Please sign in to comment.