Skip to content

Alternate buffer not restoring cursor position with window splits #28

@natecraddock

Description

@natecraddock

Sometimes I am editing a file a.txt and I want to reference two separate locations while editing. For this I usually split the window. I will also often switch between the alternate buffer b.txt for another reference. Under some circumstances (detailed below), this plugin prevents restoring the cursor to the last buffer position when switching alternate buffers. Here are two recordings:

In both cases I:

  • Open a.txt for editing. Note that the cursor starts on line 3 (the '" marks's location)
  • Use 'G' to view the bottom of a.txt
  • Split my window with <c-w>s
  • Refocus the top window to the top of a.txt and open b.txt for editing in the lower window
  • Use <c-6> to switch to alternate buffer repeatedly in the lower window

If I open a.txt for editing and the '" mark is positioned on line 1, this issue does not occur.

The first with this plugin installed:
When switching from b.txt to a.txt as the alternate buffer with this plugin installed, the cursor is returned to line 3, where my file was opened (the '" mark). This loss of context removes the benefit of having an alternate buffer for reference.

lastplace.mp4

Without the plugin installed:

no-lastplace.mp4

Without the plugin installed everything works as expected. I also tested without loading my .vimrc which also functioned properly. I am using Neovim 0.6 if that makes a difference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions