Elvish Shell

Recently, I’ve been trying out a new shell: Elvish. There’s a few special things about it, but in 30 words: pipes are for structured objects and effectively zero effort is made to have Elvish script look anything like {Ba,z,da,fi,...,}sh. Its written in go and the internal script looks very similar to c. However, Kakoune as a tool is an interesting integration. I’m currently writing some plugins in elvish, and trying to see how well I can have Kakoune communicating using structured json in pipes. I’m curious the community’s opinion on elvish as a shell, and as a tool to integrate within kakoune.

As a side note, the single Kakoune tool I use most is something I haven’t seen around, but people should really have. In elvish, it looks like this:

fn e [@a]{
    if (has-value [(kak -l)] $a[0]) {
       kak -c $@a
    } else {
       kak -s $@a

It defines the e command, where e <name> <file> will either connect to or create session <name>, and open the file. I used to spend far too much time carefully copying numbers back and forth for session names and it’s a helpful little tool. I have a little bash equivalent if anyone wants it.

For me, I have a kakrc local file which sets the session name. Alternatively, I just rename the session to the project name manually. I basically have one session that lasts the whole week for each repo, so it’s not really a problem for me.

I like that approach, and I have something similar for longer projects, but my biggest gripe was quick one-hour forays into a few scripts. For whatever reason, renaming sessions never occurred to me. Just a 5-month-long brain fart I guess.

Pipes are objects? Is that like Powershell?

Elvish took inspiration in PowerShell yes.

From Learn Elvish:

1 Like

Do you use elvish.kak? I’ve been trying to improve my experience of writing Elvish in Kak, but the library listed from the Awesome-elvish repo is gone.

I’ve opened up Remove elvish.kak by mmlb · Pull Request #20 · elves/awesome-elvish · GitHub and pinged @notramo to see if they can bring the file back.