rkitover / vimpager

Use Vim as PAGER
http://www.vim.org/scripts/script.php?script_id=1723
Other
769 stars 72 forks source link

vimcat of a directory will freeze the process #250

Closed mancausoft closed 4 years ago

mancausoft commented 4 years ago

I was trying vimcat and i press enter before finish the command... and use it on a directory output:

a:~/code/vimpager$ ./vimcat  /etc/apt/
cat: /etc/apt/: Is a directory

But the process is still open, and CTRL+C dosen't works... I had to do a CTRL + Z put in background and use kill -9 to kill it...

Alpt commented 4 years ago

Here is a workaround. Put this in your bashrc and change PATH-TO-VIMPAGER

vimcat() {

    for s in "$@"; do
        if [ -d "$s" ]; then
            echo "vimcat: $s is a directory" > /dev/stderr
        else
            PATH-TO-VIMPAGER/vimcat "$s"
        fi
    done

}