Automatically use specific language in Notepad++ for files with no extension

3

3

Specifically, I want NPP to remember to use Ruby syntax highlighting whenever I open a Vagrantfile. These don't have an extension, and I tried adding "Vagrantfile" to the user extensions in the style configurator, but it did not work.

Anyone get this working?

ChimericDream

Posted 2013-11-02T16:34:53.093

Reputation: 53

Answers

2

You should add the extension of your vagrantfile, e.g. pkg, not the word "vagrantfile" itself!

In Notepad++, go to Settings -> Style Configurator. From the language list on the far left, choose Ruby. Below that there is a field titled User ext. Write in it all the file extensions, seperated by spaces, that you want to be treated as Ruby.

3omarz

Posted 2013-11-02T16:34:53.093

Reputation: 31

3Vagrantfile has no extension. That's the problem. – mouseas – 2015-01-21T18:26:36.360

2

There is a plugin which can detect the language based on vi modelines and shebangs etc.:

http://sourceforge.net/projects/npppythonplugsq/files/Modeline%20Parser/

This Notepad++ plugin will read Vim modeline to have per file settings. It also supports shebang (#!) to select language.

You need to install the Python Script plugin from the plugin manager, and manually install ModelineParser_0.2.zip. If needed it may be possible to add your own custom recognition strings.

Source

Ƭᴇcʜιᴇ007

Posted 2013-11-02T16:34:53.093

Reputation: 103 763