martanne / vis

A vi-like editor based on Plan 9's structural regular expressions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to execute multiple commands in braces?

honestSalami opened this issue · comments

I'm following rob pike's sam tutorial, and I ran into this sre:

,x/Emacs|vi/{
              g/Emacs/ c/vi/
              g/vi/ c/Emacs/
}

I'm trying to do it in vis like this: ,x/Emacs|vi/ {g/Emacs/ c/vi} {g/vi/ c/Emacs/}, but it returns 'unknown command'. Am I doing something wrong? Or is this not implemented in vis?

My version of vis is: vis v0.7-29-g1a958f2 +curses +lua +tre

I've tried :,x/(Emacs|vi)/ { g/Emacs/ c/vi ^M g/vi/ c/Emacs/ } too, as suggested by https://github.com/martanne/vis/wiki/Differences-from-Sam#limited-command-prompt-support-for-multi-line-commands, but it still returns 'unknown command'

Just tried :x/(Emacs|vi)/ { g/Emacs/ c/vi g/vi/ c/Emacs/ } and it worked

hm, I tried it just as you typed it and it did not work for me. Could you publish your vis version and OS please?

vis 0.7, Gentoo Linux

I suspect you are not typing the whole command but copy-paste'ing it. When I did it like that, it showed me that 'unknown command' message, but when typing it, it works

I finally got it to work. It seems that skipping the closing backlash was the problem:
,x/Emacs|vi/ { g/Emacs/ c/vi g/vi/ c/Emacs }
vs
,x/Emacs|vi/ { g/Emacs/ c/vi/ g/vi/ c/Emacs/ }

Thank's for all the help! It was nice to have someone else worry about this : )