vim-symlink
vim-symlink copied to clipboard
symlinks aren't resolved correctly
apologies for the vague title. this happens with neovim on ubuntu 20.04 when opening files from the command line, or from inside vim (:e
). i ran into this issue when using rust.vim which doesn't autosave formatted code correctly when the file path is still a symlink.
example:
mkdir test
echo "hello" > test/hello.txt
mkdir test2 && cd test2
ln -s ../test
vim test/hello.txt
:files
will show:
1 %a "test/hello.txt" line 1
.. which is still a symlink.
the problem seems to be:
autocmd BufRead * nested call s:on_buf_read(expand('<afile>'))
once i changed it to:
autocmd BufRead * nested call s:on_buf_read(expand('%'))
it expands correctly:
2 %a "../test/hello.txt" line 1