<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Adding a shortcut to a language....]]></title><description><![CDATA[<p dir="auto">Hey all!</p>
<p dir="auto">Is there an easy way to add a ‘shortcut’ mapping to change to a particular language?  I use Notepad++ to past in SQL or PowerShell code periodically and I’ve love to setup CTRL-ALT-S or CTRL-ALT-P to toggle to those languages directly for a quick visual inspection.  Is this doable already or do I need to upvote a feature enhancement somewhere?</p>
<p dir="auto">Thanks!<br />
Charles</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/18592/adding-a-shortcut-to-a-language</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 12:40:18 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/18592.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 06 Dec 2019 16:53:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Adding a shortcut to a language.... on Fri, 13 Feb 2026 12:09:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Hi, and thank you for your answer. Yes, the problem was partly due to the language, but I managed to address it before you replied. However, the other issue was actually a conflict with a shortcut from another application.</p>
<p dir="auto">Cheers!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/104736</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/104736</guid><dc:creator><![CDATA[Paweł Adam]]></dc:creator><pubDate>Fri, 13 Feb 2026 12:09:48 GMT</pubDate></item><item><title><![CDATA[Reply to Adding a shortcut to a language.... on Thu, 12 Feb 2026 20:15:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> ,<br />
I just use the Context menu to create an entry that I can right click on the page and switch to the language I want using the contextMenu.xml file with the following entries.</p>
<pre><code>        &lt;Item id="0"/&gt;
        &lt;Item MenuEntryName="Language" subMenuId="language-userDefinedLanguage" name="User Defined Language" MenuItemName="dBASEPlus_Dark"/&gt; 
        &lt;Item MenuEntryName="Language" subMenuId="language-userDefinedLanguage" name="User Defined Language" MenuItemName="dBASEPlus_Light"/&gt;
</code></pre>
<p dir="auto">This seems to me to be the quickest easiest way to do this kind of thing and it’s always available with a right mouse click and selection.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/104729</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/104729</guid><dc:creator><![CDATA[Lycan Thrope]]></dc:creator><pubDate>Thu, 12 Feb 2026 20:15:16 GMT</pubDate></item><item><title><![CDATA[Reply to Adding a shortcut to a language.... on Thu, 12 Feb 2026 15:15:39 GMT]]></title><description><![CDATA[<p dir="auto">I had started to reply to a recent post here, but that post was deleted while I was working on my answer.</p>
<p dir="auto">But there was part of my response that I think might be useful to future readers of this topic, as it’s not as commonly understood:</p>
<p dir="auto">When using <code>notepad.runMenuCommand(...)</code> in the PythonScript plugin, it is using the actual text from the menu names.  Thus, it <em>is</em> affected by <a href="https://npp-user-manual.org/docs/preferences/#general" rel="nofollow ugc"><strong>Settings &gt; Preferences &gt; General &gt; Localization</strong></a> – thus, using the XML example above, in the default English localization, it would be <code>notepad.runMenuCommand("Language", "XML")</code>.  But if you were in Pig Latin (for example), it would have to be <code>notepad.runMenuCommand("Anguagelay", "XML")</code>; or if you were in Greek, it would have to be <code>notepad.runMenuCommand("Γλώσσα", "XML")</code></p>
<p dir="auto"><em>(Aside: there’s actually a quirk, though: if you have switched from, for example, Pig Latin to Greek, then until you restart Notepad++, you can use either the Pig Latin or the Greek menu-name-strings in your <code>runMenuCommand</code> calls.  Once you restart Notepad++, you can only use the active Localization for those strings.)</em></p>
<p dir="auto">(I don’t know if Localization was actually the problem in the now-deleted post, but it might have been, and it could easily be a problem for other users as well; This actually <a href="/topic/27354">came up recently</a>, and since it has bearing on this discussion, I thought I would share that main idea here, too: if you are using Localization other than English, you will have to adapt any <code>runMenuCommand</code> calls in your PythonScript scripts to use the actual name of the menu in your GUI, not the English names – whether or not it would have solved the deleted problem, it’s important enough to share.)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/104715</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/104715</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 12 Feb 2026 15:15:39 GMT</pubDate></item><item><title><![CDATA[Reply to Adding a shortcut to a language.... on Sun, 20 Apr 2025 08:32:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thanks!!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/101123</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/101123</guid><dc:creator><![CDATA[Riyas Aboobaker Abdul Rahman]]></dc:creator><pubDate>Sun, 20 Apr 2025 08:32:39 GMT</pubDate></item><item><title><![CDATA[Reply to Adding a shortcut to a language.... on Fri, 24 Mar 2023 05:51:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thanks!! This really quite the perfect write-up.  Top results off Google and 20 min later, I have icons for “Set Language to SQL” and “Set Language to XML.”</p>
<p dir="auto">The PytonScript was a little wonky with allowing me to set the icon.  It seemed committed to .bmp or .ico files rather than .png.  Ok – found those alternatives.  But each time I tried to load them, it just didn’t work.  But hey – that’s more the plug-in…</p>
<p dir="auto">Your solution worked like a charm!  Thank you!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/85167</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/85167</guid><dc:creator><![CDATA[BenHastingsFDSU]]></dc:creator><pubDate>Fri, 24 Mar 2023 05:51:45 GMT</pubDate></item><item><title><![CDATA[Reply to Adding a shortcut to a language.... on Fri, 06 Dec 2019 17:17:05 GMT]]></title><description><![CDATA[<p dir="auto">Interesting question.</p>
<p dir="auto">The languages don’t show up in <strong>Settings &gt; Shortcut Mapper</strong>, so the easiest possibility isn’t there.</p>
<p dir="auto">The language change doesn’t seem to get recorded in a macro.</p>
<p dir="auto">I think the issue is that they don’t have a static menu command ID (ie, aren’t listed in <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/menuCmdID.h" rel="nofollow ugc">menuCmdID.h</a>), so there isn’t a direct way to call them.</p>
<p dir="auto">However, some of the scripting plugins, like PythonScript (<a href="https://community.notepad-plus-plus.org/post/48501">install instructions here</a>), do have a way to search the menus for an existing command, even if they don’t have a static command ID.</p>
<p dir="auto">PythonScript’s <code>notepad.runMenuCommand("Language", "YAML")</code> will change the language to YAML; any languages at the same level will have the same syntax.  If you have <strong>Preferences &gt; Languages &gt; ☑ Make language menu compact</strong> enabled, then the languages under a letter submenu will require a trick: for example <strong>Languages &gt; N &gt; Normal Text</strong> would be accessed via <code>notepad.runMenuCommand("N", "Normal Text")</code>.</p>
<p dir="auto">So, if you install PythonScript, then <strong>Plugins &gt; Python Script &gt; New Script</strong>, and create these two scripts:<br />
<strong><code>SetLanguageSQL.py</code></strong></p>
<pre><code>from Npp import *
notepad.runMenuCommand("S", "SQL")
</code></pre>
<p dir="auto"><strong><code>SetLanguagePowerShell.py</code></strong></p>
<pre><code>from Npp import *
notepad.runMenuCommand("P", "PowerShell")
</code></pre>
<p dir="auto">Then <strong>Plugins &gt; Python Script &gt; Configuration</strong>,</p>
<ul>
<li>click on <code>SetLanguageSQL.py</code> and <strong>ADD</strong> to the Menu Items list</li>
<li>click on <code>SetLanguagePowerShell.py</code> and <strong>ADD</strong> to the Menu Items list</li>
</ul>
<p dir="auto">Once there, restart Notepad++.</p>
<p dir="auto">Now <strong>Settings &gt; Shortcut Mapper &gt; Plugin Commands</strong> will list those two scripts, and you can associate them with keyboard shortcut of your choice.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/48986</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/48986</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 06 Dec 2019 17:17:05 GMT</pubDate></item></channel></rss>