swd
swd

Reputation: 248

Change comment character in notepad++

I am editing the .properties file in notepad++. I can toggle the block comment using Cntrl+K but it puts ";" instead of "#".

I modify langs.model.xml file and replaced ";" with "#". I restarted notepad but it is not working.

Does anyone know how can I change the control character in notepad++ for properties file?

Upvotes: 8

Views: 12814

Answers (4)

gggirlgeek
gggirlgeek

Reputation: 1

I was looking to do the same thing as @Sennel Sennekuyl. His answer worked so I will provide the step-by-step he didn't.

To change the Comment Character "REM" to "::" in all batch files (but still recognize REM if used):

  • Backup these files: "\Notepad++\langs.xml" and "\Notepad++\langs.model.xml".
  • Edit both of those files (in Notepad++ is fine.)
  • Ctrl+F "batch", or scroll to line item around 70: "<Language name="batch" ext="bat cmd nt" commentLine="REM">"
  • Change "REM" to "::" (with quotes."
  • Save and close the files.
  • Close restart Notepad++

Note: Some old batch scripts will only automatically convert the REM as :: if it was made my Toggling a comment or block comment with Notepad++. You will have to manually replace REM with :: in those scripts.

Note: REM will still work too, if you type it manually.

Upvotes: 0

Rafiki
Rafiki

Reputation: 644

My issue was with VB, NotePad++ don't have the right symbol set (REM instead of ') I don't want to change the language, since the hilighting of keyword would be wrong I found this on mysysadmintips :

Luckily it's pretty easy to modify comment marks for various languages in Notepad++

Open Notepad++ language config file:
C:\Users\<user name>\AppData\Roaming\Notepad++\langs.xml
Scroll down to  <Language name="vb" ext="vb vbs" (or other depending on what language you want to modify)
Change commentLine="REM" to commentLine="'" 
Restart Notepad++

Upvotes: 18

anon
anon

Reputation:

You can get the behavior by using a different language. Perl, PowerShell, Python, Ruby, and Shell will use the # for comments.

Then simply select the block you want to comment on/off and press:

Ctrl+Q (which will toggle comments)

Upvotes: 2

Sennekuyl
Sennekuyl

Reputation: 31

I'm not sure what the difference is however I changed both the langs.xml & the langs.model.xml & ^+Q toggles the block.

(Specifically I wanted to replace batch files "REM" with "::")

Upvotes: 1

Related Questions