I would like to define a shortcut key which opens a particular text file at a particular line. My preferred editor is Notepad++, but suggestions involving other editors are welcome.

link|improve this question

feedback

2 Answers

up vote 5 down vote accepted

You'll need to use the command line option listed in the other answer, but you'll also need to set up the shortcut key in the Windows shortcut. To do this:

  1. Make a shortcut to the program itself. You can do this by right clicking somewhere (desktop is easiest, but it doesn't really matter where. You can also just find Notepad++ in the Start -> (All) Programs menu, and copy it from there and paste.
  2. Right click the new shortcut link you've made (not the one in the Start Menu) and go to the "Shortcut" tab. In the Target box you'll have something already there like "C:\Program Files (x86)\Notepad++\notepad++.exe" You need to add your file you wish to open after the quote marks, and then -n## (replacing #'s with the line number). The target box should read something like "C:\Program Files (x86)\Notepad++\notepad++.exe" c:\users\username\desktop\test.txt -n73
  3. On the same tab, there is a box for editing the shortcut. Click in there and type a letter. It will automatically add Ctrl+Alt to the front of it, and that is your shortcut. I'm unsure if you can use any other combination keys for the shortcut.
link|improve this answer
+1 for adding the other half of the answer that I didn't, and for providing so much detail. Thanks! – Randolf Richardson May 30 '11 at 6:24
feedback

You need to use the following command-line option (where "#" represents the line number):

-n#

The complete list of command-line options for Notepad++ is available here:

  Controlling Notepad++ at startup by passing it Command Line Options
  http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Command_Line_Switches

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.