patch 9.1.1507: symlinks are resolved on :cd commands
Problem: File paths change from symlink to target path after :cd command
when editing files through symbolic links
Solution: Add "~" flag to 'cpoptions' to control symlink resolution.
When not included (default), symlinks are resolved maintaining
backward compatibility. When included, symlinks are preserved
providing the improved behavior. (glepnir)
related: neovim/neovim#15695
closes: #17628
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index b3c5697..cf064e1 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 9.1. Last change: 2025 Jul 01
+*options.txt* For Vim version 9.1. Last change: 2025 Jul 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2390,7 +2390,7 @@
*'cpoptions'* *'cpo'* *cpo*
'cpoptions' 'cpo' string (Vim default: "aABceFsz",
- Vi default: all flags, except "#{|&/\."
+ Vi default: all flags, except "#{|&/\.~"
|$VIM_POSIX|: all flags)
global
A sequence of single character flags. When a character is present
@@ -2680,6 +2680,13 @@
character, the cursor won't move. When not included,
the cursor would skip over it and jump to the
following occurrence.
+ *cpo-~*
+ ~ When included, don't resolve symbolic links when
+ changing directory with |:cd|, |:lcd|, or |:tcd|.
+ This preserves the symbolic link path in buffer names
+ and when displaying the current directory. When
+ excluded (default), symbolic links are resolved to
+ their target paths.
POSIX flags. These are not included in the Vi default value, except
when $VIM_POSIX was set on startup. |posix|