diffview.nvim icon indicating copy to clipboard operation
diffview.nvim copied to clipboard

[Bug] CTRL-W_T does not move focus to new tab

Open jakubbortlik opened this issue 1 year ago • 0 comments

Description

In the first place, thank you for your amazing plugin! Either on its own or utilized by my other favourite plugin gitlab.nvim, diffview.nvim is of enormous help in reviewing code history.

Quite frequently, while inspecting a diff with diffview, I open a file in a new split, e.g,. a help page, and then I decide to move that window to another tab page. This can be achieved with the <c-w>T normal mode command (see :h CTRL-W_T). This command first moves the window to a new tab page and then moves focus to that tab. However, when in a diffview tab, focus stays in this tab while the screen flickers as the view is switched several times between the newly created tab page and the diffview tab.

Expected behavior

CTRL-W_T moves current window to a new tab page and switches focus to that tab

Actual behavior

CTRL-W_T moves current window to a new tab page and switches focus to that tab and back to the diffview tab several times.

Steps to reproduce

  1. nvim --clean -u mini.lua
  2. :DiffviewOpen
  3. :help CTRL-W_T
  4. <c-w>T

Health check

Output of :checkhealth diffview
diffview: require("diffview.health").check()

Checking plugin dependencies ~
- OK nvim-web-devicons installed.

Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.43.0)
- WARNING Configured `hg_cmd` is not executable: 'hg'

Log info

No response

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742

Operating system and version

Linux 6.1.71-1-MANJARO x86_64 GNU/Linux

Minimal config

-- #######################################
-- ### USAGE: nvim --clean -u mini.lua ###
-- #######################################

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

-- set stdpaths to use root
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 = {
  {
    "sindrets/diffview.nvim",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    config = function()
      require("diffview").setup({
        -- ##############################################################################
        -- ### ADD DIFFVIEW.NVIM CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE ###
        -- ##############################################################################
      })
    end,
  },
  -- ##################################################################
  -- ### ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
  -- ##################################################################
}
require("lazy").setup(plugins, { root = root .. "/plugins" })
require("lazy").sync({ show = false, wait = true })

vim.opt.termguicolors = true
vim.cmd("colorscheme " .. (vim.fn.has("nvim-0.8") == 1 and "habamax" or "slate"))

-- ############################################################################
-- ### ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ############################################################################

jakubbortlik avatar Feb 14 '24 17:02 jakubbortlik