Re: [dev] [st] mouse usage, right click to plumb selection

From: Jérôme Andrieux <jerome_AT_jardinmagique.info>
Date: Tue, 12 Sep 2017 15:26:29 +0200

> I like the idea but it should only be part of the core if enough
> people want it to be which I doubt. Having it as a patch is good
> enough for me.

Everything is good then, patch is online and discussion is starting.

> Are you using the plumber from plan9 from user space or do you use
> something home-grown? Care to share?

Both actually but I have been working on it yesterday.

I use plumb within acme and a set of shell script elsewhere, with a
plumb fallback.
What I really need is a decent editor wrapper and everything could go
through plumber, even if I don't quite like its declarative rules
syntax.

My main workflow is to send some `path/file:line:col` (those would
hopefully be sam expressions) to vim via `vim --remote` and
https://github.com/kopischke/vim-fetch.
I'm trying https://github.com/martanne/vis lately, but boy, habits die hard.

cat bin/plumb.sh
```
#!/bin/zsh

pattern="$_AT_"
if [[ "x" == "x$pattern" ]]; then
    pattern=`xclip -o`
fi

patternbase=${pattern%%:*}
filename=""

if [[ -e "$pattern" ]]; then
    filename="$pattern"
elif [[ -e "$patternbase" ]]; then
    filename="$patternbase"
fi

mimetype=`file -b -L --mime-type "$filename"`
case "$mimetype" in
    text\/*)
        edit.sh "$pattern"
        ;;
    application\/pdf)
        zathura "$pattern"
        ;;
    image\/*)
        feh -Z "$pattern"
        ;;
    inode\/directory)
        rox "$pattern"
        ;;
    *)
        plumb "$pattern"
esac
```
cat bin/edit.sh
```
#!/bin/zsh

running=`vim --serverlist | wc -l`
if [[ "$running" -eq 0 ]] ; then
    st vim "$_AT_"
else
    vim --remote "$_AT_"
fi
```
Received on Tue Sep 12 2017 - 15:26:29 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 12 2017 - 15:36:20 CEST