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

Return to original window when closing toc or word count #2817

Closed
petobens opened this issue Oct 25, 2023 · 6 comments
Closed

Return to original window when closing toc or word count #2817

petobens opened this issue Oct 25, 2023 · 6 comments
Labels

Comments

@petobens
Copy link

petobens commented Oct 25, 2023

Description

If I have a split buffer and either open the table of contents or the word count buffer and then quit those buffers then the cursor doesn't return to the original window.

Steps to reproduce

Note: I can add a minimal.tex file if this is not immediately reproducible.

  1. Open a foo.tex file with minimal content:
\documentclass{article}
\begin{document}
\section{Foo}
Foo
\end{document}
  1. Open the TOC or the count word buffer
  2. Press q to close such buffers.
    vimtex

Expected behavior

After 3. the cursor should return to the original window (right)

Actual behavior

It goes to the left window

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Arch Linux
  Vim version: NVIM v0.10.0-dev-1413+g684e93054b
  Has clientserver: true
  Servername: /tmp/nvimsocket

VimTeX project: foo
  base: foo.tex
  root: /home/pedro/Desktop/foo-latex
  tex: /home/pedro/Desktop/foo-latex/foo.tex
  main parser: current file verified
  document class: article
  compiler: arara
    options:
      --log
@petobens petobens added the bug label Oct 25, 2023
@lervag
Copy link
Owner

lervag commented Oct 27, 2023

This seems like a bug, but I can't immediately reproduce. I believe you may have some settings that are relevant. Could you show me which VimTeX settings you are using?

@lervag
Copy link
Owner

lervag commented Oct 27, 2023

I tried to reproduce with your foo.tex file and with this minimal init.vim file:

set nocompatible
set runtimepath^=~/.local/plugged/vimtex
set runtimepath+=~/.local/plugged/vimtex/after
filetype plugin indent on
syntax enable

nnoremap q :qall!<cr>

silent edit foo.tex

I save both files in a test directory and start neovim with nvim --clean -u init.vim. I create a split window with <c-w><c-v>, but on my end, the behaviour works as expected.

@petobens
Copy link
Author

petobens commented Nov 3, 2023

Using the following init.lua file

local root = '/tmp/nvim-minimal'

-- Set stdpaths to use root dir
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 = {
    {
        'lervag/vimtex',
        config = function()
            vim.g.vimtex_toc_config = {
                split_pos = 'vert topleft',
                split_width = 40,
            }
        end,
    },
}
require('lazy').setup(plugins, {
    root = root .. '/plugins',
})

I can reproduce the problem
Peek 2023-11-02 23-55

@lervag
Copy link
Owner

lervag commented Nov 4, 2023

Thanks; with this I can also reproduce. I'll look into it.

lervag added a commit that referenced this issue Nov 4, 2023
@lervag
Copy link
Owner

lervag commented Nov 4, 2023

I think it's fixed now.

@lervag lervag closed this as completed Nov 4, 2023
@petobens
Copy link
Author

petobens commented Nov 5, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants