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

dotsyntax

Highlight dotfiles your way.

Details

Installs

  • Total 387
  • Win 124
  • Mac 154
  • Linux 109
Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 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
Windows 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 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 0 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 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

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.