Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible in Notepad++ to associate a file extension with a dot in it?

I'm really trying to associate the various .erb filetypes. I would like to be able to associate .css.erb and .scss.erb with CSS, .html.erb with HTML, and .js.erb with JavaScript. Associating all .erb files with HTML does fine for HTML files themselves, but it doesn't work very well for JavaScript, CSS, or SCSS.

I've tried putting css.erb, etc. in the "User ext.:" box within the Style Configurator dialog, but it doesn't seem to pick up on the files properly.

I'm skeptical that this is possible, because I imagine the engine matches from the last . to the end of the filename rather than, e.g., something like filename.endswith(ext), but I thought it worthwhile to ask if anyone has found a way to make it work.

Any thoughts?

like image 547
Ken Bellows Avatar asked Nov 02 '22 10:11

Ken Bellows


1 Answers

CSS and ERB File Extension Screencap Use the following process:

  • Open a new file
  • Input the desired content
  • Use File=>Save to save it as the desired MIME type, for instance foo.css for CSS
  • Use File=>Save As to save it again as the desired ERB file extension, for instance foo.css.erb

After using the Style Configurator, I have the following in the stylers.xml file in the folder where the Notepadd++ executable is installed:

<LexerType ext="css.erb" desc="CSS" name="css">

<WordsStyle name="DEFAULT" fontSize="" fontStyle="0" fontName="" bgColor="FFFFFF" fgColor="000000" styleID="0"/>

<WordsStyle name="TAG" fontSize="" fontStyle="0" fontName="Batang" bgColor="FFFFFF" fgColor="0000FF" styleID="1"/>

<WordsStyle name="CLASS" fontSize="" fontStyle="0" fontName="" bgColor="FFFFFF" fgColor="FF0000" styleID="2"/>

<WordsStyle name="PSEUDOCLASS" fontSize="" fontStyle="1" fontName="" bgColor="FFFFFF" fgColor="FF8000" styleID="3"/>

<WordsStyle name="UNKNOWN_PSEUDOCLASS" fontSize="" fontStyle="0" fontName="" bgColor="FFFFFF" fgColor="FF8080" styleID="4"/>

<WordsStyle name="OPERATOR" fontSize="" fontStyle="1" fontName="" bgColor="FFFFFF" fgColor="000000" styleID="5"/>

<WordsStyle name="IDENTIFIER" fontSize="" fontStyle="1" fontName="" bgColor="FFFFFF" fgColor="8080C0" styleID="6" keywordClass="instre1"/>

<WordsStyle name="UNKNOWN_IDENTIFIER" fontSize="" fontStyle="0" fontName="" bgColor="FFFFFF" fgColor="000000" styleID="7"/>

<WordsStyle name="VALUE" fontSize="" fontStyle="1" fontName="" bgColor="FFFFFF" fgColor="000000" styleID="8"/>

<WordsStyle name="COMMENT" fontSize="" fontStyle="0" fontName="" bgColor="FFFFFF" fgColor="008000" styleID="9"/>

<WordsStyle name="ID" fontSize="" fontStyle="1" fontName="" bgColor="FFFFFF" fgColor="0080FF" styleID="10"/>

<WordsStyle name="IMPORTANT" fontSize="" fontStyle="1" fontName="" bgColor="FFFFFF" fgColor="FF0000" styleID="11"/>

<WordsStyle name="DIRECTIVE" fontSize="" fontStyle="0" fontName="" bgColor="FFFFFF" fgColor="0080FF" styleID="12"/>

</LexerType>

You can add more for each variation of erb by copying the model from stylers.model.xml and following the pattern.

References

  • Keyboard and Mouse Shortcuts: Lists of default mouse and keyboard shortcuts for Notepad++ and some plugins

  • Plugin Development: How to develop a plugin or a lexer

  • Macros: Sequences of actions, aka macros

like image 179
Paul Sweatte Avatar answered Nov 12 '22 17:11

Paul Sweatte