Last active
September 4, 2020 02:10
-
-
Save windwp/c9939086b2439678460d17498a573b3c to your computer and use it in GitHub Desktop.
vim_preview.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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