Skip to content

[Bug] layout selection is not persistent when using JJ adapter #312

Description

@jakubbortlik

Description

Hi David,
When I'm using the JJ adapter, and do something like DiffviewOpen main, and I change the layout with g<C-x>, the layout reverts back to the default when I switch tabs.

Expected behavior

Layout should be persistent when switching tabs.

Actual behavior

Layout reverts to the default when switching tabs.

Steps to reproduce

  1. nvim --clean -u mini.lua
  2. :DiffviewOpen main on a branch
  3. g<C-x> to switch layout
  4. gtgt to switch tabs

Health check

Output of :checkhealth diffview
diffview:                                                                 2 ⚠️

Checking plugin dependencies
- ✅ OK nvim-web-devicons installed.
- ⚠️ WARNING Optional dependency 'mini.icons' not found.

Checking VCS tools
- The plugin requires at least one of the supported VCS tools to be valid.
- ✅ OK Jujutsu found.
- ✅ OK Jujutsu is up-to-date. (0.44.0)
- ✅ OK Git found.
- ✅ OK Git is up-to-date. (2.55.0)
- ✅ OK Mercurial found.
- ✅ OK Mercurial is up-to-date. (7.2.4)
- ⚠️ WARNING Configured p4_cmd is not executable: 'p4'

Log info

Relevant info from :DiffviewLog
############################
### PUT LOG CONTENT HERE ###
############################

Neovim version

NVIM v0.12.5
Build type: Release
LuaJIT 2.1.1774638290

Operating system and version

Linux 7.1.10-1-MANJARO x86_64 GNU/Linux

Minimal config

local root = vim.fn.stdpath("run") .. "/nvim/diffview-plus.nvim"
local plugin_dir = root .. "/plugins"
vim.fn.mkdir(plugin_dir, "p")

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

local plugins = {
  { "nvim-web-devicons", url = "https://github.com/nvim-tree/nvim-web-devicons.git" },
  { "diffview-plus.nvim", url = "https://github.com/dlyongemallo/diffview-plus.nvim.git" },
}

for _, spec in ipairs(plugins) do
  local install_path = plugin_dir .. "/" .. spec[1]
  if vim.fn.isdirectory(install_path) ~= 1 then
    if spec.url then
      print(string.format("Installing '%s'...", spec[1]))
      vim.fn.system({ "git", "clone", "--depth=1", spec.url, install_path })
    end
  end
  vim.opt.runtimepath:append(spec.path or install_path)
end

require("diffview").setup({
  preferred_adapter = "jj",  -- THIS IS THE LINE REQUIRED FOR REPRODUCTION
})

vim.opt.termguicolors = true
vim.cmd("colorscheme habamax")

print("Ready!")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions