Another implementation to resolve symbolic link paths,
using :file
instead of :edit
.
- No
autocmd-nested
for performance. - Clean buffer list without
:bwipeout
and moll/vim-bbye. - An option
b:symlink_should_resolve_path
to exclude arbitrary paths.
Install with lazy.nvim:
{ "aileot/vim-symlink" }
Install with packer:
use({ "aileot/vim-symlink" })
Install with vim-plug:
Plug 'aileot/vim-symlink'
(default: 1
)
A buffer-local option.
If it is set to 0
or v:false
(or set vim.b.symlink_should_resolve_path
to false
in nvim),
path for the buffer will not be resolved.
This option is expected to be set on BufReadPre
.
Due to the :file
redirection, you could get confused in some autocmd events:
-
The values of
autocmd-pattern
,<amatch>
, and<afile>
, to a symbolic link would be either the symbolic link itself or its resolved path. -
The buffer names (by
bufname()
, ornvim_buf_get_name()
in nvim) might be different from what you expect to the path as well.
Please consider applying resolve()
to <amatch>
or <afile>
as needed.
Implementation on :file
has been discussed in
tpope/vim-fugitive#147.