[GH-ISSUE #304] Hot reload don't work when file is edited using Vim #8552

Closed
opened 2026-05-23 03:52:45 +01:00 by JakeStanger · 1 comment
Owner

Originally created by @Rodrigodd on GitHub (Sep 10, 2023).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/304

See https://github.com/notify-rs/notify/issues/247. By default, vim writes to a backupfile, that is them moved to replace the original, which actually deletes the original file, and replace it by a new one, with another inode, which makes notify-rs loose track of the file.

To Reproduce
Steps to reproduce the behavior:

  1. Start a new ironbar process.
  2. Open sytle.css in vim: vim ~/.config/style.css .
  3. Change something.
  4. Check that :set nowritebackup? is on (which is by default), and write the file: :w.
  5. Hot-reload doesn't trigger, and subsequent changes to file, using any method, don't trigger the hot-reload.

You can use ls -i ~/.config/style.css before and after :w to verify that the inode of the file changed.

Expected behavior

Hot-reload should work regardless of how the file is changed.

System information:

  • Distro: Arch Linux
  • Compositor: Sway
  • Ironbar version: build from source, at 4e67b73

Additional context

See https://github.com/notify-rs/notify/issues/247. See also https://github.com/notify-rs/notify/issues/247#issuecomment-644014318, that recommends watching the folder containing the file, instead of the file directly, and react to "remove" and "create" events.

Another workaround is to disable writebackup in vim: :set nowritebackup.

Originally created by @Rodrigodd on GitHub (Sep 10, 2023). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/304 See https://github.com/notify-rs/notify/issues/247. By default, vim writes to a backupfile, that is them moved to replace the original, which actually deletes the original file, and replace it by a new one, with another inode, which makes notify-rs loose track of the file. **To Reproduce** Steps to reproduce the behavior: 1. Start a new ironbar process. 2. Open `sytle.css` in vim: `vim ~/.config/style.css` . 3. Change something. 5. Check that `:set nowritebackup?` is on (which is by default), and write the file: `:w`. 6. Hot-reload doesn't trigger, and subsequent changes to file, using any method, don't trigger the hot-reload. You can use `ls -i ~/.config/style.css` before and after `:w` to verify that the inode of the file changed. **Expected behavior** Hot-reload should work regardless of how the file is changed. **System information:** - Distro: Arch Linux - Compositor: Sway - Ironbar version: build from source, at 4e67b73 **Additional context** See https://github.com/notify-rs/notify/issues/247. See also https://github.com/notify-rs/notify/issues/247#issuecomment-644014318, that recommends watching the folder containing the file, instead of the file directly, and react to "remove" and "create" events. Another workaround is to disable writebackup in vim: `:set nowritebackup`.
Author
Owner

@JakeStanger commented on GitHub (Sep 10, 2023):

Thanks for reporting, that does explain why I've had issues with Vim. Watching the directory instead should be fine as a fix, since there's going to be very little activity inside there.

<!-- gh-comment-id:1712772705 --> @JakeStanger commented on GitHub (Sep 10, 2023): Thanks for reporting, that does explain why I've had issues with Vim. Watching the directory instead should be fine as a fix, since there's going to be very little activity inside there.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#8552
No description provided.