Netbeans Edit Externally
Allows opening the currently edited file in an external editor.
Allows opening the currently edited file in an external editor.
Its main purpose is to open the currently edited file at the exact same cursor position as in Netbeans to execute some complex editing action that is not easily possible within Netbeans itself.
The command to open the file in an external editor must be supplied by the user and allows placeholders to specify the location of the cursor to be able to jump to the same location of the cursor in Netbeans' editor.
A fallback command can be specified for opening file for which no editor window is open. This command doesn’t support all the placeholders, but allows editing a file directly from the Projects nodes.
The configuration panel can be found at
Tools / Options / Miscellaneous / Edit Externally.
There are two commands to be configured:
-
Edit externally
-
Open externally
This plugin decides which one to call based on the information it has about
the currently selected file. If an open editor for the file is found, the
Edit externally action is called as it allows including cursor location
information in the command.
If no associated editor is found, the Open externally action is called
instead.
The following placeholders can be used for both commands:
| ${file} |
The absolute path to the file. |
| ${fileName} |
The file name of the file. |
| ${fileBasename} |
The file name of the file without extension. |
| ${fileExt} |
The file extension of the file. |
The following placeholders can additionally be used for the
Edit externally action:
| ${line0} |
The line of the cursor location (0-based). |
| ${line} |
The line of the cursor location (1-based). |
| ${column0} |
The column of the cursor location (0-based). |
| ${column} |
The column of the cursor location (1-based). |
To allow command line arguments with spaces they can be enclosed within single or double quotes. It is also possible to escape a single space or quote character by preceding it with a backslash.
Backslashes take precedence over quote. Therefore it is possible to have quotes as part of a quoted string like in this example:
myprogram 'my \'quoted\' string'
It is also possible to escape placeholders with a backslash to include them literally and prevent them from being expanded:
myprogram literal \${file}
To call vim in an urxvt terminal the following configuration can be
used:
- Edit externally
-
urxvt -e vim ${file} "+call cursor(${line}, ${column})" - Open externally
-
urxvt -e vim ${file}
Since file paths under MS Windows usually use the backslash as file separator, those must be escaped by additional backslashes:
"C:\\Program Files\\Notepad++\\notepad++.exe" -multiInst -n${line} -c${column} "${file}"
An easier, and more readable, approach is using a forward slash as path separator:
"C:/Program Files/Notepad++/notepad++.exe" -multiInst -n${line} -c${column} "${file}"
-
Multiple selected files are not supported at the moment.
If multiple files are selected in the Node tree, only one of them will get opened in the configured editor.
This plugin is inspired by the following existing plugins.
- QuickOpener
-
http://plugins.netbeans.org/plugin/62668/quickopener
This plugin shares some of the same ideas and does provides some additional actions. Unfortunately it is quite buggy and not very handy.
- Use System Desktop
-
http://plugins.netbeans.org/plugin/57462/netbeans-use-system-desktop
This plugin provides actions to open the currently selected file via the operating systems default application. It lacks the ability to jump to a specific cursor location, but may be used together with
Edit Externally.
This plugins is licensed under the terms of the Apache license 2.0.