Registered Member
|
Dear all,
Is there any editor in KDE that supports PHP indentation or at least something that its indentation can be easily configured? I search through the web and found that Kate indentation can be configured, but it requires kateautoindent.h and kateautoindent.cpp modification, which I can't find those files in my KDE version (4.3.1). Any suggestion? regards, ethereal1m |
Registered Member
|
Doesn't Configure Kate>Editing>Indentation meet your needs? Also, I'm not sure what standard PHP supports but there are several styles already built in - though not PHP.
John Hudson, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
unfortunately it doesn't do anything when I select all and do Kate>Editing>Indentation. I want to do transform the following:
into:
How can I make it with Kate? thanks |
Registered Member
|
I don't think it will indent existing files; it simply puts in the correct indentation in a new file.
John Hudson, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
The indentation mode only changes what happens when you hit enter to start a new line (intended for the purpose of reducing the necessity to hit tab several times after starting a new line). I don't know of any non-IDE editor that will format existing code for you (i.e. add indentation to existing code according to predetermined rules), though there are some that do support switching between tabs and spaces if the indentation is already there. You may be able to write a script that will handle adding indentation to your code, which you could add as an external tool to the editor.
airdrik, proud to be a member of KDE forums since 2008-Dec.
|
Administrator
|
Vim can do it, but maybe you meant KDE editors (which I haven't used much).
This will open /path/to/file.php in Vim, autoindent the entire file, save the file and quit. As airdrik mentions there should be external tools (scripts etc.) to autoident file, although I don't know the name of any.
Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.
10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts |
Registered Member
|
Vim is practically an IDE of its own (besides that I've never really used vim, so I am not familiar with any of its features). By non-IDE code editor, I'm referring to most other code editors that I've used e.g. Kate, Gedit, Notepad++, Programmer's Notepad, Editra, Komodo edit, etc. I've used about a dozen different ones over the last couple of years and I don't remember any that would format existing code (except maybe XML and HTML). That's a feature that generally falls just outside of the scope of what they are designed to do.
airdrik, proud to be a member of KDE forums since 2008-Dec.
|
Registered Member
|
notepad++ does that automated indentation.....go to TextFx -> Reindent C++ code
|
Registered Member
|
Well I stand partially corrected - that's an exceptional case as the re-indenting is handled via a plugin (that's installed by default), though it only handles c++ code.
I agree that it would be nice to have a plugin/external tool for kate/kdevelop for reformatting code (adjusting white-space) according to configurable rules (with a selection of presets for various languages' coding conventions).
airdrik, proud to be a member of KDE forums since 2008-Dec.
|
Registered Member
|
Try Nuesphere - used it for years
|
Administrator
|
You can indeed intend functions afterwards in Kate.
First set your prefered intendation method via "extras -> intendation", then mark the parts you want to have intended and then "extras -> adjust" (or align, having a localized version here) C-Style worked best for me, but you can test the others. |
Registered Member
|
it is not working as expected - i hardly changers anything. I think @ethereal1m was expecting complete reformating like in Aptana /eclipse for PHP or what you have in qtcreator as auto-indent selection. I'm looking for the same for kdevelop but format source is disabled |
Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]