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

dotsyntax

Highlight dotfiles your way.

Details

Installs

  • Total 90
  • Win 29
  • Mac 34
  • Linux 27
Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10
Windows 0 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 0 0 0 1 0 0 0 0 3 0 0 0 0 0 1 0 0 0 0
Mac 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 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.