Adding a user-defined language in Notepad++

I'm trying to add the syntax plugin for the Go programming language in Notepad++.

There is a repository for such user-defined languages. I downloaded and unzipped the Go files, which contained a README, a userDefinedLang_Go.xml, and go.xml.

I attempted to follow the instructions at the bottom of the page as follows. Since I am using Windows 7 (x64), my Notepad++ directory is "C:\Program Files (x86)\Notepad++".

Having not installed a user defined language before, I didn't have a userDefinedLang.xml file already, so I copied userDefinedLang_Go.xml into the root directory, and renamed it to remove the "_Go", making it userDefinedLang.xml.

I then copied go.xml into C:\Program Files (x86)\Notepad++\plugins\APIs\

This seems to be all of the steps necessary. However, when I open Notepad++, there is no "Go" near "Lang => User Defined", and there is no syntactic coloring on a .go file. Attempting to import via "View => User-Defined Dialogue => import" gives a "fail to import" error.

What am I doing wrong? I'm using a clean installation of Notepad++, which is version 6.1.8.


Solution 1:

I had to put my userDefineLang.xml file in my AppData\Roaming folder:

C:\Users\[user]\AppData\Roaming\Notepad++

Solution 2:

New install of Notepad++ 6.4.5 on Windows 7 64 bit

Download from Notepad++ site:

http://docs.notepad-plus-plus.org/index.php?title=User_Defined_Language_Files#G

Copy "go.xml" to C:\Program Files (x86)\Notepad++\plugins\APIs.

The default install doesn't have any user-defined languages, so you can do this:

  • Copy "userDefineLang_Go.xml" to C:\Users\\AppData\Roaming\Notepad++
  • Remove the "_Go" from the file name, so it's "userDefineLang.xml"
  • Uncomment the opening and closing "NotepadPlus" tags.

(If you already have a userDefineLang.xml then add the content from the _Go file.)

Restart Notepad++.

Solution 3:

I just got it working on my system after some tinkering. Put this at the top of the userDefinedLang.xml file and the go.xml file:

<?xml version="1.0" encoding="Windows-1252" ?>

That should do the trick (after reopening Notepad++).

go.xml should be in the plugins/APIs folder, and userDefinedLang.xml goes in the root of Notepad++ as you said.