You are not logged in.

#1 2019-04-18 15:20:14

Norseman06
Member
Registered: 2014-02-06
Posts: 12

[SOLVED] Strange Behavior in Vim when invoking from Script

I have a script that launches entr in the background and then starts vim to edit a text file.
When the text file is saved the entr command converts the .md file to .pdf
This works on raspbian just fine however on my arch install using the arrow keys causes the letters A, B, C, or D to be typed.
I have No Compatible set in my vimrc.
Also if I just run vim from the command line I do not have this issue it only happens when I invoke vim via the script.

What could be causing this?

Thanks

The script I use to auto render .md files

    #!/bin/bash
    killline="entr -p $HOME/dotfiles/Scripts/md2pdf.sh $1"
    pkill -f "$killline" 
    echo "$1" | entr -p $HOME/dotfiles/Scripts/md2pdf.sh "$1" > /dev/null & 
    vim "$1"
    pkill -f "$killline" && exit

Last edited by Norseman06 (2019-05-07 16:19:55)

Offline

#2 2019-04-18 15:43:33

Awebb
Member
Registered: 2010-05-06
Posts: 6,272

Re: [SOLVED] Strange Behavior in Vim when invoking from Script

If you comment out the entr line, does it still behave strangely?

Offline

#3 2019-04-18 15:58:25

Norseman06
Member
Registered: 2014-02-06
Posts: 12

Re: [SOLVED] Strange Behavior in Vim when invoking from Script

Commenting out the entr line makes vim work properly.

Offline

#4 2019-05-07 16:19:24

Norseman06
Member
Registered: 2014-02-06
Posts: 12

Re: [SOLVED] Strange Behavior in Vim when invoking from Script

I managed to find a solution by adding -n to the entr command it ignores tty which solved the issue.

#!/bin/bash
killline="entr -p $HOME/dotfiles/Scripts/md2pdf.sh $1"
pkill -f "$killline" 
echo "$1" | entr -n -p $HOME/dotfiles/Scripts/md2pdf.sh "$1" > /dev/null & 
vim "$1"
pkill -f "$killline" && exit

Offline

Board footer

Powered by FluxBB