diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2021-04-14 12:14:37 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2021-04-14 12:14:37 +0200 |
commit | 48eb0fb1a890077cc85f1916fc2c8bb611a0f8d5 (patch) | |
tree | 7cb3ee0dbfc4ce66bed603e7cf352ddda6b1d17a | |
parent | 0f9acbe2fcc6c87336494406e3d3c81c40e9de52 (diff) | |
download | vim-polyglot-48eb0fb1a890077cc85f1916fc2c8bb611a0f8d5.tar.gz vim-polyglot-48eb0fb1a890077cc85f1916fc2c8bb611a0f8d5.zip |
Update
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | autoload/polyglot/init.vim | 4 | ||||
-rw-r--r-- | autoload/polyglot/sleuth.vim | 1 | ||||
-rw-r--r-- | ftplugin/sway.vim | 5 | ||||
-rw-r--r-- | packages.yaml | 8 | ||||
-rw-r--r-- | syntax/sway.vim | 133 | ||||
-rw-r--r-- | tests/filetypes.vim | 1 |
7 files changed, 154 insertions, 1 deletions
@@ -7,7 +7,7 @@ A collection of language packs for Vim. > One to rule them all, one to find them, one to bring them all and in the darkness bind them. - It **won't affect your startup time**, as scripts are loaded only on demand\*. -- It **installs and updates 120+ times faster** than the <!--Package Count-->603<!--/Package Count--> packages it consists of. +- It **installs and updates 120+ times faster** than the <!--Package Count-->604<!--/Package Count--> packages it consists of. - It is also more secure (scripts loaded for every filetype are generated by vim-polyglot) - Best syntax and indentation support (no other features). Hand-selected language packs. - Automatically detects indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth), can be disabled) @@ -179,6 +179,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr - [svelte](https://github.com/leafOfTree/vim-svelte-plugin) (Svelte syntax highlighting for svelte files) - [svg-indent](https://github.com/jasonshell/vim-svg-indent) - [svg](https://github.com/vim-scripts/svg.vim) (SVG syntax highlighting for svg files) +- [sway](https://github.com/aouelete/sway-vim-syntax) - [swift](https://github.com/keith/swift.vim) (Swift syntax highlighting for swift files) - [sxhkd](https://github.com/baskerville/vim-sxhkdrc) (Syntax highlighting for sxhkdrc files) - [systemd](https://github.com/wgwoods/vim-systemd-syntax) (Syntax highlighting for automount, dnssd, link, mount, netdev and 9 more files) diff --git a/autoload/polyglot/init.vim b/autoload/polyglot/init.vim index 2ffe93ca..3b7e8072 100644 --- a/autoload/polyglot/init.vim +++ b/autoload/polyglot/init.vim @@ -168,6 +168,10 @@ let did_load_filetypes = 1 " DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE +if !has_key(g:polyglot_is_disabled, 'sway') + au BufNewFile,BufRead *sway/config setf sway +endif + if !has_key(g:polyglot_is_disabled, 'hjson') au BufNewFile,BufRead *.hjson setf hjson endif diff --git a/autoload/polyglot/sleuth.vim b/autoload/polyglot/sleuth.vim index a84ae67a..50b3321b 100644 --- a/autoload/polyglot/sleuth.vim +++ b/autoload/polyglot/sleuth.vim @@ -525,6 +525,7 @@ let s:globs = { \ 'svelte': '*.svelte', \ 'svg': '*.svg', \ 'svn': 'svn-commit*.tmp', + \ 'sway': '', \ 'swift': '*.swift', \ 'swiftgyb': '*.swift.gyb', \ 'sxhkdrc': '*.sxhkdrc,sxhkdrc', diff --git a/ftplugin/sway.vim b/ftplugin/sway.vim new file mode 100644 index 00000000..3b7df6b8 --- /dev/null +++ b/ftplugin/sway.vim @@ -0,0 +1,5 @@ +if polyglot#init#is_disabled(expand('<sfile>:p'), 'sway', 'ftplugin/sway.vim') + finish +endif + +setlocal commentstring=#\ %s diff --git a/packages.yaml b/packages.yaml index 71e25f2f..70c32215 100644 --- a/packages.yaml +++ b/packages.yaml @@ -5583,3 +5583,11 @@ filetypes: patterns: - pattern: '*.hjson' description: Hjson (https://hjson.github.io) +--- +name: sway +remote: aouelete/sway-vim-syntax +filetypes: +- name: sway + patterns: + - pattern: '*sway/config' + description: Sway Configuration diff --git a/syntax/sway.vim b/syntax/sway.vim new file mode 100644 index 00000000..5ca755c1 --- /dev/null +++ b/syntax/sway.vim @@ -0,0 +1,133 @@ +if polyglot#init#is_disabled(expand('<sfile>:p'), 'sway', 'syntax/sway.vim') + finish +endif + +" Vim syntax file +" Language: sway-wm config file +" Maintainer: Aaron Ouellette +" Latest Revision: 11 June 2016 + +if exists("b:current_syntax") + finish +endif + +" Symbols +syn match swayOperators "+\|→" +syn match swayChainDelimiter ";" + +syn match swayVar "\$\w\+" + +" Key modifiers +syn keyword swayKeyModifier Shift Control Ctrl Mod1 Mod2 Mod3 Mod4 Mod5 Mode_switch + +" Strings +syn region swaySimpleString keepend start='[^ \t]' end='$\|;' contained contains=swayChainDelimiter,swayVar +syn match swayQuotedString '"[^"]\+"' contained +syn cluster swayString contains=swaySimpleString,swayQuotedString + +" Config commands +syn keyword swayConfigCommand bind bindcode bindsym assign new_window popup_during_fullscreen font floating_modifier default_orientation workspace_layout for_window focus_follows_mouse bar position colors output input workspace_buttons workspace_auto_back_and_forth binding_mode_indicator debuglog floating_minimum_size floating_maximum_size force_focus_wrapping force_display_urgency_hint hidden_state modifier new_float socket_path mouse_warping strip_workspace_numbers focus_on_window_activation no_focus include gaps +syn match swayIpcSocket "ipc[-_]socket" nextgroup=@swayString skipwhite + +" Command keywords +syn keyword swayCommand exit reload restart kill fullscreen global layout border focus move open split append_layout mark unmark resize grow shrink show nop rename title_format sticky +syn keyword swayParam 1pixel default stacked tabbed normal none tiling stacking floating enable disable up down horizontal vertical auto up down left right parent child px or ppt leave_fullscreen toggle mode_toggle scratchpad width height top bottom client hide primary yes all active window container to absolute center on off x ms h v smart ignore pixel splith splitv output true +syn match swayDashedParam '--\(release\|border\|whole-window\|toggle\)' skipwhite +syn keyword swayWsSpecialParam next prev next_on_output prev_on_output back_and_forth current number +syn keyword swayBordersSpecialParam none vertical horizontal both +syn keyword swayModeParam dock hide invisible skipwhite + +" these are not keywords but we add them for consistency +syn keyword swayPseudoParam no false inactive + +" Exec commands +syn region swayExecCommand keepend start='[^ \t]' end='$\|;' contained contains=swayChainDelimiter,swayVar,swayNoStartupId +syn match swayQuotedExecCommand '"[^"]\+"' contained +syn keyword swayExecKeyword exec exec_always swaybar_command nextgroup=swayQuotedExecCommand,swayExecCommand skipwhite + +" Status command +syn match swayStatusCommand ".*$" contained +syn keyword swayStatusCommandKeyword status_command nextgroup=swayStatusCommand skipwhite + +" Font statement +syn keyword swayFontStatement font nextgroup=@swayString skipwhite + +" Separator symbol +syn keyword swaySeparatorSymbol separator_symbol nextgroup=@swayString skipwhite + +" Set statement +syn match swaySetVar "\$\w\+" contained nextgroup=@swayString skipwhite +syn keyword swaySetKeyword set nextgroup=swaySetVar skipwhite + +" Workspaces +syn keyword swayWsKeyword workspace nextgroup=swayWsSpecialParam,@swayString skipwhite + +" Hide edge borders +syn keyword swayBordersConfigCommand hide_edge_borders nextgroup=swayBordersSpecialParam skipwhite + +" Mode +syn keyword swayModeKeyword mode nextgroup=swayModeParam,@swayString skipwhite + +" Comments +syn keyword swayTodo contained TODO FIXME XXX NOTE +syn match swayComment "^\s*#.*$" contains=swayTodo + +" Error (at end of line) +syn match swayError ".*$" contained + +" Hex color code +syn match swayColorLast "#[0-9a-fA-F]\{6\}" contained nextgroup=swayError skipwhite +syn match swayColor2nd "#[0-9a-fA-F]\{6\}" contained nextgroup=swayColorLast skipwhite +syn match swayColor1st "#[0-9a-fA-F]\{6\}" contained nextgroup=swayColor2nd skipwhite + +syn match swayColorDef1 "client\.background\|statusline\|background\|separator\|statusline" nextgroup=swayColorLast skipwhite +syn match swayColorDef3 "client\.\(focused_inactive\|focused\|unfocused\|urgent\)\|inactive_workspace\|urgent_workspace\|focused_workspace\|active_workspace" nextgroup=swayColor1st skipwhite + +highlight link swayChainDelimiter Operator +highlight link swayOperators Operator + +highlight link swayExecCommand Special +highlight link swayQuotedExecCommand Special +highlight link swayStatusCommand Special + +highlight link swayParam Constant +highlight link swayPseudoParam Constant +highlight link swayDashedParam Constant +highlight link swayNoStartupId Constant +highlight link swayColor1st Constant +highlight link swayColor2nd Constant +highlight link swayColorLast Constant +highlight link swayWsSpecialParam Constant +highlight link swayBordersSpecialParam Constant +highlight link swayModeParam Constant + +highlight link swayVar Identifier +highlight link swaySetVar Identifier + +highlight link swayKeyModifier Function + +highlight link swaySimpleString String +highlight link swayQuotedString String +highlight link swayWsName String +highlight link swayQuotedWsName String +highlight link swaySetValue String +highlight link swayFont String + +highlight link swayExecKeyword Keyword +highlight link swayCommand Keyword +highlight link swayWsKeyword Keyword + +highlight link swayColorDef1 Define +highlight link swayColorDef3 Define +highlight link swayConfigCommand Define +highlight link swayIpcSocket Define +highlight link swaySetKeyword Define +highlight link swayModeKeyword Define +highlight link swayFontStatement Define +highlight link swaySeparatorSymbol Define +highlight link swayStatusCommandKeyword Define +highlight link swayBordersConfigCommand Define + +highlight link swayTodo Todo +highlight link swayComment Comment +highlight link swayError Error diff --git a/tests/filetypes.vim b/tests/filetypes.vim index a8d1cb7d..fbcc3cf9 100644 --- a/tests/filetypes.vim +++ b/tests/filetypes.vim @@ -648,6 +648,7 @@ call TestFiletype('mint') call TestFiletype('jsonc') call TestFiletype('gleam') call TestFiletype('hjson') +call TestFiletype('sway') " DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE |