├── LICENSE.txt ├── README.md ├── ftdetect ├── advantage2.vim └── freestyle.vim ├── screenshot.png └── syntax ├── advantage2.vim └── freestyle.vim /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2019 Arjen Laarhoven 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vim-kinesis 2 | 3 | Vim syntax highlighting of layout files for the 4 | [Kinesis](https://kinesis-ergo.com) 5 | [Advantage2](https://kinesis-ergo.com/keyboards/advantage2-keyboard/), 6 | [Freestyle Pro](https://kinesis-ergo.com/keyboards/freestyle-pro-keyboard/) and 7 | [Freestyle Edge](https://gaming.kinesis-ergo.com/edge/) keyboards. 8 | 9 | ## Installation 10 | 11 | ### Using a package manager 12 | 13 | Clone the repository in the bundle directory of your favorite Vim 14 | package installer like [pathogen](https://github.com/tpope/vim-pathogen) 15 | or [Vundle](https://github.com/VundleVim/Vundle.Vim). 16 | 17 | ### Manually 18 | 19 | Put the `syntax/advantage2.vim` and `syntax/freestyle.vim` files in your user 20 | runtime directory where syntax files are searched for by Vim (normally 21 | `$HOME/.vim/syntax`). 22 | 23 | ### Filetype detection 24 | 25 | To have Vim automatically detect the type of file, add the lines 26 | 27 | ```vim 28 | autocmd BufNewFile,BufRead ?_{qwerty,dvorak}.txt,{qwerty,dvorak}.txt set filetype=advantage2 29 | autocmd BufNewFile,BufRead layout[123456789].txt set filetype=freestyle 30 | ``` 31 | 32 | in your `.vimrc` or in the file `filetype.vim` in your user runtime directory 33 | (normally `$HOME/.vim`). 34 | 35 | ## Screenshot 36 | 37 | ![Highlighting screenshot](screenshot.png) 38 | 39 | ## License 40 | 41 | See [LICENSE.txt](LICENSE.txt). 42 | -------------------------------------------------------------------------------- /ftdetect/advantage2.vim: -------------------------------------------------------------------------------- 1 | autocmd BufNewFile,BufRead ?_{qwerty,dvorak}.txt,{qwerty,dvorak}.txt set filetype=advantage2 2 | -------------------------------------------------------------------------------- /ftdetect/freestyle.vim: -------------------------------------------------------------------------------- 1 | " Kinesis Freestyle Edge/Pro layout files 2 | au BufNewFile,BufRead layout[123456789].txt set filetype=freestyle 3 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArjenL/vim-kinesis/2d98ae02dbc6aa2ff945315fc4ad1c394d908746/screenshot.png -------------------------------------------------------------------------------- /syntax/advantage2.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Kinesis Advantage2 keyboard layout file 3 | " Maintainer: Arjen Laarhoven 4 | " 5 | if exists("b:current_syntax") 6 | finish 7 | endif 8 | 9 | syn case ignore 10 | 11 | syn match advComment "*.*" contains=@Spell 12 | syn match advLocationMap ">" 13 | syn match advMacroMap ">" 14 | 15 | syn match advLocationChar "\[\@<=\%(kp-\)\?[a-z0-9\\',./;`=]\]\@=" contained 16 | syn match advLocationCode "\[\@<=\(0\{1,2}[1-9]\|0\?[1-9][0-9]\?\|1[0-589][0-9]\|16[0-4]\|17[6-9]\|2[013-9][0-9]\|22[014-9]\)\]\@=" contained 17 | syn match advMacroChar "{\@<=\%(kp-\)\?[a-z0-9\\',./;`=]}\@=" contained 18 | 19 | syn match advLocationToken "\%(kp-\)\?\(f\(1[0-9]\?\|2[0-4]\?\|[3-9]\)\)[\]}]\@=" contained 20 | syn match advLocationToken "\" contained 21 | syn match advLocationToken "\<\%(kp-\)\?\(obrack\|cbrack\|hyphen\)\>" contained 22 | syn match advLocationToken "\<\%(kp-\)\?\(bspace\|insert\|home\|escape\|caps\)\>" contained 23 | syn match advLocationToken "\<\%(kp-\)\?\(next\|prev\|play\|mute\)\>" contained 24 | syn match advLocationToken "\<\%(kp-\)\?\(enter\|tab\|space\|delete\|bspace\|insert\|home\|pup\|pdown\|left\|right\|up\|down\|end\)\>" contained 25 | syn match advLocationToken "\<\%(kp-\)\?\(escape\|prtscr\|scroll\|caps\|pause\|calc\|shutdn\|menu\|numlk\|null\)\>" contained 26 | syn match advLocationToken "\<\%(kp-\)\?\(vol+\|vol-\|intl-\\\)\%([}\]]\)\@=" contained 27 | syn match advLocationToken "\<\%(kp-\)\?\(lp-tab\|mp-kpshf\|rp-kpent\)\>" contained 28 | syn match advLocationToken "\" contained 31 | syn match advModifier "\<\%(kpshift\)\>" contained 32 | syn match advModifier "\<\%(speed[1-9]\)\>" contained 33 | syn match advModifier "\<\%(d\%(125\|500\)\)\>" contained 34 | syn match advModifier "\<\%(t&h[1-9][0-9]\{0,2}\|hyper\|meh\)\>" contained 35 | 36 | syn region advRemap matchgroup=advBrack nextgroup=advLocationMap start="\[" end="\]" contains=advLocationChar,advLocationCode,advLocationToken,advModifier oneline 37 | syn region advMacro matchgroup=advBrace nextgroup=advMacroMap start="{" end="}" contains=advMacroChar,advLocationToken,advModifier,advDelay,advSpeed oneline 38 | syn region advMacroModifier matchgroup=advBrace nextgroup=advMacroMap start="{\%([+-]\)" end="}" contains=advModifier 39 | 40 | hi def link advComment Comment 41 | hi def link advLocationMap Operator 42 | hi def link advMacroMap Operator 43 | hi def link advLocationToken Constant 44 | hi def link advLocationChar Constant 45 | hi def link advLocationCode Constant 46 | hi def link advMacroChar String 47 | hi def link advModifier Structure 48 | hi def link advBrack Keyword 49 | hi def link advBrace Keyword 50 | 51 | let b:current_syntax = "advantage2" 52 | -------------------------------------------------------------------------------- /syntax/freestyle.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Kinesis Freestyle Edge/Pro keyboard layout file 3 | " Maintainer: Arjen Laarhoven 4 | " 5 | if exists("b:current_syntax") 6 | finish 7 | endif 8 | 9 | syn case ignore 10 | 11 | syn match fstComment "*.*" contains=@Spell 12 | syn match fstLocationMap ">" 13 | syn match fstMacroMap ">" 14 | 15 | syn match fstLocationChar "\[\@<=[a-z0-9\\/=-]\]\@=" contained 16 | syn match fstLocationCode "\[\@<=\(0\{1,2}[1-9]\|0\?[1-9][0-9]\?\|1[0-589][0-9]\|16[0-4]\|17[6-9]\|2[013-9][0-9]\|22[014-9]\)\]\@=" contained 17 | syn match fstMacroChar "{\@<=[a-z0-9\\/=-]}\@=" contained 18 | 19 | syn match fstLocationToken "\<\%(f\%(1[0-9]\?\|2[0-4]\?\|[3-9]\)\)[\]}]\@=" contained 20 | syn match fstLocationToken "\<\%(hk\%(10\?\|[2-9]\)\)\>" contained 21 | syn match fstLocationToken "\<\%(obrk\|cbrk\|per\|com\|apos\|tilde\)\>" contained 22 | syn match fstLocationToken "\<\%(mute\|play\|next\|prev\|lmous\|rmous\|mmous\|mous4\|mous5\)\>" contained 23 | syn match fstLocationToken "\<\%(ent\|tab\|spc\|del\|bspc\|home\|end\|pup\|pdn\|lft\|rght\|up\|dwn\|esc\|prnt\|pause\|scrlk\|ins\)\>" contained 24 | syn match fstLocationToken "\<\%(numlk\|kp1\|kp2\|kp3\|kp4\|kp5\|kp6\|kp7\|kp8\|kp9\|kp0\|kpent\)\>" contained 25 | syn match fstLocationToken "\<\%(caps\|fntog\|fnshf\|menu\|calc\|shtdn\|led\|null\)\>" contained 26 | syn match fstLocationToken "\<\%(vol+\|vol-\|intl/\|kp\*\|kp\.\|kp-\|kp+\|kp=\|kp/\)[\]}]\@=" contained 27 | 28 | syn match fstModifier "\<\%([lr]\%(shft\|win\|alt\|ctrl\)\)\>" contained 29 | syn match fstModifier "\<\%(t&h\|d\)\%(ran\|\%([1-9][0-9]\{0,2}\)\)\>" contained 30 | syn match fstModifier "\<\%(hyper\|meh\)\>" contained 31 | syn match fstMacroPlaybackSpeedPrefix "{\@<=s[1-9]}" contained 32 | syn match fstMacroMultiplayPrefix "{\@<=x[1-9]}" contained 33 | 34 | syn region fstRemap matchgroup=fstBrack nextgroup=fstLocationMap start="\[" end="\]" contains=fstLocationChar,fstLocationCode,fstLocationToken,fstModifier oneline 35 | syn region fstMacro matchgroup=fstBrace nextgroup=fstMacroMap start="{" end="}" contains=fstMacroChar,fstLocationToken,fstModifier,fstDelay,fstSpeed,fstMacroPlaybackSpeedPrefix,fstMacroMultiplayPrefix oneline 36 | syn region fstMacroModifier matchgroup=fstBrace nextgroup=fstMacroMap start="{\%([+-]\)" end="}" contains=fstModifier 37 | syn match fstFn "fn" contains=fstRemap,fstMacro,fstMacroModifier 38 | 39 | hi def link fstComment Comment 40 | hi def link fstLocationMap Operator 41 | hi def link fstMacroMap Operator 42 | hi def link fstLocationToken Constant 43 | hi def link fstLocationCode Constant 44 | hi def link fstLocationChar Constant 45 | hi def link fstMacroChar String 46 | hi def link fstMacroPlaybackSpeedPrefix Structure 47 | hi def link fstMacroMultiplayPrefix Structure 48 | hi def link fstModifier Structure 49 | hi def link fstBrack Keyword 50 | hi def link fstBrace Keyword 51 | hi def link fstFn Operator 52 | 53 | let b:current_syntax = "freestyle" 54 | --------------------------------------------------------------------------------