ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

dotsyntax

Highlight dotfiles your way.

Details

Installs

  • Total 357
  • Win 113
  • Mac 143
  • Linux 101
Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

avatar

dotsyntax

Highlight dotfiles your way.

seanmorris-dotsyntax builtfor-sublimetext Size badge Apache-2.0 Licence Badge

I'm tired of having to deal with a lack of syntax highlighting when creating a custom dotfile. Even worse, I cannot stand having to configure each and every editor on each and every machine before I can get back to just writing code.

This plugin changes all that. Simply place a .syntax file in the root of any project and sublime will automatically use it to highlight the files in that project the rules you define.

I'm amazed nothing like this exists already.

For example, the .syntax file below will cause.syntax to be highlighted as if it were a .yml file, and the .env file to be renderd like bash.

.env:    .sh
.syntax: .yml

.syntax files may also appear in subdirectories, and will override those found in parent directories.

.syntax file:

A .syntax file describs the syntax of the files in its directory. It makes up for sitations where file names/extensions won't work.

A .syntax file is simple a key:value map. The keys are filename, extensions or patterns that specify files the plugin will act on.

The values are the extensions file types that you want to use. These extensions must include the leading dot.

Usage

Create a .syntax file in the root of your project and add keys and values in the form filename:type to get started. Leading/Trailing whitespace will be trimmed for the value. Upon saving, sublime will immediately begin to use whatever syntax highlighter it would normally use for the aliased file extension.

.env:    .sh
.syntax: .yml

You can also specify a relative path. If the relative path of the highlighted file from the perspective of the .syntax file matches, the match will take precedence over non-path matches.

.env:           .sh
.syntax:        .yml
templates/.env: .mustache

Globbing may also be applied according to python's fnmatch rules.

conf/*.cfg: ini
conf/*.xfg: yml

dotsyntax will refresh each file on load/save, and refresh all files in the current window if a .syntax file is saved.

Please note, this does not cause these files to become yml or bash files, it only configures the syntax highglighter to ease eye strain, however it will enable filetype specific behavior, such as the comment/ hotkey. Try it out!

Installation

As far as I know, I havent been accepted to package control yet. That leaves us with the manual install path as our only option. Open sublime and go to tools > browse packages and you'll get a file explorer from your current OS and time period. Note the directory.

Once you've done that, head over to the releases page and grab the lastest one. Extract that file into the directory from before, under a folder named dotsyntax (make sure your archive manager doesn't end up creating a subfolder with the same name).

When you've done the above correctly, you should now see this on your sublime console whenever you save/load a file:

dotsyntax refreshing /home/sean/dotsyntax/README.md

You can open the console with ctrl ~ on linux or cmd ~ on osx.

Developing / Contributing

If you've installed dotsyntax-sumblime, you should uninstall it before following this section.

To develop dotsyntax-sumblime, simply fork the project and symlink the directory to sublime's user packages directory. Assuming you have the project in ~/dotsyntax-sublime, on debian linux the command would be:

$ ln -s ~/dotsyntax-sublime/ ~/.config/sublime-text-3/Packages/dotsyntax-dev

You can undo the symlink and remove the development package with:

$ rm ~/.config/sublime-text-3/Packages/dotsyntax-dev

You can ensure the above commands are successful by opening your sublime terminal (ctrl ~ or cmd ~) and looking for the following lines:

reloading plugin dotsyntax-dev.dotsyntax
unloading plugin dotsyntax-dev.dotsyntax

Once you've done that, run the following command to open a sublime window to the package:

$ subl ~/dotsyntax-sublime/

Once you've got your changes all ready, open a pull request to contribute your work.

License

Copyright 2019 Sean Morris

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.