Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active June 25, 2025 14:45
Show Gist options
  • Select an option

  • Save RichardBronosky/94024fac52780e03c936589f4c9ab914 to your computer and use it in GitHub Desktop.

Select an option

Save RichardBronosky/94024fac52780e03c936589f4c9ab914 to your computer and use it in GitHub Desktop.
A vim wrapper that allow you to use it for a pager, man reader, etc.
#!/usr/bin/env bash
set -eu
cache_file="/tmp/pager.cache"
[[ ! -p "$cache_file" ]] && touch "$cache_file" && trap "rm $cache_file" 0
cat > "$cache_file"
vim -R -c "terminal cat $cache_file"
@rubyDoomsday
Copy link

This is awesome 🥇 , thanks so much. I was having issue reading logs from Spacelift.io. I further simplified the command into an alias in my terminal by adding less() { vim -R --not-a-term -c "terminal cat $@" -c "only" } to my .zshrc profile. :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment