Closed terminalmage closed 7 months ago
Thanks for spotting this. The documentation is indeed out of date. #3573 fixes it.
tl;dr you can either use a VIM plugin or set edit.hardlink
to false.
Thanks! I prefer to keep plugins to a minimum, so I chose to disable hardlinking. However, I noticed a separate issue upon doing so, which I have reported in https://github.com/twpayne/chezmoi/issues/3574.
Describe the bug
In the docs, the following autocommand is recommended to automatically
chezmoi apply
a file when you save it.However,
chezmoi edit
does not open the corresponding file from its position in~/.local/share/chezmoi/
. It creates a tempdir, adds the directory path relative to your homedir, and opens the file underneath that. For example, when I runchezmoi edit ~/.config/tmux/tmux.conf
(which is templated), the file that chezmoi opens is:This does not match the path from my autocommand, so of course it does not properly apply changes.
As a workaround, I have added the following autocommand:
There are a couple downsides to this though:
chezmoi apply --source-path
, since the path opened by chezmoi is not within~/.local/share/chezmoi
.--source-path
, I have to runchezmoi apply
, which applies to all. But there's a problem with this approach. If there are local changes, chezmoi will ask if you want to skip/overwrite/etc., but when run via an autocommand, even withsilent
removed, I don't get that skip/overwrite/etc. prompt in vim. Instead, it just fails silently (again, even withsilent
removed). No changes can be automatically applied until I overwrite the file or revert the local changes.Neither of these options are great. Ideally, the files would just be opened in
~/.local/share/chezmoi
(and they seem like they were at one time, or else the docs wouldn't have been written that way).To reproduce
With
EDITOR=vim
(orEDITOR=nvim
), runchezmoi edit
on any file managed by chezmoi.Expected behavior
File is opened under
~/.local/share/chezmoi
, as suggested in the docsOutput of command with the
--verbose
flagNo output
Output of
chezmoi doctor