NetBeans red line

There is a feature of NetBeans where it puts a red line as the right margin in the code editor. By default this margin is at 80 characters but I prefer it at 99 characters. To change the setting in NetBeans see Tools -> Options -> Editor -> Formatting -> All Languages -> Tabs And Indents -> Right Margin. For example:

NetBeans formatting options

NetBeans PHP “Invalid include path”

So I migrated my projects from a Debian 8 (Jessie) system to a Debian 9 (Stretch) system. The default NetBeans installed by apt-get install netbeans on Strech was 8.1, and it didn’t include PHP support, so I manually installed NetBeans 8.2.

When I opened my old projects I got an error about an invalid global PHP include path.

So initially I edited ~/.netbeans/8.2/build.properties to change the php.global.include.path settings (to remove /usr/share/php5, because in Stretch I’m running PHP 7.0). But that didn’t work. Each time I ran NetBeans the build.properties file was overwritten with the old php5 directory.

So then I found ~/.netbeans/8.2/config/Preferences/org/netbeans/modules/php/project/general.properties. In there I edited the phpGlobalIncludPath and removed the /usr/share/php5 directory.

Then when I reopened NetBeans all of my projects opened properly without an error! Everything is easy when you know how!

Navigate to matching brace in NetBeans

So I wanted to know the keyboard shortcut to navigate between matching braces in my PHP (and other) code in NetBeans. I’m running NetBeans 8.2. So I searched and found General Editor Features which said “to find a shortcut for a specific command, type the command name in the Search field.” So the Search field they’re talking about is on the Keymap screen under Tools -> Options. After creating myself a custom Keymap Profile based on the NetBeans default settings I searched in the ‘Search:’ box for ‘match’ and found ‘Insertion Point to Matching Brace’ which is Ctrl+OPEN_BRACKET. Everything is easy when you know how!

Disabling F6 ‘Run Main Project’ hot key in NetBeans because of G15 keyboard

I have a G15 keyboard, and I love it (but not as much as the old model!), but it occasionally causes a problem for me when I’m programming in NetBeans on Debian GNU/Linux.

The issue is that on a newer G15 the G6 key is right near the Ctrl key, and from time to time my pinky hits the G6 key which seems to be by default programmed to be the F6 key.

By default in NetBeans the F6 key is the ‘Run Main Project’ hot key, so when I accidentally press it, it fires up a Firefox window and tries to run my web app! I never configure my web apps in NetBeans, but even if I did, I don’t want to accidentally run anything due to an accidental key press.

So my solution was to disable F6 in NetBeans, and for that:

Tools -> Options -> Keymap -> Click ‘Search in Shortcuts’ -> Press F6 -> Click on the ‘…’ in the Shortcut cell for ‘Run Main Project’ (should be F6) -> Clear -> Apply -> And you’re done!

Everything is easy when you know how!