Skip to content

BUG: fuzzy_finder_mappings aren't normalized and don't respect use_default_mappings #1631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
Kaiser-Yang opened this issue Dec 30, 2024 · 1 comment · May be fixed by #1788
Open
3 tasks done

BUG: fuzzy_finder_mappings aren't normalized and don't respect use_default_mappings #1631

Kaiser-Yang opened this issue Dec 30, 2024 · 1 comment · May be fixed by #1788
Labels
bug Something isn't working

Comments

@Kaiser-Yang
Copy link

Kaiser-Yang commented Dec 30, 2024

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

0.10.1

Operating System / Version

WSL2 + Ubuntu 22.04 LTS

Describe the Bug

I've set use_default_mappings = false, but the mapping for input and filter popup is not disable, I can still see the mappings:

image

Screenshots, Traceback

No response

Steps to Reproduce

  1. Set use_default_mapping=false
  2. Use / to open filter
  3. The key bindings <c-n> and <c-p> is still working

Expected Behavior

Disable these mappings.

Your Configuration

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}

local neotree_config = {
  "nvim-neo-tree/neo-tree.nvim",
  dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
  cmd = { "Neotree" },
  keys = {
    { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
  },
  opts = {
    -- Your config here
    -- ...
use_default_mapping=false,
            filesystem                = {
                window = {
                    mappings = {
                        ['/'] = 'fuzzy_finder',
                    },
                    fuzzy_finder_mappings = {
                        ["<c-j>"] = "move_cursor_down",
                        ["<c-k>"] = "move_cursor_up",
                        -- ['<c-n>'] = 'noop' -- this will give me a warning 'noop' command a niv value
                    },
                },
}
  },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
@Kaiser-Yang Kaiser-Yang added the bug Something isn't working label Dec 30, 2024
@Kaiser-Yang
Copy link
Author

Kaiser-Yang commented Dec 30, 2024

I found that the merge_config for defaults and user's configurations did not use to_lower or to_upper make all the key with <> as lower or upper letters.

This will make weired behaviors, because in nvim, <c-n>, <C-n>, <C-N> and <c-N> are all the same, but in lua they are different strings. In the default keymappings use <C-n> for cursor down, which means I must use <C-n> = 'xxx', because <c-n> will appear before <C-n> in a table, the key will be override by the default <C-n>.

BTW, use <C-n> = 'noop' will disable the <c-n>, although it will give me the warning every time I use fuzzy finder.

@pynappo pynappo changed the title BUG: Using use_default_mapping=false will not disable all the mappings BUG: fuzzy_finder_mappings aren't normalized and don't respect use_default_mappings May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant