jEdit Community - Resources for users of the jEdit Text Editor
About C++ mode
Submitted by Anonymous on Wednesday, 10 November, 2004 - 14:49
Hello, Is it possible to make jEdit indent lines more like Emacs's cc-mode? I mean when I write something like this for example: cout << "some very long story..." and continue to next row with << someVariable << endl; Emacs indents <<-marks to same column but jEdit doesn't. In my opinion that looks bad. This is just one example and there are other cases too. I wouldn't like to change back to Emacs because of this since jEdit is so much easier to use and I like the Secure FTP option.
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Setting "buffer.deepIndent=tr
by Anonymous on Wed, 10/11/2004 - 16:13
Setting "buffer.deepIndent=true" using Utilities > Action Bar might help, but I don't think it will recognize "<<". For what it's worth, Slava has said he plans to improve indentation for 4.3.

-Ollie
 
editing cplusplus.xml
by Anonymous on Wed, 10/11/2004 - 16:39
That deepIndent didn't seem to help. Could it help to edit the regular expression "\s*(((if|while)\s*\(|else\s*|else\s+if\s*\(|for\s*\(.*\))[^{;]*)" in property indentNextLine in cplusplus.xml? I am very much unfamiliar with regular expressions, need help...
 
Try: \s*(cout\s*<<[^
by Anonymous on Wed, 10/11/2004 - 18:35
Try:

\s*(cout\s*<<[^;]*)|(((if|while)\s*\(|else\s*|else\s+if\s*\(|for\s*\(.*\))[^{;]*)

I haven't tested it much, so don't know if it will break anything. I'd suggest saving a copy of the original regexp.

-Ollie
 
Thanks. That was a step to t
by Anonymous on Thu, 11/11/2004 - 08:58
Thanks. That was a step to the right direction. Now I should learn to edit regexps myself to be able to add more "rules" when to indent. Is there any simple pattern for adding those rules into that expression? for example if a line contains class-definition like

class SomeClass {

the next line should not be intended because the next word would be "public:"
And when ever there is a ":" in the end of the line the next line should be intended. So it should look like this:

class SomeClass {
public:
      SomeClass();
      ...

jEdit does this:
class SomeClass {
      public:
      SomeClass();
      ...

That case with cout works fine on first line after "cout <<" but after that the indentation goes backwards.
User login
Browse archives
« November 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   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300