stevearc / aerial.nvim

Neovim plugin for a code outline window
MIT License
1.79k stars 88 forks source link

bug: nav doesn't work #403

Closed yimingwangdell closed 2 months ago

yimingwangdell commented 3 months ago

Neovim version (nvim -v)

latest

Operating system/version

debian

Output of :AerialInfo

as normal

Describe the bug

in nav window, search function name, 'n' keymap doesn't work and cannot jump to next. but "N" works as normal.

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

any

Expected Behavior

'n' work as expected.

Minimal example file

No response

Minimal init.lua

-- 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",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/aerial.nvim",
    config = function()
      require("aerial").setup({
        -- add your aerial config here
      })
    end,
  },
  {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
      require("nvim-treesitter.configs").setup({
        ensure_installed = { "c", "lua" },
        auto_install = true,
        highlight = { enable = true },
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response

matu3ba commented 2 months ago

The bug report is missing the neovim version and "as normal" does not show if either treesitter or lsp is available. Are your personal keymaps also missing xor did you test that the issue reproduces? There are no steps filled in "Steps To Reproduce", which makes me suspect there is something missing.

Otherwise, the most likely cause is a conflicting keymap from your side.

Did you rule out via :map, :Telescope keymaps and :checkhealth with which-key installed that you have no conflicting keymap? which-key setup via

  {
    'folke/which-key.nvim',
    config = function() require('which-key').setup() end,
  }, -- :Telescope builtin.keymaps
yimingwangdell commented 2 months ago

@matu3ba I didn't remap the "n" in normal mode image

yimingwangdell commented 2 months ago

@matu3ba could you check if this function works in your side?

matu3ba commented 2 months ago

could you check if this function works in your side?

The default is mapped to } and { (which works for me as expected) inside Aerial preview and I have mapped a global one via

    vim.keymap.set('n', '<', '<cmd>AerialPrev<CR>', { buffer = bufnr })
    vim.keymap.set('n', '>', '<cmd>AerialNext<CR>', { buffer = bufnr })

The keymap n (the second field) is not mapped on default. I can skim through your dotfiles, if you have them hosted somewhere. However, the behavior you are seeing sounds expected to me. You can see my config here: https://github.com/matu3ba/dotfiles/blob/84ac247730e1e43e067838a7506684943effa5a0/.config/nvim/lua/my_aerial.lua

yimingwangdell commented 2 months ago

@matu3ba myconfig https://github.com/yimingwangdell/vimrc/blob/master/nvim/init.vim

yimingwangdell commented 2 months ago

@matu3ba but "n' is a default behavior to jump to next item if I use "/' to search something. also "N" works as expected.

matu3ba commented 2 months ago

Via rg "\bn\b" .\nvim\ I found that nvim\lua\config\plugins\editsearch.lua:11 shows

            vim.api.nvim_set_keymap('n', 'n',
                [[<Cmd>execute('normal! ' . v:count1 . 'n')<CR><Cmd>lua require('hlslens').start()<CR>]],
                kopts)

which is loaded in

nvim\lua\config\plugins.lua
62:     require("config.plugins.editsearch"),
yimingwangdell commented 2 months ago

@matu3ba I just use single init.vim now, the _init.lua and all .lua file are not used anymore.

stevearc commented 2 months ago

I believe this was caused by accidentally forcing the cursor position to column 0. Should be fixed now