vim / vim

The official Vim repository

Home Page:https://www.vim.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'viewdir' doesn't work by default after migration to XDG_BASE_DIR

returnDanilo opened this issue · comments

Steps to reproduce

First, verify normal behavior(that is, without patch 9.1.0327):

  1. Put viewoptions=cursors in your vimrc.
  2. Open a file.
  3. Scroll down a bit to change cursor position.
  4. Close the file.
  5. Open the same file.
  6. Notice how the cursor position was remembered as intended.

Now, using a build which includes patch 9.1.0327:

  1. Move your ~/.vim directory under ~/.config.
  2. Put viewoptions=cursors in ~/.config/vim/vimrc.
  3. Open a file
  4. Scroll down a bit to change cursor position.
  5. Close the file.
  6. Open the same file.
  7. Notice how the cursors position is not remembered: It always starts at line 1.

To get the old behavior, one has to change the viewdir value to, for example, ~/.config/vim/view.

Note: If a ~/.vim directory exists, even if empty, the cursor position will be correctly remembered, but the view file will be created under this directory instead; thus not respecting the xdg base dir set.

Related to: #14182

Expected behaviour

Expected for vim to continue working normally, without further tweaks, after moving .vim to .config.

Alternatively, expected viewdir option to default to using an XDG_BASE_DIR-friendly value if other options(such as rtp) are set to follow the XDG_BASE_DIR.

Version of Vim

9.1 Included patches: 1-384

Environment

OS: Linux

Logs and stack traces

No response