how can I make shortcut the menu, Language -> J -> Javascript
I often open .aspx file.
I used to do language -> j -> javascript. every time when I open aspx file
it's really annoying
I like to mak开发者_高级运维e short cut or macro.
But I cannot find this menu on Shortcut mapper.
How Can I do this?
You can associate the aspx extension with Javascript like this:
- go to Settings/Style Configurator...
- select Javascript language
- enter aspx in User ext. textbox
- click Save & Close
I hope this solves your problem
For the case where the extension does not match the language you wish to select or there is no extension, you could use a macro program such as AutoHokey to automate the menu selection.
For example, using windows+v as the shortcut:
This code sends alt+L, then presses J, then presses the down arrow, then finally hits enter. You may need to use the "SetKeyDelay" command depending on the speed of your system and the responsiveness of your Notepad++.
#v::
Send, {AltDown}L{AltUp}J{Down}{Enter}
return
Or, another example, for VBA
#v::
Send, {AltDown}L{AltUp}V{Enter}
return
Keyboard shortcut for language settings is Alt+L. Then choose your language. I find this simpler than navigating the same via Mouse.
I found this thread first while seeking the answer I eventually found and I wish to share it here. All credit to this post on the Notepad++ forums. I'm just reiterating it here.
You can create a macro to switch to a specific language and then set a keyboard shortcut via the built-in menu: Macro > Modify Shortcut/Delete Macro
. Unfortunately you cannot record this macro, but you can manually edit the file macros are saved to.
The standard location for this file is %AppData%\Notepad++\shortcuts.xml
. In this XML file there is a section called <Macros>
that should look something like this (this one macro came predefined to my install):
<Macros>
<Macro name="Trim Trailing Space and Save" Ctrl="yes" Alt="no" Shift="no" Key="83">
<Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
<Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
</Macro>
</Macros>
To add an entry to switch to JavaScript, add these lines:
<Macro name="Switch Language to JS" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="2" message="0" wParam="46007" lParam="0" sParam="" />
</Macro>
The key part here is the wParam="46007"
this is the menu item ID that refers to the JavaScript language menu item. To add other languages check the source file here for a list of menu IDs. Note how lines are defined like so:
#define IDM_LANG_HTML (IDM_LANG + 5)
#define IDM_LANG_XML (IDM_LANG + 6)
#define IDM_LANG_JS (IDM_LANG + 7)
IDM_LANG
is equal to 46000, so IDM_LANG_JS
(JavaScript) is equal to 46000+7, hence wParam="46007"
.
After adding these lines, you should have an overall section like so:
<Macros>
<Macro name="Trim Trailing Space and Save" Ctrl="yes" Alt="no" Shift="no" Key="83">
<Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
<Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
</Macro>
<Macro name="Switch Language to JS" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="2" message="0" wParam="46007" lParam="0" sParam="" />
</Macro>
</Macros>
Notepad++ doesn't read this file on the fly, so you'll need to relaunch after making changes. And an important thing to note, if you try to edit this file with Notepad++ it will overwrite your changes when you close the application (it saves the running application settings on exit). The easiest solution is to use a different text editor to edit the file. Or you can open, edit, save the file, set to read-only, close and reopen Notepad++, clear read-only.
精彩评论