slang-users mailing list

[2021 Date Index] [2021 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] Is there a braceless call syntax?


Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> Hi,
> I recall a nice thing in Vim – ability to define own «commands», which were
> an interface to vimscript function that didn't require parentheses when
> calling, e.g.:
>
> MyEcho "Hi there!"
>
> They have been quite useful to:
> - create a distinct API, entry points to the script,
> - allow to skip quoting around the passed in string/value, i.e.:
>
> MyEcho HiThere !
>
> would work perfectly fine if the command would be configured to just pass
> everything following it. I've utilized this to create a custom print
> command (https://github.com/vim-add-ons/vim-smart-print)

No such syntax is supported unless you want to roll your own function
and tokenizer.  slsh provides an example of this as is indicated by its
help command:

slsh> help
Most commands must end in a semi-colon.
If a command begins with '!', then the command is passed to the shell.
  Examples: !ls, !pwd, !cd foo, ...
Parenthesis are automatically added if the first word is a function and
is followed by a ','.  For example:
  plot, 1, 2;color="red"  ==>  plot(1,2;color="red");
Special commands:
  help <help-topic>
  apropos <something>
  start_log( <optional-log-file> );
    start logging input to a file (default is slsh.log)
  stop_log();
    stop logging input
  save_input (<optional-file>);
    save all previous input to a file (default: slsh.log)
  who;
    show a list of locally defined variables and functions
  quit;

The implementation is in slsh/lib/slshrl.sl.

I hope this helps,
--John
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.


[2021 date index] [2021 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]