Hi all,
I have set up Scite so it starts with a single instance. In that case
- if Scite is already startedand on the command line I call, say,
$ scite /path/to/file1.txt
... then the particular command above will return instantly - and
'file1.txt' will be opened in the currently running instance of Scite.
If after that I call:
$ scite /path/to/file2.txt
... then 'file2.txt' will be opened in a new tab of the currently
running instance of Scite.
Following this logic, I'd like to be able to do a insert of text
content from the command line, for instance:
$ scite -insert:"Some text to be inserted"
... would insert the text "Some text to be inserted" at the current
cursor position, in the currently active tab, in the currently running
instance of Scite (i.e. in this example, the text would be inserted in
'fle2.txt'). Obviously, the command would return instantly here too,
so I could call 'scite -insert' multiple times, and insert multiple
pieces of text in the currently opened document.
I think it would be preferable for me to actually call some sort of a
Lua script to do the actual inserting, because then I could possibly
control the caret (i.e. insert, then move caret at end), as well as
file saving (i.e. save file automatically as soon as insert has been
performed).
So, I tried looking through
http://www.scintilla.org/SciTEDoc.html#Command%20line%20arguments
... but unfortunately, I cannot find references to either inserting,
or calling Lua scripts, via command line arguments. On the other hand
- I found this:
SciTe command-line launcher: "-i text Insert text in the file."
http://www.frykholm.se/scitecmd.html
... which is for Windows (I use Linux) - and the code (http://
www.frykholm.se/main_cpp.html) uses:
........
} else if (cmd == "-i") {
REQUIRE_ARG;
std::string arg = argv[opt++];
std::string command = std::string("insert:") +
encode(arg);
commands.push_back(command);
......
SendMessage(w, WM_COPYDATA, 0, (long)&cds);
......
I guess, this is in line with what I would need - but that wrapper
launcher, being for Windows, is of no use to me.
So I'd like to ask - is it possible to somehow do this insert via
command line, in 'vanilla' Scite for Linux?? Possibly by calling a Lua
script?
Thanks in advance,
Cheers!