Today, I will explain some features of the Programmer's Editor (Pe), which is the code editor when Haiku is freshly installed on a new machine.
If - for some reasons - you can't install other code editors on your system, then this article might give you some ideas on how to master Pe.
To be frank, the Programmer's Editor - known as Pe - is not the best code editor on Haiku, however it has two big advantages :
So let's review how to use the useful features of the application.
First, before reviewing some of the features of Pe, one very strange point is the "Undo" shortcut which is setup as "Opt+Y" by default.
Why "Y" ? :)
In general, editors are using the "Z" key for the "Undo" function.
Let's fix that. Open the "Window>Preferences" menu :
Then go into the "Keybindings" section and select "Edit menu>Undo" :
Delete the existing Key binding by clicking the "Delete" button, and indicate instead the "Opt+Z" binding by typing it.
Then click on Add button. Do the same for "Redo" : you can for instance indicate "Shift+Opt+Z" for the key binding.
Once completed, close and open Pe. Another part of the software which can be customized : the colors of the editor.
Go into the Colors section, and change the below colors accordingly if you need :
Please note that Pe is not handling very well the dark mode which can be setup since latest's Haiku release.
I didn't find any workaround to this for the moment, so that's the currently limitation of Pe.
Let's discover now a few features of the code editor.
If we open the - now famous - "SimpleOpenGLCube.cpp" source code file, Pe will display the color syntaxing :
The application proposes the below toolbar :
If you click on the "f(x)" icon, it will display the functions and classes included in the source file :
The "h" icon is used to display the list of the header files (.h) which are used by the program :
If you would like to display the content of an header file, just double click on it to select the name :
Then type "Opt+D" to open the header file :
Nice isn't it ? Another feature available is the text wrapping.
Click on the below icon :
And the text is wrapped as requested :
To unwrap it, just click again on the same icon.
If you need to comment some lines, select them and use the "Text>Comment" menu :
Last feature now.
If you need to go to a specific line in the source file, click on the area available at the bottom left of the window.
Then type the line number and confirm to reach the corresponding line :
Please note, the line numbers are not displayed on the left of the source file - like on many other code editors.
Maybe a missing feature for a code editor.
Let's conclude this article, with a few more advanced features.
There's a "PrefixLines" function, you can use via the "Extensions" menu :
Imagine you select all the header lines below and after select the "PrefixLines" function :
After that, indicate in the "insert" box the ">" character.
Then, it will change the start of each header line as per below :
Another feature : the yellow "tick" icon -available just after the "disk" icon. It allows to execute a piece of text as if it was typed in a Terminal.
Below is some text which allow you to compile and launch the program directly in the Pe editor :
Below is another example of the "ls" command executed by the editor where the result is added by Pe just after like below :
Nice !
Let's conclude with the possibility to launch Pe directly in the Terminal and indicate the source file to open:
lpe <filename> &
Above the "SimpleOpenGLCube.cpp" will be opened by Pe once launched.
If you would like to read more information on the Pe editor, you can consult the Pe Manual page available on your Haiku system : file:///boot/system/apps/Pe/Documentation/index.html
Copy/paste the previous URL in your favorite brower to access to this manual.
Do you use Pe as your code editor ?
If so, any other feature you would like to share ?
In that case, just put a comment below :)