Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Intellij to highlight file with no extension as Bash?

I'm editing Linux init.d scripts with Intellij IDEA 12 Ultimate and would like it to use Bash syntax highlighting. I already have the Bash syntax highlighting plugin, and it works great for files ending in .sh. The problem with the init.d scripts is they have no extension, and it seems the only way to get Intellij to recognize a files type (Preferences -> File Types -> Registered Patterns) is by extension. If Registered Pattern supported paths (like */etc/rc.d/init.d/*) that would be swell, but that doesn't seem to work.

The only workaround I've found for now is to add the name of each script I want to edit to Registered Patterns. Better than nothing, but does is there a better way? Thanks!

like image 852
Steve Kehlet Avatar asked Feb 06 '14 23:02

Steve Kehlet


People also ask

How do I change file associations in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Editor | File Types. Click Associate File Types with IntelliJ IDEA and select the file extensions you want to open with the IDE. Click OK and close the dialog.

How do I change a read only file in IntelliJ?

To toggle read-only attribute of a file, open file in the editor, or select it in the Project tool window. Do one of the following: On the main menu, choose File | File Properties | Make File Read-Only , or Make File Writable .


2 Answers

You can use the *. pattern. Though it's registered for Text files type by default.

like image 131
Eugene Evdokimov Avatar answered Oct 19 '22 18:10

Eugene Evdokimov


If you happen to have previously registered a file with IntelliJ (ex. when you initially create the file) that the file should be interpreted as Text this would add your file to the default mapping for Text in preferences. If you intend to create a file as Bourne Again Shell (aka bash) then at this point just tell IntelliJ that is what you intend. Otherwise you will need to manually go and remove these custom mappings from preferences before these files will show up for Bourne Again Shell. Preferences - Editor - File Types - Text

like image 41
Trevor Mack Avatar answered Oct 19 '22 17:10

Trevor Mack