Getting the logical path in VIM when there's a symlink -
i have next setup:
mkdir /1 mkdir /1/2 mkdir /1/2/3 ln -s /1/2/3 /1/3
if cd /1/3
, , pwd
, /1/3
. if utilize pwd -p
, can /1/2/3
, or pwd -l
forcefulness /1/3
.
in vim, i'm looking way /1/3
. if open file in /1/3/foo.txt
, , utilize fnamemodify(bufname(winbufnr(0)), ':p:h')
, returns /1/2/3
. how can tell give me same directory pwd
give?
it appears can't, other via system('pwd -l')
. according vim_use mailing list vim automatically resolves symlinks nowadays.
see text around :h e773
rationale; if vim went symlinks instead of resolved filename, it'd possible have same file open in 2 buffers under 2 different names, , vim become confused trying figure out swap file should be. see in :h version7.txt
:
unix: when editing file through symlink swap file utilize name of symlink. utilize name of actual file, editing same file twice detected.
vim symlink
No comments:
Post a Comment