Quantcast
Skip to content


ATTENTION TWEETERS: Before clicking the tweet button, please ensure the proper URL is displayed in your location bar. How? Click the post title, or permalink. (Otherwise, your tweet will point to the site, only, making it difficult for your readers to find.)
-- Thank you!
the Author

Notepad++ Open File at Cursor

Easy Add Open-Selection Function to Notepad++

Select “Run” from the Notepad++ main menu. A dialogue appears, offering to enter what program should be run. The dialogue accepts a handful of Npp built-in Environment variables, including $(CURRENT_WORD), which represents the current selected text. Place the following line, modifying it according to match the location of Notepad++.exe, and save it. From there, all that’s necessary to ‘Open Selection’, or ‘Open File at Cursor’ in Notepad++ is to select Run, and click whichever option appears in the list, according to what name was used on Save, at the time of entering the following line to the Run dialogue:
"C:\Program Files\Notepad++\notepad++.exe" "$(CURRENT_DIRECTORY)\\$(CURRENT_WORD)"

Open File at Cursor: What is it?

Also known as ‘Open Selection’, the action of ‘Open File at Cursor’ is useful when working with files of a common project, such as is often the case for the Web Developer. Whether working with files installed on a production server for example, as part of a WordPress installation, or in the instance of a user-created project residing on a development server, as part of a completely new code base unique to the developer’s own inception, a web developer is familiar with relative paths, as the source or markup requires for proper functioning of the application (e.g. html markup where anchors point to others in a collection of files residing under a common parent-container; files required in server-side scripting applications, such as ‘class/class-file.cfml’, or ‘wp-include/include-file.php’; markup with hyperlink reference anchors pointing to locations off-site from the project, requiring absolute paths like ‘Z:\Serverpath\htdocs\different_project\index.html’ or ‘http://different.site/path/altogether.html’)

Open Selection’ is a most useful function for developers working with source code containing such file path references. In my experience– having worked with many different Linux and win32 text-editors and web development IDE’s since circa 1997– many editors feature, as a context-menu entry in the main text-editor area, some variation on the function, as ‘Open Selection’ / ‘Open File at Cursor’ and sometimes as a variant of ‘Goto Definition’. After first discovering the useful feature, I found it to my surprise to see it much less often appearing as a built-in-function than other common functions afforded by popular IDE’s and Text Editors.

Notepad++ is one such editor which– to my knowledge– does not come packaged with an ‘Open Selection’ function. It is possible, however, to add ‘Open Selection’ functionality to open the selected file path with very little effort in Notepad++, via the built-in Run; ‘shortcuts.xml’ options.

Enjoy!

Posted in MS Windows, Operating System, PHP, Recommended, Software, Web Development.

Tagged with , , , , , , , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

You must be logged in to post a comment.



Close