Skip to content

Instantly share code, notes, and snippets.

@windwp
Last active September 4, 2020 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save windwp/c9939086b2439678460d17498a573b3c to your computer and use it in GitHub Desktop.
Save windwp/c9939086b2439678460d17498a573b3c to your computer and use it in GitHub Desktop.
vim_preview.sh
#!/bin/bash
path=$@
IFS=':' read -r -a array <<< "$path"
file=${array[0]}
start=$((${array[1]} - 1 ))
end=$((${array[1]} + 5))
file=${file/\~/$HOME}
line=${array[2]}
bat $file -r $start:$end -H ${array[1]} --color always --decorations never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment