Skip to content
Ramon de Vera Jr edited this page Mar 18, 2016 · 6 revisions

Command-line Parameter Usage Samples

z x.scala -l 'def command'

Opens x.scala, and looks for the text def command.

z x.scala -! 'scalac x.scala'

Opens x.scala, and executes scalac x.scala with x.scala as the window context.

z x.scala -c y.scala z.scala 

Opens x.scala in one column, and opens y.scala and z.scala in another column.

Button Action and Text

The Behavior Of The B2 (right-click) Action

With the latest release of the Z editor the need for the B3 button was removed and so the B2 button can execute commands and perform the Look action as well.

So when you B2 any piece of selected text (non-highlighted text just under the mouse pointer or a piece of highlighted text), then the following behavior is followed:

  • apply Look action to the selected text, starting from wherever the caret position is at
  • if the Look action fails (you can't find a match for the text - assuming that the text is a regular expression, or there is no such file or directory path to be opened), then the text will be executed as a command.

The main deficiency with this technique is that the Look action no longer wraps when you are searching for something and the search has gone to the end of the file.

Traversing directory trees

In the tagline of a window, say you have this piece of text:

/home/sandgorgon/projects/z-master/bin/images Get Put Zerox Close

If you B2, no highlighting - just a B2 action, right on top of Get, the action will be to get the contents of the directory given, provided that the text Get is not in the body of the window (due to B2 behavior mentioned above).

If you B2, no highlighting - just a B2 action, right on top of 'projects', the action that will be taken will be to open a new window that shows you the contents of /home/sandgorgon/projects - assuming the B2 behavior again. If you would have done a B2 right on top of 'z-master', the action will be... you guessed it, to open a new window that shows you the contents of /home/sandgorgon/projects/z-master.

Now, if you B2'ed on Bind on the same window, then you can essentially traverse the directory tree just by clicking on a section of the path and the window contents will update itself instead of opening many windows. This is what I prefer to do when traversing directory trees.

Of course, you can also B2 the directory contents shown in the window content or body and you can traverse the directory tree through there. Dot-dot (..) is recognized as well since it is a valid directory entry.

What if I need white space(s) as part of the parameters for a command I want to B2?

Well, by the default the system assumes that when single quoted text is seen, the whole text in the single quoted text is considered one parameter and it will be passed in as such.

For example, say you are in a window /home/sandgorgon/projects/myproj and you want to do an svn commit with a message. What I'd suggest to do is would be from the tagline of the window, I'd B2 the following text:

svn commit -m 'Code refactoring on xyz.scala file for Feature X'

When the editor sees that the text in single quotes will be passed in to the system command execution as one parameter.