jEdit Community - Resources for users of the jEdit Text Editor
Automatic indenting of (PL) SQL
Submitted by net-res on Tuesday, 18 December, 2007 - 07:29
When I edit PL-SQL files in jedit, with jedit set to PL-SQL (or any other SQL) mode, C-i removes all indentation rather than fixing it. For example

BEGIN
____select seq.nextval into col1 from dual ;
____return col1;
END;

becomes

BEGIN
select seq.nextval into col1 from dual ;
return col1;
END;

after C-i

How can I fix this?

(had to add underscores since the forum removed leading spaces and tabs)
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Read the documentation :)
by phade on Wed, 02/01/2008 - 15:20
Read the documentation, especially the modes part Smiling JEdit's indenting is handled by syntax modes. Every syntax mode is in separate xml file in modes subdirectory. To avoid corrupting system mode files you should copy it into modes subdir under your personal jedit settings directory (for example in linux ~/user/.jedit/modes).

See: http://jedit.org/users-guide/installing-modes.html

For tsql mode override I copied tsql.xml to my modes dir and updated catalog file with:

<MODE NAME="tsql" FILE="tsql.xml" FILE_NAME_GLOB="*.sql" />

Then in this overrided tsql.xml under PROPS section I added lines:

<PROPERTY NAME="indentNextLines" VALUE="^BEGIN" />
<PROPERTY NAME="unindentThisLine" VALUE="\s*END" />
<PROPERTY NAME="unindentNextLines" VALUE="\s*END" />
<PROPERTY NAME="electricKeys" VALUE="D" />

See some other mode files for best reference.
 
hei, thanks that was a lot of
by bodymind on Thu, 30/10/2008 - 14:38
hei, thanks that was a lot of help on starting with mode editing Smiling

can you help me doing an indentation like this:

create table rubrica (
----id-------------serial primary key,
----codigo---------text not null,
----designacao-----text not null,
----natureza-------text not null,
----created--------timestamp not null default now(),
----modified-------timestamp not null default now()
);

the types are all aligned... in jedit the identation looks like this:

create table rubrica (
----id--------serial primary key,
----codigo------text not null,
----designacao----text not null,
----natureza-----text not null,
----created--------timestamp not null default now(),
----modified--------timestamp not null default now()
);
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293