Thanks for the replies. And kind offers of condolences.
But I'm afraid I didn't make myself clear. If, in the normal edit window, I type the line 'for i=1, 10 do'<enter> I want it to automatically go to the next line with that line indented 3 spaces. ( or 2 or 4 or whatever the indentations is set to) and when I enter a line 'end'<enter> the 'end' is automatically unindented whatever the setting is.
I'm aware of using snippets and tabs within macros. It seems with Geany that is used to do this (Geany 1.18 or 1.19) But my memory is not so good these days and I may be wrong. But I'm sure that it used to work in Scite (but does not work now) which uses Scintilla same as Geany. I don't remember how I made it work in Scite or Geany. But both have gone through several upgrades since those days and my memory may be flawed about this.
If this isn't possible any more, I understand and thank-you for any offers of assistance.
Doug
On 10/11/13 17:23, Doug Darrow wrote:
Thanks for the replies. And kind offers of condolences.
But I'm afraid I didn't make myself clear. If, in the normal edit window, I type the line 'for i=1, 10 do'<enter> I want it to automatically go to the next line with that line indented 3 spaces. ( or 2 or 4 or whatever the indentations is set to) and when I enter a line 'end'<enter> the 'end' is automatically unindented whatever the setting is.
Doug, try changing "Complete snippet" in Preferences (Keybindings) to Enter, and add this to snippets.conf:
do=do\n\t%cursor%
That solves the first case. I’m afraid I don’t know if Geany supports unindentation via snippets. Developers?
Sorry I can’t be more helpful.
James
Autoindentation is not handled by the Scintilla component. SciTE and Geany are hugely different in practice. Some Scintilla-based editors (such as Notepad++) don't even offer autoindentation at all.
I already gave you a link which shows you how to configure SciTE to autoindent Lua.
John
Hi,
Unfortunately Geany does not do language specific indentation. It currently has a few very simple indentation rules based on usage of {} or : (for Python only)
We have had long discussions about configurable approaches, but any that seem to provide a useful improvement also seem to add just as many annoying erroneous situations.
Coincidently I came across another programmers editor which does do specific indentation, and it was claimed it used 12% of its code, just for indentation!!!
Other IDEs do it based on parsing the code as you type and determining the indentation based on the language construct. However to remain light and fast Geany does not analyse the code on the fly, and so we are unable to use such a method.
Without wanting to re-ignite the indentation wars, if anybody has a simple, fast and configurable indentation method that does the right thing and does not do the wrong thing please let us know.
Cheers Lex
PS just a note that most methods seem to fail with things like indentation for lines that are continuations of expressions, function calls and similar situations. Or they only work if you use one specific style of source layout such as GNU style. Or they fail to respect manually set indentation for situations above.
On 11 November 2013 04:23, Doug Darrow dsdarrow01@gmail.com wrote:
Thanks for the replies. And kind offers of condolences.
But I'm afraid I didn't make myself clear. If, in the normal edit window, I type the line 'for i=1, 10 do'<enter> I want it to automatically go to the next line with that line indented 3 spaces. ( or 2 or 4 or whatever the indentations is set to) and when I enter a line 'end'<enter> the 'end' is automatically unindented whatever the setting is.
I'm aware of using snippets and tabs within macros. It seems with Geany that is used to do this (Geany 1.18 or 1.19) But my memory is not so good these days and I may be wrong. But I'm sure that it used to work in Scite (but does not work now) which uses Scintilla same as Geany. I don't remember how I made it work in Scite or Geany. But both have gone through several upgrades since those days and my memory may be flawed about this.
If this isn't possible any more, I understand and thank-you for any offers of assistance.
Doug _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 10/11/13 21:55, Lex Trotman wrote:
We have had long discussions about configurable approaches, but any that seem to provide a useful improvement also seem to add just as many annoying erroneous situations.
PS just a note that most methods seem to fail with things like indentation for lines that are continuations of expressions, function calls and similar situations. Or they only work if you use one specific style of source layout such as GNU style. Or they fail to respect manually set indentation for situations above.
Personally I think the existing system works fine. Snippets with tabs configurable to display at any width, with the option to convert to spaces, is ideal for me. The existing ability to set the tab width, or whether to insert spaces as tab, in a filetype definition is ideal. That’s all the language-specific indentation I need.
In my experience, over-aggressive ‘style enforcers’ are an annoyance more often than they are a help. A case in point being Emacs, where there seems to be no single option to set any single brace style for *all* C-like languages except that personally endorsed by Richard Stallman. That was the main reason Emacs went in the bin for me.
‘Unindentation’ as per Doug’s request would be nice to add to snippets, if it’s feasible, but apart from that the existing system treads the right line between being a helping hand and treading on your toes. Like most things in Geany, which is why I use it. If I wanted text editing to feel like wrestling Leviathan I’d use vi or Emacs... :)
Anyway, just my two cents, but getting back to Doug’s request, adding something like
[Lua] then=then\n\t%cursor% else=else\n\t%cursor% do=do\n\t%cursor%
to snippets.conf approximates what he was asking for, minus unindentation.
James
On 11 November 2013 09:36, James Brierley jmb8710@gmail.com wrote:
On 10/11/13 21:55, Lex Trotman wrote:
We have had long discussions about configurable approaches, but any that seem to provide a useful improvement also seem to add just as many annoying erroneous situations.
PS just a note that most methods seem to fail with things like indentation for lines that are continuations of expressions, function calls and similar situations. Or they only work if you use one specific style of source layout such as GNU style. Or they fail to respect manually set indentation for situations above.
Personally I think the existing system works fine. Snippets with tabs configurable to display at any width, with the option to convert to spaces, is ideal for me. The existing ability to set the tab width, or whether to insert spaces as tab, in a filetype definition is ideal. That’s all the language-specific indentation I need.
Good to see a happy customer :)
Perhaps the rest of us are just lazier, but we would *like* better indentation assistance, but not at the cost of lots of annoyances, like your Emacs one below.
In my experience, over-aggressive ‘style enforcers’ are an annoyance more often than they are a help. A case in point being Emacs, where there seems to be no single option to set any single brace style for *all* C-like languages except that personally endorsed by Richard Stallman. That was the main reason Emacs went in the bin for me.
To be fair since each "C-like" language is different (GNU C, Linux C, Stroustrup C++, Java) having one setting is less useful. I have found the latest Emacs indentation to be ok, but its based on code analysis, so its not immediate, you need to finish the language construct before it indents, which is distracting but I could get used to it. But such analysis is not available to Geany. And of course in some languages indentation is significant and required to follow specific rules, Python being the simplest, and Haskell being unfathomable.
‘Unindentation’ as per Doug’s request would be nice to add to snippets, if it’s feasible, but apart from that the existing system treads the right line between being a helping hand and treading on your toes. Like most things in Geany, which is why I use it. If I wanted text editing to feel like wrestling Leviathan I’d use vi or Emacs... :)
I believe we will always retain the simple indentation types, even if more complex ones are added, so you should be safe. Possibly adding %indent% and %undent% to the snippets would be a good idea, just needs someone to do it.
Cheers Lex
Anyway, just my two cents, but getting back to Doug’s request, adding something like
[Lua] then=then\n\t%cursor% else=else\n\t%cursor% do=do\n\t%cursor%
to snippets.conf approximates what he was asking for, minus unindentation.
James
-- "Unix is the worst computer operating system, except all the others that have been tried." _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Ah, this has reminded me: I forgot to mention, but perhaps it would be possible (for someone) to write a plugin which pipes your code through something such as Uncrustify, which is a modern version of the classic Unix utility ‘cb’. You would still need to hit a button to beautify your code (rather like the XML PrettyPrinter plugin) but at least it might be one way of having configurable indentation without costly on-the-fly parsing.
I’d have a go at this myself, but for the fact that I’m a CS graduate student (learning all that new stuff is great but why do they have to give you piles of coursework as well? :P)
James
On 13-11-10 03:35 PM, James Brierley wrote:
Ah, this has reminded me: I forgot to mention, but perhaps it would be possible (for someone) to write a plugin which pipes your code through something such as Uncrustify, which is a modern version of the classic Unix utility ‘cb’. You would still need to hit a button to beautify your code (rather like the XML PrettyPrinter plugin) but at least it might be one way of having configurable indentation without costly on-the-fly parsing.
I’d have a go at this myself, but for the fact that I’m a CS graduate student (learning all that new stuff is great but why do they have to give you piles of coursework as well? :P)
I wrote and use such a plugin for C/C++/Obj-c using Clang-Format. I actually use it "real-time" just always keeping my code perfectly formatted (triggers on a set of configurable chars like closing braces and semicolons and such), but auto/realtime formatting isn't on by default and you can choose to format a selection, document, or all open documents rather than having it in "real-time"/automatic mode.
It's here: http://codebrainz.github.io/code-format/
And a boring demo video is here: http://codebrainz.ca/screencasts/GeanyCodeFormatC++.avi
I think Colomban also started working on a more general purpose version of something like this using GNU Indent, Astyle or Uncrustify (or one of those), but I'm not sure how far it got.
Cheers, Matthew Brush
On 10/11/13 23:48, Matthew Brush wrote:
I wrote and use such a plugin for C/C++/Obj-c using Clang-Format. I actually use it "real-time" just always keeping my code perfectly formatted (triggers on a set of configurable chars like closing braces and semicolons and such), but auto/realtime formatting isn't on by default and you can choose to format a selection, document, or all open documents rather than having it in "real-time"/automatic mode.
It's here: http://codebrainz.github.io/code-format/
And a boring demo video is here: http://codebrainz.ca/screencasts/GeanyCodeFormatC++.avi
That looks darn good Matthew, good work. Thanks for the heads up.
James
Hey,
I try to build the Geany Code Format plugin from the git, usage the autoget.sh, and I get the follwoing errors (I have automake 1.14): /autoreconf: running: /usr/bin/autoheader --force usautoreconf: running: automake --add-missing --copy --force-missing r configure.ac:8: installing 'build-aux/compile' configure.ac:8: installing 'build-aux/config.guess' configure.ac:8: installing 'build-aux/config.sub' configure.ac:6: installing 'build-aux/install-sh' configure.ac:6: installing 'build-aux/missing' automake: warnings are treated as errors /usr/share/automake-1.14/am/ltlibrary.am: warning: 'codeformat.la': linking libtool libraries using a non-POSIX /usr/share/automake-1.14/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac' Makefile.am:10: while processing Libtool library 'codeformat.la
Regards, Yosef Or Boczko
בתאריך ב', נוב 11, 2013 בשעה 1:48 AM, Matthew Brush mbrush@codebrainz.ca כתב:
On 13-11-10 03:35 PM, James Brierley wrote:
Ah, this has reminded me: I forgot to mention, but perhaps it would be possible (for someone) to write a plugin which pipes your code through something such as Uncrustify, which is a modern version of the classic Unix utility ‘cb’. You would still need to hit a button to beautify your code (rather like the XML PrettyPrinter plugin) but at least it might be one way of having configurable indentation without costly on-the-fly parsing.
I’d have a go at this myself, but for the fact that I’m a CS graduate student (learning all that new stuff is great but why do they have to give you piles of coursework as well? :P)
I wrote and use such a plugin for C/C++/Obj-c using Clang-Format. I actually use it "real-time" just always keeping my code perfectly formatted (triggers on a set of configurable chars like closing braces and semicolons and such), but auto/realtime formatting isn't on by default and you can choose to format a selection, document, or all open documents rather than having it in "real-time"/automatic mode.
It's here: http://codebrainz.github.io/code-format/
And a boring demo video is here: http://codebrainz.ca/screencasts/GeanyCodeFormatC++.avi
I think Colomban also started working on a more general purpose version of something like this using GNU Indent, Astyle or Uncrustify (or one of those), but I'm not sure how far it got.
Cheers, Matthew Brush
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 13-11-10 03:58 PM, Yosef Or Boczko wrote:
Hey,
I try to build the Geany Code Format plugin from the git, usage the autoget.sh, and I get the follwoing errors (I have automake 1.14): /autoreconf: running: /usr/bin/autoheader --force usautoreconf: running: automake --add-missing --copy --force-missing r configure.ac:8: installing 'build-aux/compile' configure.ac:8: installing 'build-aux/config.guess' configure.ac:8: installing 'build-aux/config.sub' configure.ac:6: installing 'build-aux/install-sh' configure.ac:6: installing 'build-aux/missing' automake: warnings are treated as errors /usr/share/automake-1.14/am/ltlibrary.am: warning: 'codeformat.la': linking libtool libraries using a non-POSIX /usr/share/automake-1.14/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac' Makefile.am:10: while processing Libtool library 'codeformat.la
Weird. I don't know too much about Autotools but I guess it wants to see AM_PROG_AR to be placed, for example on line 9 in configure.ac just before AC_PROG_CC_C99. I never got this error here (Automake 1.11.6) and I don't really understand since I'm not building any static libraries (I thought I even explicitly disabled them in configure.ac:6 with "disable-static").
If you happen to know the cause and/or don't mind taking a minute, could you open an Issue on the Github project (https://github.com/codebrainz/code-format/issues) and I'll see if I can figure out what's happening there shortly.
Thanks, Matthew Brush
Well, you right, just need to add AM_PROG_AR before the line with LT_INIT.
Regards, Yosef Or Boczko
בתאריך ב', נוב 11, 2013 בשעה 2:22 AM, Matthew Brush mbrush@codebrainz.ca כתב:
On 13-11-10 03:58 PM, Yosef Or Boczko wrote:
Hey,
I try to build the Geany Code Format plugin from the git, usage the autoget.sh, and I get the follwoing errors (I have automake 1.14): /autoreconf: running: /usr/bin/autoheader --force usautoreconf: running: automake --add-missing --copy --force-missing r configure.ac:8: installing 'build-aux/compile' configure.ac:8: installing 'build-aux/config.guess' configure.ac:8: installing 'build-aux/config.sub' configure.ac:6: installing 'build-aux/install-sh' configure.ac:6: installing 'build-aux/missing' automake: warnings are treated as errors /usr/share/automake-1.14/am/ltlibrary.am: warning: 'codeformat.la': linking libtool libraries using a non-POSIX /usr/share/automake-1.14/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac' Makefile.am:10: while processing Libtool library 'codeformat.la
Weird. I don't know too much about Autotools but I guess it wants to see AM_PROG_AR to be placed, for example on line 9 in configure.ac just before AC_PROG_CC_C99. I never got this error here (Automake 1.11.6) and I don't really understand since I'm not building any static libraries (I thought I even explicitly disabled them in configure.ac:6 with "disable-static").
If you happen to know the cause and/or don't mind taking a minute, could you open an Issue on the Github project (https://github.com/codebrainz/code-format/issues) and I'll see if I can figure out what's happening there shortly.
Thanks, Matthew Brush _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 11 November 2013 10:35, James Brierley jmb8710@gmail.com wrote:
Ah, this has reminded me: I forgot to mention, but perhaps it would be possible (for someone) to write a plugin which pipes your code through something such as Uncrustify, which is a modern version of the classic Unix utility ‘cb’. You would still need to hit a button to beautify your code (rather like the XML PrettyPrinter plugin) but at least it might be one way of having configurable indentation without costly on-the-fly parsing.
What about http://www.geany.org/manual/current/index.html#sending-text-through-custom-c...
Ok, you need an extra <ctrl>+a to select all before the keybinding for the command, but two keys isn't too bad :)
BTW do not use astyle for this, it lies through its teeth about working from a piped stdin, it tries to do a seek on the input and thats not possible on pipes. I havn't done it for ages, but uncrustify used to work.
Cheers Lex
I’d have a go at this myself, but for the fact that I’m a CS graduate student (learning all that new stuff is great but why do they have to give you piles of coursework as well? :P)
James
-- "Unix is the worst computer operating system, except all the others that have been tried." _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 11/11/13 01:41, Lex Trotman wrote:
What about http://www.geany.org/manual/current/index.html#sending-text-through-custom-c...
Ok, you need an extra <ctrl>+a to select all before the keybinding for the command, but two keys isn't too bad :)
Cool, I hadn’t noticed you could do that. I’ll bear that in mind as well.
James