![avatar](https://avatars3.githubusercontent.com/u/640101?s=80&v=4) # dotsyntax *Highlight dotfiles your way.* ![seanmorris-dotsyntax](https://img.shields.io/badge/seanmorris-dotsyntax_0.0.0-900?style=for-the-badge&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAACAAAAAfCAYAAACGVs%2BMAAAHb0lEQVR42pVWa1CU1xk2dSYzHSs4aEsEHZ0VAYEFBBGQAcRba5CxtUJpbeiIN2BdLgLLrizKQkx0ubhDMBCuy3UBuQuIGtAogSQ1pK026bSdtjO10TbRH06bJqPZp%2Bc5zLoyDJX9Zp7Z833f%2Bz7Pe97L%2BXbRPNdLtoVCoXBetWrVYwE4iMf0ncXpyOXm5pYsMLZ69eor%2Fv7%2BTwICAiB%2BFwTaKpXKJ8uXL7%2BydOnSMYHkBUjaI3R1dY3z8PC46%2BXlBW9vb4SGhiIsLMwqgAWA9tbw8HDs3bsX%2B%2FfvR0xMzF1BG7egbLi4uPiuWbPmEXeyZcsWK8U3b968YISEhCAwMJC%2BaGhowOjoqDUnJ4cbeUTu%2BXRtO1eyfhs3boRd2HEEBQXJAKqqqtDe3g6LxQKj0QhRTixZskQ5X%2Br3%2BPn53T9z5gx27txJEoeFufNDhw6hoqICZWVlaGxsRHNzM1paWvjLZ%2BS9v3jx4j2ztJ2cnBKjo6Ons7Ky0NHRgd27d5PMobSz8Tw9PaFWq9Hf389dS9Gmpia0traipqYGmZmZ0nbt2rXTosETn6Vg2bJlEwkJCRgZGbGazWZs376dhAsWZ7r37duHuLg45OfnU5zCNnBTzIqN08rGFgFMPAvA2dl5mN3a3d0NBhAbG4vg4GCSLyjtO3bs4G4pxHTPErdloLS09FlfcbpWrlw5PCsAZqCvr48OsnsTExPh6%2Bv7wmajjSifrHdbW9sccQbFrHAs6cMg7AHYu3%2BYZKxfZ2cnBgYGUFtbi5SUlOeb0XYe2MRlwxUWFsJgMDBzzMIc8cHBQWi1Wvj4%2BNCP%2FnMDcHd3HxaNgc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rTiInMx0XCjLxJ4tRiF6cqfWHXZjqPofe5pNi3YnszAzcaCzDrWYTUlNSMWbSoa4yA7f7S2krxxWfXULuaz9GeEQkCk%2FmSe6HQoNa1KT2InGWf2fwdMr1Hv0R3CzPgfX9dug12bhaZxTp7bA323QvLEY1tGlx4t4Cgy4XqarjSBMoFGs2aJ54Rxva0kcGMdmG4eqz0OdJbqlBLWpSW45iU06Sf606MXK0OFV1y5SHdFWa8Kuw4k7fTKMRH%2Fegy5QBQ%2B4%2BmZX8vFwYTqRJ6LUaOapFmp%2FShrb0kYL4dEDso9KqFpzkpga1qCnF8dw%2F1K748O82Z79WWq5Vf2suOYXf91ZZMX2RPSAEevD55Qpcqy%2FASE0JjFpRgmoDwTWf8R1taCt96EsOcpGT3NSg1nPac29umDSW13NUX5kMOvxjpA5%2Fu1SDvw6%2Bgy%2BumnHbUikylIrL5Vp8NdZAcM1nfEcb2tJH%2BpKDXOScpfWi61p5blWD4QRSj6uhVkuImquRf0KN0TIN%2FnvdDHzYQXDNZ3xHG5u99CUHuRY5enVoDzbdMGnxcLzFyp0Q9wQeiDn%2Bj9i1rckIrvmM72hjs6cvOcjlcAD1xxM3XTdmdf2x5Q3OND9EVn4PCNaYjcjTk%2BCaz2zvaUsf%2BpKDXA5I22t0%2FvBPNoiRmbjXY3r6YOAtcXpVLAi0pQ99yfEcp%2BNBtKoPOIkD47EAHMRj%2Br5I%2FH8NrWvzntWI2gAAAABJRU5ErkJggg%3D%3D) ![builtfor-sublimetext](https://img.shields.io/badge/built_for_sublimetext-3511-e79330?style=for-the-badge&logo=sublime-text) ![Size badge](https://img.shields.io/github/repo-size/seanmorris/dotsyntax-sublime?color=280&style=for-the-badge&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAQAAACFzfR7AAABF0lEQVQoFQXBQWvOAQDA4ef/7o29YWtqKU7ExWE5OIvm4LKcnXwD7aQ0N/kAczO1i1KOO0xJvQojaTm4KbJabnJysLSf5wFAa603CUB322yOAAitVT86BTTQ1+oJDYDQcv+qFRr3vC1ooYPqDkHoYgfVKmnSfhG62t/qBkHn2q8ekjRpryB0v/rZ2eh4r6tpY5pp3Gx7RTONoJfVLnpQfekYtNG0832rRj3tEaT31bOxQ5wc/oATrnnniEMfXfaZDFrAoEk71XajNN9OVVW7HYVeVZ9AF/pd3YPm267qbYs0tF597wygpaquQ7Nt9QLoVlWXCEK3q1oCCF2p6iYBpKGN6kNzATrdr2qVAACa9rgRQKPetAnAf1jX/qSkN8aIAAAAAElFTkSuQmCC) [![Apache-2.0 Licence Badge](https://img.shields.io/npm/l/cv3-inject?logo=apache&color=225588&style=for-the-badge)](https://github.com/seanmorris/cv3-inject/blob/master/LICENSE) 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. ```yaml .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. ```yaml .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. ```yaml .env: .sh .syntax: .yml templates/.env: .mustache ``` Globbing may also be applied according to python's `fnmatch` rules. ```yaml 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](https://github.com/seanmorris/dotsyntax-sublime/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: ```bash $ ln -s ~/dotsyntax-sublime/ ~/.config/sublime-text-3/Packages/dotsyntax-dev ``` You can undo the symlink and remove the development package with: ```bash $ 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.