Skip to content
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

bug: autojump = true always moves you to the top of the sidebar #309

Closed
chrisgrieser opened this issue Oct 13, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@chrisgrieser
Copy link
Contributor

Neovim version (nvim -v)

NVIM v0.9.2

Operating system/version

macOS 13.5.2

Output of :AerialInfo

Show symbols: Class, Constructor, Enum, Function, Interface, Module, Method, Struct
man (not supported) [Filetype is not man]
markdown (not supported) [Filetype is not markdown]
lsp (supported)
treesitter (supported) (attached)
Configured backends:
Filetype: lua
-----------

Describe the bug

After the opening and closing Aerial once, every subsequent opening of Aerial will move your cursor to the top of the symbol outline if you have autojump = true. This results, due to the nature of autojump, also in an unintended movement in the source window.

Steps To Reproduce

  1. Configure: autojump = true
  2. Move to myFunc6 of the example file.
  3. Run AerialToggle. Cursor correctly lands at the symbol for myFunc6.
  4. Close Aerial with AerialToggle. Open Aerial again with AerialToggle.

Result: Cursor ends up at the top of the symbols window, and due to autojump also moves us to the top of the file to myFunc.

Expected Behavior

In the scenario described above, the cursor should stay at myFunc6, like the first time you open Aerial.

Minimal example file

local function myFunc() print(debug.getinfo(1, "n").name) end

myFunc()


local function myFunc() print(debug.getinfo(1, "n").name) end

local function myFunc1() print(debug.getinfo(1, "n").name) end
local function myFunc2() print(debug.getinfo(1, "n").name) end
local function myFunc3() print(debug.getinfo(1, "n").name) end
local function myFunc4() print(debug.getinfo(1, "n").name) end

local function myFunc5() print(debug.getinfo(1, "n").name) end

local function myFunc6() print(debug.getinfo(1, "n").name) end

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({
        autojump = true,
      })
    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

@chrisgrieser chrisgrieser added the bug Something isn't working label Oct 13, 2023
@stevearc
Copy link
Owner

Should be fixed now

@chrisgrieser
Copy link
Contributor Author

can confirm it's fixed. Thanks!

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

No branches or pull requests

2 participants