launch scite with a particular language lexer pre-selected

134 views
Skip to first unread message

Prash

unread,
Aug 3, 2012, 10:44:21 AM8/3/12
to scite-interest
Hi,
The nature of my query makes it difficult to figure out if the
question has been asked already. If so, I'd be grateful if you could
direct me to that thread.

I have a shell script (yaourt on Arch Linux) that launches a text
editor for some files (the names could be PKGBUILD, *.install, or
something else). The opened file is either a Bash script or has a bash-
like syntax. If I want syntax highlighting, I have to click on
Language->Shell. What command-line arguments could I use to launch
scite such that the subsequent "-open:xxx" would pre-select the Shell
lexer for xxx?

Going through http://www.scintilla.org/SciTEDoc.html and
http://www.scintilla.org/SciTEFAQ.html did not help.

Neil Hodgson

unread,
Aug 3, 2012, 5:47:49 PM8/3/12
to scite-i...@googlegroups.com
Prash:

> I have a shell script (yaourt on Arch Linux) that launches a text
> editor for some files (the names could be PKGBUILD, *.install, or
> something else). The opened file is either a Bash script or has a bash-
> like syntax.

If you use #! to specify the interpreter in these files then you can use http://www.scintilla.org/SciTEDoc.html#property-shbang

Neil

Prash

unread,
Aug 4, 2012, 6:46:03 PM8/4/12
to scite-interest
Thank you for the reply. But I can't really control the content of
these files.

Here is some more context: Arch Linux has a package build system that
calls various shell scripts, and these scripts are not meant to be
executed on their own, and so, do not have the #! line. Also, these
scripts are written by many (hundreds of?) people, and in a very
specific format. The scripts sets a few specific variables, defines a
few specific functions, etc. The package installer that I use launches
my chosen editor to let me quickly examine or modify these files
before I install each package.

Neil Hodgson

unread,
Aug 5, 2012, 7:17:58 PM8/5/12
to scite-i...@googlegroups.com
Prash:

> Here is some more context: Arch Linux has a package build system that
> calls various shell scripts, and these scripts are not meant to be
> executed on their own, and so, do not have the #! line.

You can try setting the lexer for files called * but that will interfere with settings for particular extensions:
lexer.*=bash

Neil

Philippe Lhoste

unread,
Aug 8, 2012, 4:57:36 AM8/8/12
to scite-i...@googlegroups.com
On 05/08/2012 00:46, Prash wrote:
> Thank you for the reply. But I can't really control the content of
> these files.
>
> Here is some more context: Arch Linux has a package build system that
> calls various shell scripts, and these scripts are not meant to be
> executed on their own, and so, do not have the #! line. Also, these
> scripts are written by many (hundreds of?) people, and in a very
> specific format. The scripts sets a few specific variables, defines a
> few specific functions, etc. The package installer that I use launches
> my chosen editor to let me quickly examine or modify these files
> before I install each package.

If the others suggestions don't suit you, you can use a solution to
reduce the inconvenience: if you look into the global properties file,
you will find keyText and some other definitions used in the
menu.language property.
You can copy these definitions into your user properties file and modify
it to your taste (I have my own set of language choice.
And I defined, for example, a
keyJava=Ctrl+Shift+F12
property that I used in the Java entry:
&Java|java|$(keyJava)|\

You can do the same for your language, thus after opening it you will
see it in plain text, but with a key hit (eg. F12 for quick access) you
will switch to your language. That's an additional operation, so not as
convenient as a default setting, but that becomes a minor annoyance.

--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- http://PhiLho.deviantART.com
-- -- -- -- -- -- -- -- -- -- -- -- -- --

Prash

unread,
Aug 9, 2012, 10:33:52 AM8/9/12
to scite-interest


On Aug 8, 10:57 am, Philippe Lhoste <Phi...@GMX.net> wrote:
> If the others suggestions don't suit you, you can use a solution to
> reduce the inconvenience: if you look into the global properties file,
> you will find keyText and some other definitions used in the
> menu.language property.
> You can copy these definitions into your user properties file and modify
> it to your taste (I have my own set of language choice.
> And I defined, for example, a
>    keyJava=Ctrl+Shift+F12
> property that I used in the Java entry:
>    &Java|java|$(keyJava)|\
>
> You can do the same for your language, thus after opening it you will
> see it in plain text, but with a key hit (eg. F12 for quick access) you
> will switch to your language. That's an additional operation, so not as
> convenient as a default setting, but that becomes a minor annoyance.
>
> --
> Philippe Lhoste
> --  (near) Paris -- France
> --  http://Phi.Lho.free.fr
> --  http://PhiLho.deviantART.com
> --  --  --  --  --  --  --  --  --  --  --  --  --  --

Thanks! I have done as you suggested now.

Martin Panter

unread,
Aug 17, 2012, 2:05:36 AM8/17/12
to scite-i...@googlegroups.com, Prash
Hi Prash

I also use Arch and occasionally use Scite to edit PKGBUILD files. In
my “.SciTEUser.properties” file I have the following line which
automatically sets the lexer:

lexer.PKGBUILD=bash

Link to full file: (but I’m pretty sure the only relevant bit is the
line line above)
https://github.com/vadmium/etc/blob/master/scite/SciTEUser.properties
Reply all
Reply to author
Forward
0 new messages