Reload current file via keybinding and optional auto-reload
Author: B83CCreated Aug 28, 2026Updated Sep 4, 2026
Labelsfeature-requestpager-related
Feature request: reload the current file (keybinding) and optional auto-reload
Motivation
When using bat to tail/live-inspect files (logs, generated configs, source files being edited by another process), there is currently no way to refresh the displayed content without quitting and re-running bat. It would be very useful to be able to reload the current file in place.
Proposed features
Manual reload via keybinding
- Add a keybinding (e.g.
rorCtrl+R) that reloads the current file from disk and re-renders the view. - Should work even when no search term is active.
- Add a keybinding (e.g.
Auto-reload (follow / watch mode)
- Add an option such as
--follow/--watch(or a keybinding that toggles it) that watches the file for changes and automatically reloads the content. - This would make
batusable liketail -ffor file monitoring.
- Add an option such as
Cursor / scroll position preservation
- After a reload, restore the current scroll position (and selection/active search match if possible) so the view doesn't jump back to the top.
- At minimum, attempt to keep the line that was on screen at the time of reload at the same screen offset.
Notes / considerations
- Restoring the exact scroll position is complicated if the file changes in length or content above the visible region (like in a text editor); a best-effort restoration based on the line number is acceptable.
- This interacts with
bat's pager (less) — reload may need to be implemented by feeding fresh content to the pager or via a pager-agnostic approach. Worth clarifying with maintainers how the pager integration should work. - For auto-reload, polling the file for mtime/size changes (like
tail -f) or an inotify-based approach could be considered.
Prior art
lesssupportsRto reread the current file (hides the control characters) — but does not reload changes from disk the way requested here.tail -f/--retryreloads on change.
Thanks for considering this!
Source: sharkdp/bat