diff --git a/README.md b/README.md index c60476e..c0a2d31 100644 --- a/README.md +++ b/README.md @@ -1,141 +1,74 @@ -# i3config.vim - vim i3 config syntax highlighting +# i3config.vim - vim i3/sway config syntax highlighting -This file contains the syntax highlighting that I use for i3 config in Vim. -Compared to the vim standard *conf* syntax highlighting, i3config -adds highlighting of all keywords, -types and options as defined in the i3 configuration manual. +This file contains the syntax highlighting that I use for i3/sway config in NeoVim. +It aims to guide you through configuration by distinctive and detailed highlights that +make it clear if your configuration is valid. It also helps in navigating through. -I built this based on the current specification -provided (as of Sat 12 Mar 2016) in: +### References +- [i3 Guide](http://i3wm.org/docs/userguide.html#configuring) +- [sway](https://github.com/swaywm/sway/blob/master/sway/sway.5.scd) +- [sway-bar](https://github.com/swaywm/sway/blob/master/sway/sway-bar.5.scd) +- [sway-input](https://github.com/swaywm/sway/blob/master/sway/sway-input.5.scd) +- [sway-output](https://github.com/swaywm/sway/blob/master/sway/sway-output.5.scd) - +Condensed showcase of `swayconfig` highlighting capabilities +![screenshot](https://github.com/litoj/i3config.vim/assets/54900518/b4ddd978-2865-4ac4-95ca-fcffb3f0ab74) -![](i3config.vim.gif) - -*using vim color scheme [dracula](https://github.com/dracula/vim)* - -*using Powerline font [ProFont for Powerline](https://github.com/powerline/fonts/blob/master/ProFont/README.rst)* +used colourscheme: [NerdContrast](https://github.com/litoj/nerdcontrast.nvim) ## Features -i3config does what a syntax highlighting would do and additionally -provides some sort of syntax checking. If you end up with *Bold Red* -lines in your i3 config file this would mean that your syntax is wrong -or there is an issue in the plugin. -If that is the case please report the issue and/or -make a pull request to cover the case. +- nice and clear syntax highlighting of i3 keywords and operators, +- wrong syntax will be highlighted as an **error** or like the first word (keyword) +- if something is not an error but wrong highlighting, please report it to this repo ### File type detection -There is no specific extension for i3 config file. -For auto detection, the recommended method is to rename your file to something like: - -+ .i3.config -+ i3.config -+ something.i3config -+ something.i3.config +Nowadays we usually use \*i3/config, therefore the filetype is used in +connection with such path. But for convenience anything as `*i3config`/`*swayconfig` is recognized. -> This way you can keep your file clean somewhere in a -dotfile repository and have it symlinked to ~/.i3/config - -If you don't want to, then you can always do: - -```vim -:set ft=i3config -``` - -or - -```vim -:set filetype=i3config -``` - -or you can add this line your .vimrc file - -```vim -aug i3config_ft_detection - au! - au BufNewFile,BufRead ~/.config/i3/config set filetype=i3config -aug end -``` -Additonally, you an add `# vim: filetype=i3config` anywhere in your config file, as suggested by the original plugin (see below). +Additonally, you can add `# vim: filetype=i3config` or `swayconfig` to the bottom of your config file. ## Installation instructions -Follow one of the steps below and reload vim afterwards. +This plugin is a reference for syntax files included in `vim`, so it serves mainly for testing +purposes. All changes should make its way to `vim` - in case of differences, please report an issue in this repo. -### Vundle +### [`vim-plug`](https://github.com/junegunn/vim-plug) -Install using [Vundle](https://github.com/gmarik/Vundle.vim) by adding - -```vim -Plugin 'mboughaba/i3config.vim' -``` - -to `.vimrc` and run `:PluginInstall`. - -### vim-plug - -Install using [vim-plug](https://github.com/junegunn/vim-plug). Similar than the installation for Vundle, just change `Plugin` to `Plug`: +Similar to the installation for Vundle, just change `Plugin` to `Plug`: Add ```vim -Plug 'mboughaba/i3config.vim' +Plug 'litoj/i3config.vim' ``` to `.vimrc` and run `:PlugInstall`. -> I use Vundle myself, the two steps below may not be fully correct, -you need to change them to fit your needs. +### [`lazy.nvim`](https://github.com/folke/lazy.nvim) -### Git submodule + Pathogen - -If you have [pathogen](https://github.com/tpope/vim-pathogen) installed, -and you prefer to use git submodules, run - -```sh -cd ~/.vim -git submodule add https://github.com/mboughaba/i3config.vim.git bundle/syntax/ +```lua +return { + 'litoj/i3config.vim', + lazy = true, + ft = {"i3config", "swayconfig"} +} ``` ### Manual installation -If you don't have either Vundle or Pathogen installed, copy both i3config.vim file -to .vim/after/syntax and .vim/after/ftdetect respectively. - ```sh -git clone https://github.com/mboughaba/i3config.git /tmp/i3config.vim -mkdir -p ~/.vim/after/syntax/ -mv /tmp/i3config.vim/after/syntax/i3config.vim ~/.vim/after/syntax/i3config.vim +git clone https://github.com/litoj/i3config.vim.git /tmp/i3config.vim +mkdir -p ~/.vim/syntax/ +mv /tmp/i3config.vim/syntax/i3config.vim ~/.vim/syntax/i3config.vim rm -rf /tmp/i3config.vim ``` -## Inspired by - -+ PotatoesMaster/i3-vim-syntax - -+ vim-scripts/edifact.vim - (For Error highlighting). - -### What about PotatoesMaster/i3-vim-syntax - -*PotatoesMaster/i3-vim-syntax* was the one I used in the past. -But as the maintainer himself pointed out, -there are some issues and a rewrite is needed. - ## Contribution Feel free to make a pull request, I will integrate it when time permits. -Make sure to add a line to cover your test in the *test.i3config*. - -## Background information - -### Author - -Mohamed Boughaba - -Development is done at: +Make sure to add a line to cover your test in `test.swayconfig`. ## License diff --git a/ftdetect/i3config.vim b/ftdetect/i3config.vim index 6cc21a6..b86dece 100644 --- a/ftdetect/i3config.vim +++ b/ftdetect/i3config.vim @@ -1,4 +1,4 @@ -aug i3config#ft_detect - au! - au BufNewFile,BufRead .i3.config,i3.config,*.i3config,*.i3.config,*sway/config,*.swayconfig,*.sway.config,sway.config,*sway/config set filetype=i3config +aug filetypedetect + au BufNewFile,BufRead *i3/*config,*i3/*conf*,*.i3conf* setf i3config + au BufNewFile,BufRead */sway/*conf*,*/sway/config.d/*,*.swayconf* setf swayconfig aug end diff --git a/ftplugin/i3config.vim b/ftplugin/i3config.vim deleted file mode 100644 index 463eea9..0000000 --- a/ftplugin/i3config.vim +++ /dev/null @@ -1 +0,0 @@ -setlocal commentstring=#\ %s diff --git a/i3config.vim.gif b/i3config.vim.gif deleted file mode 100644 index 4836670..0000000 Binary files a/i3config.vim.gif and /dev/null differ diff --git a/syntax/i3config.vim b/syntax/i3config.vim index 28ef853..fdd6438 100644 --- a/syntax/i3config.vim +++ b/syntax/i3config.vim @@ -1,280 +1,356 @@ " Vim syntax file " Language: i3 config file -" Maintainer: Mohamed Boughaba -" Version: 0.4 -" Last Change: 2019-03-23 21:54 +" Original Author: Josef Litos (litoj/i3config.vim) +" Maintainer: Josef Litos (litoj) +" Previous maintainer: Quentin Hibon (github user hiqua) +" Version: 1.2.7 +" Last Change: 2025-12-02 " References: " http://i3wm.org/docs/userguide.html#configuring " http://vimdoc.sourceforge.net/htmldoc/syntax.html " " -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syn clear -elsei exists("b:current_syntax") - fini -en +" Quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif scriptencoding utf-8 " Error -syn match i3ConfigError /.*/ +syn match i3ConfigError /.\+/ " Todo syn keyword i3ConfigTodo TODO FIXME XXX contained -" Comment -" Comments are started with a # and can only be used at the beginning of a line -syn match i3ConfigComment /^\s*#.*$/ contains=i3ConfigTodo - -" Font -" A FreeType font description is composed by: -" a font family, a style, a weight, a variant, a stretch and a size. -syn match i3ConfigFontSeparator /,/ contained -syn match i3ConfigFontSeparator /:/ contained -syn keyword i3ConfigFontKeyword font contained -syn match i3ConfigFontNamespace /\w\+:/ contained contains=i3ConfigFontSeparator -syn match i3ConfigFontContent /-\?\w\+\(-\+\|\s\+\|,\)/ contained contains=i3ConfigFontNamespace,i3ConfigFontSeparator,i3ConfigFontKeyword -syn match i3ConfigFontSize /\s\=\d\+\(px\)\?\s\?$/ contained -syn match i3ConfigFont /^\s*font\s\+.*$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace -syn match i3ConfigFont /^\s*font\s\+.*\(\\\_.*\)\?$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace -syn match i3ConfigFont /^\s*font\s\+.*\(\\\_.*\)\?[^\\]\+$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace -syn match i3ConfigFont /^\s*font\s\+\(\(.*\\\_.*\)\|\(.*[^\\]\+$\)\)/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace - -" variables -syn match i3ConfigString /\(['"]\)\(.\{-}\)\1/ contained -syn match i3ConfigColor /#\w\{6}/ contained -syn match i3ConfigVariableModifier /+/ contained -syn match i3ConfigVariableAndModifier /+\w\+/ contained contains=i3ConfigVariableModifier -syn match i3ConfigVariable /\$\w\+\(\(-\w\+\)\+\)\?\(\s\|+\)\?/ contains=i3ConfigVariableModifier,i3ConfigVariableAndModifier -syn keyword i3ConfigInitializeKeyword set contained -syn match i3ConfigInitialize /^\s*set\s\+.*$/ contains=i3ConfigVariable,i3ConfigInitializeKeyword,i3ConfigColor,i3ConfigString - -" Gaps -syn keyword i3ConfigGapStyleKeyword inner outer horizontal vertical top right bottom left current all set plus minus toggle up down contained -syn match i3ConfigGapStyle /^\s*\(gaps\)\s\+\(inner\|outer\|horizontal\|vertical\|left\|top\|right\|bottom\)\(\s\+\(current\|all\)\)\?\(\s\+\(set\|plus\|minus\|toggle\)\)\?\(\s\+\(-\?\d\+\|\$.*\)\)$/ contains=i3ConfigGapStyleKeyword,i3ConfigNumber,i3ConfigVariable -syn keyword i3ConfigSmartGapKeyword on inverse_outer contained -syn match i3ConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\)\s\?$/ contains=i3ConfigSmartGapKeyword -syn keyword i3ConfigSmartBorderKeyword on no_gaps contained -syn match i3ConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\)\s\?$/ contains=i3ConfigSmartBorderKeyword - -" Keyboard bindings -syn keyword i3ConfigAction toggle fullscreen restart key import kill shrink grow contained -syn keyword i3ConfigAction focus move grow height width split layout resize restore reload mute unmute exit mode workspace container to contained -syn match i3ConfigModifier /\w\++\w\+\(\(+\w\+\)\+\)\?/ contained contains=i3ConfigVariableModifier -syn match i3ConfigNumber /\s\d\+/ contained -syn match i3ConfigUnit /\sp\(pt\|x\)/ contained -syn match i3ConfigUnitOr /\sor/ contained -syn keyword i3ConfigBindKeyword bindsym bindcode exec gaps border contained -syn match i3ConfigBindArgument /--\w\+\(\(-\w\+\)\+\)\?\s/ contained -syn match i3ConfigBind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=i3ConfigVariable,i3ConfigBindKeyword,i3ConfigVariableAndModifier,i3ConfigNumber,i3ConfigUnit,i3ConfigUnitOr,i3ConfigBindArgument,i3ConfigModifier,i3ConfigAction,i3ConfigString,i3ConfigGapStyleKeyword,i3ConfigBorderStyleKeyword - -" Floating -syn keyword swayConfigFloatingModifier floating_modifier contained -syn match swayConfigFloatingMouseAction /^\s\?.*floating_modifier\s.*\(normal\|inverted\)$/ contains=swayConfigFloatingModifier,i3ConfigVariable,i3ConfigSize - +" Helper type definitions +syn match i3ConfigSeparator /[,;\\]/ contained +syn match i3ConfigParen /[{}]/ contained +syn keyword i3ConfigBoolean yes no enabled disabled on off true false contained +" String in simpler (matchable end) and more robust (includes `extend` keyword) forms +syn cluster i3ConfigStrIn contains=i3ConfigShCommand,i3ConfigShDelim,i3ConfigShOper,i3ConfigShParam,@i3ConfigNumVar,i3ConfigExecAction +syn match i3ConfigString /\(["']\)[^\\"')\]}]*\1/ contained contains=@i3ConfigStrIn +syn region i3ConfigString start=/"[^\\"')\]}]*[\\')\]}]/ skip=/\\\@<=\("\|$\)/ end=/"\|$/ contained contains=@i3ConfigStrIn keepend extend +syn region i3ConfigString start=/'[^\\"')\]}]*[\\")\]}]/ skip=/\\\@<=$/ end=/'\|$/ contained contains=@i3ConfigStrIn keepend extend +syn match i3ConfigColor /#[0-9A-Fa-f]\{3,8}/ contained +syn match i3ConfigNumber /[0-9A-Za-z_$-]\@&|+=~^*!.?]\+/ contained +syn match i3ConfigShParam /\s\zs-[A-Za-z-][0-9A-Za-z_-]*\>/ contained +syn cluster i3ConfigSh contains=@i3ConfigIdent,i3ConfigShOper,i3ConfigShDelim,i3ConfigShParam,i3ConfigShCommand,i3ConfigComment +syn region i3ConfigExec start=/ \ze[^{]/ skip=/\\$/ end=/$/ contained contains=i3ConfigExecAction,@i3ConfigSh keepend +syn keyword i3ConfigKeyword exec_always exec contained nextgroup=i3ConfigExec + +" 4.21 Workspaces per output +syn match i3ConfigOutputIdent /[^ ,;]\+/ contained contains=@i3ConfigIdent,i3ConfigColonOperator skipwhite nextgroup=i3ConfigOutputIdent extend +syn keyword i3ConfigOutput output contained skipwhite nextgroup=i3ConfigOutputIdent +syn match i3ConfigWorkspaceIdent /[^ ,;]\+/ contained contains=@i3ConfigIdent skipwhite nextgroup=i3ConfigGaps,i3ConfigOutput extend +syn keyword i3ConfigKeyword workspace contained skipwhite nextgroup=i3ConfigWorkspaceIdent + +" 4.22 Changing colors +syn keyword i3ConfigClientOpts focused focused_inactive focused_tab_title unfocused urgent placeholder background contained skipwhite nextgroup=i3ConfigColorSeq +syn match i3ConfigDotOperator /\./ contained nextgroup=i3ConfigClientOpts +syn keyword i3ConfigKeyword client contained nextgroup=i3ConfigDotOperator + +" 4.23 Interprocess communication +syn region i3ConfigParamLine matchgroup=i3ConfigKeyword start=/ipc-socket / end=/$/ contained contains=i3ConfigNumber,i3ConfigShOper + +" 4.24 Focus follows mouse +syn keyword i3ConfigFocusFollowsMouseOpts always contained +syn keyword i3ConfigKeyword focus_follows_mouse contained skipwhite nextgroup=i3ConfigBoolean,i3ConfigFocusFollowsMouseOpts + +" 4.25 Mouse warping +syn keyword i3ConfigMouseWarpingOpts output container none contained +syn keyword i3ConfigKeyword mouse_warping contained skipwhite nextgroup=i3ConfigMouseWarpingOpts + +" 4.26 Popups while fullscreen +syn keyword i3ConfigPopupFullscreenOpts smart ignore leave_fullscreen contained +syn keyword i3ConfigPopupFullscreenOptsExtra all contained +syn cluster i3ConfigPopupFullscreenOpts contains=i3ConfigPopupFullscreenOpts,i3ConfigPopupFullscreenOptsExtra +syn keyword i3ConfigKeyword popup_during_fullscreen contained skipwhite nextgroup=@i3ConfigPopupFullscreenOpts + +" 4.27 Focus wrapping +syn keyword i3ConfigFocusWrappingOpts force workspace contained +syn keyword i3ConfigKeyword focus_wrapping contained skipwhite nextgroup=i3ConfigBoolean,i3ConfigFocusWrappingOpts + +" 4.28 Forcing Xinerama +" 4.29 Automatic workspace back-and-forth +" 4.32 Show marks in title +syn keyword i3ConfigKeyword force_xinerama workspace_auto_back_and_forth show_marks contained skipwhite nextgroup=i3ConfigBoolean + +" 4.30 Delay urgency hint +syn match i3ConfigTimeUnit / \d\+\( ms\)\?$/ contained contains=i3ConfigNumber +syn keyword i3ConfigKeyword force_display_urgency_hint contained nextgroup=i3ConfigTimeUnit + +" 4.31 Focus on window activation +syn keyword i3ConfigFocusOnActivationOpts smart urgent focus none contained +syn keyword i3ConfigKeyword focus_on_window_activation contained skipwhite nextgroup=i3ConfigFocusOnActivationOpts + +" 4.34 Tiling drag +syn keyword i3ConfigTilingDragOpts modifier titlebar contained skipwhite nextgroup=i3ConfigTilingDragOpts +syn keyword i3ConfigKeyword tiling_drag contained skipwhite nextgroup=i3ConfigTilingDragOpts,i3ConfigBoolean + +" 4.35 Gaps (+6.24) +syn keyword i3ConfigGapsWhich inner outer horizontal vertical left right top bottom contained skipwhite nextgroup=i3ConfigGapsWhere,@i3ConfigNumVar +syn keyword i3ConfigGapsWhere current all contained skipwhite nextgroup=i3ConfigGapsOper +syn keyword i3ConfigGapsOper set plus minus toggle contained skipwhite nextgroup=@i3ConfigNumVar +syn match i3ConfigGaps /gaps/ contained contains=i3ConfigCommand skipwhite nextgroup=i3ConfigGapsWhich +syn keyword i3ConfigCommand gaps contained skipwhite nextgroup=i3ConfigGapsWhich + +syn keyword i3ConfigSmartGapOpts inverse_outer toggle contained +syn keyword i3ConfigKeyword smart_gaps contained skipwhite nextgroup=i3ConfigSmartGapOpts,i3ConfigBoolean + +" 5 Configuring bar +syn keyword i3ConfigBarOpts modifier contained skipwhite nextgroup=i3ConfigBindCombo,i3ConfigBarOptVals +syn keyword i3ConfigBarOpts i3bar_command status_command workspace_command contained skipwhite nextgroup=@i3ConfigSh +syn keyword i3ConfigBarOpts mode hidden_state id position output tray_output tray_padding separator_symbol workspace_buttons workspace_min_width strip_workspace_numbers strip_workspace_name binding_mode_indicator padding contained skipwhite nextgroup=i3ConfigBarOptVals,@i3ConfigValue,i3ConfigShOper +syn keyword i3ConfigBarOptVals dock hide invisible show none top bottom primary nonprimary contained + +syn region i3ConfigBarBlock matchgroup=i3ConfigParen start=/ {$/ end=/^\s*}$/ contained contains=i3ConfigBarOpts,i3ConfigComment,i3ConfigBindKeyword,i3ConfigColorsBlock,i3ConfigFont fold keepend +syn keyword i3ConfigKeyword bar contained nextgroup=i3ConfigBarBlock + +" 5.16 Color block +syn match i3ConfigColorSeq /#[0-9A-Fa-f]\{3,8}\|\$[0-9A-Za-z_:|[\]-]\+/ contained contains=@i3ConfigColVar skipwhite nextgroup=i3ConfigColorSeq +syn keyword i3ConfigColorsOpts background statusline separator contained skipwhite nextgroup=@i3ConfigColVar +syn match i3ConfigColorsOpts /focused_\(background\|statusline\|separator\)\|\(focused\|active\|inactive\|urgent\)_workspace\|binding_mode/ contained skipwhite nextgroup=i3ConfigColorSeq +syn region i3ConfigColorsBlock matchgroup=i3ConfigKeyword start=/^\s\+colors \ze{$/ end=/^\s\+}\zs$/ contained contains=i3ConfigColorsOpts,i3ConfigComment,i3ConfigParen fold keepend extend + +" 6.0 Command criteria +syn keyword i3ConfigConditionProp class instance window_role window_type machine id title urgent workspace con_mark con_id floating_from tiling_from contained +syn keyword i3ConfigConditionSpecial __focused__ all floating tiling contained +syn region i3ConfigCondition matchgroup=i3ConfigShDelim start=/\[/ end=/\]/ contained contains=i3ConfigConditionProp,i3ConfigShOper,i3ConfigConditionSpecial,@i3ConfigIdent keepend extend +syn region i3ConfigCriteria start=/\[/ skip=/\\$/ end=/\(;\|$\)/ contained contains=i3ConfigCondition,@i3ConfigCommand,i3ConfigSeparator keepend transparent + +" 6.1 Actions through shell +syn match i3ConfigExecActionKeyword /i3-msg/ contained +syn cluster i3ConfigExecActionVal contains=i3ConfigExecActionKeyword,i3ConfigCriteria,i3ConfigAction,i3ConfigActionKeyword,i3ConfigOption,@i3ConfigNumVar +syn region i3ConfigExecAction start=/[a-z3-]\+msg "/ skip=/ "\|\\$/ end=/"\|$/ contained contains=i3ConfigExecActionKeyword,@i3ConfigExecActionVal keepend extend +syn region i3ConfigExecAction start=/[a-z3-]\+msg '/ skip=/ '\|\\$/ end=/'\|$/ contained contains=i3ConfigExecActionKeyword,@i3ConfigExecActionVal keepend extend +syn region i3ConfigExecAction start=/[a-z3-]\+msg ['"-]\@!/ skip=/\\$/ end=/[&|;})'"]\@=\|$/ contained contains=i3ConfigExecActionKeyword,@i3ConfigExecActionVal keepend extend +" 6.1 Executing applications (4.20) +syn region i3ConfigAction matchgroup=i3ConfigCommand start=/exec / skip=/\\$/ end=/\ze[,;]\|$/ contained contains=i3ConfigExecAction,@i3ConfigSh keepend + +" 6.3 Manipulating layout +syn keyword i3ConfigLayoutOpts default tabbed stacking splitv splith toggle split all contained +syn region i3ConfigAction matchgroup=i3ConfigCommand start=/layout / skip=/\\$/ end=/\ze[,;]\|$/ contained contains=i3ConfigLayoutOpts keepend transparent + +" 6.4 Focusing containers +syn keyword i3ConfigFocusOpts left right up down parent child next prev sibling floating tiling mode_toggle contained +syn keyword i3ConfigOutputDir left right down up current primary nonprimary next prev contained skipwhite +syn keyword i3ConfigFocusOutput output contained skipwhite nextgroup=i3ConfigOutputIdent,i3ConfigOutputDir +syn keyword i3ConfigActionKeyword focus contained skipwhite nextgroup=i3ConfigFocusOpts,i3ConfigFocusOutput +syn keyword i3ConfigKeyword focus skipwhite contained nextgroup=i3ConfigFocusOutput + +" 6.8 Focusing workspaces (4.21) +syn keyword i3ConfigWorkspaceDir prev next back_and_forth contained +syn keyword i3ConfigWorkspaceDir number contained skipwhite nextgroup=i3ConfigWorkspaceIdent +syn keyword i3ConfigActionKeyword workspace contained skipwhite nextgroup=i3ConfigWorkspaceDir,i3ConfigWorkspaceIdent + +" 6.8.2 Renaming workspaces +syn region i3ConfigWorkspaceFromTo start=/workspace\( .*\)\? to/ end=/\ze[,;]\|$/ contained contains=i3ConfigMoveType,@i3ConfigWorkspaceIdent keepend transparent +syn keyword i3ConfigActionKeyword rename contained skipwhite nextgroup=i3ConfigWorkspaceFromTo + +" 6.5,6.9-6.11 Moving containers +syn match i3ConfigUnit /-\?\d\+\( px\| ppt\)\?/ contained contains=i3ConfigNumber skipwhite nextgroup=i3ConfigUnit,i3ConfigResizeExtra +syn keyword i3ConfigMoveDir left right down up position contained skipwhite nextgroup=i3ConfigUnit +syn match i3ConfigMoveDir /position \(mouse\|center\)/ contained +syn keyword i3ConfigMoveDir absolute contained skipwhite nextgroup=i3ConfigMoveDir +syn keyword i3ConfigMoveDir absolute contained + +syn keyword i3ConfigMoveType mark contained skipwhite nextgroup=i3ConfigOutputIdent +syn keyword i3ConfigMoveType scratchpad contained +syn keyword i3ConfigMoveType output contained skipwhite nextgroup=i3ConfigOutputIdent,i3ConfigOutputDir +syn keyword i3ConfigMoveType workspace contained skipwhite nextgroup=i3ConfigMoveType,i3ConfigWorkspaceIdent,i3ConfigWorkspaceDir +syn keyword i3ConfigMoveType window container contained skipwhite nextgroup=i3ConfigMoveType +syn keyword i3ConfigMoveTo to contained +syn match i3ConfigMoveType /to/ contained contains=i3ConfigMoveTo skipwhite nextgroup=i3ConfigMoveType +syn match i3ConfigActionKeyword /move\( --no-auto-back-and-forth\)\?/ contained contains=i3ConfigShParam skipwhite nextgroup=i3ConfigMoveType,i3ConfigMoveDir + +" 6.12 Resizing containers/windows +syn keyword i3ConfigResizeExtra or height contained skipwhite nextgroup=i3ConfigUnit +syn keyword i3ConfigResizeDir up down left right width height contained skipwhite nextgroup=i3ConfigUnit +syn keyword i3ConfigResizeType grow shrink contained skipwhite nextgroup=i3ConfigResizeDir +syn keyword i3ConfigResizeType set contained skipwhite nextgroup=i3ConfigResizeDir,i3ConfigUnit +syn keyword i3ConfigActionKeyword resize contained skipwhite nextgroup=i3ConfigResizeType + +" 6.14 VIM-like marks +syn match i3ConfigMarkOpt /--\(add\|replace\)\( --toggle\)\?/ contained contains=i3ConfigShParam skipwhite nextgroup=i3ConfigOutputIdent +syn keyword i3ConfigActionKeyword mark contained skipwhite nextgroup=i3ConfigMarkOpt,i3ConfigOutputIdent + +" Commands usable for direct config calls - for enforcing start of line for Commands +syn match i3ConfigTopLevelDirective /^\s*/ nextgroup=i3ConfigComment,i3ConfigKeyword,i3ConfigCommand,i3ConfigBindKeyword,i3ConfigParamLine,i3ConfigFont,i3ConfigError + +" Commands usable in keybinds +syn keyword i3ConfigActionKeyword mode append_layout kill open fullscreen sticky split floating swap unmark title_window_icon title_format border restart reload exit scratchpad nop bar contained skipwhite nextgroup=i3ConfigOption,@i3ConfigValue +syn keyword i3ConfigOption default enable disable toggle key restore current horizontal vertical auto none normal pixel show container with id con_id padding hidden_state hide dock invisible contained skipwhite nextgroup=i3ConfigOption,@i3ConfigValue +" Commands usable at runtime (outside loading config) +syn cluster i3ConfigCommand contains=i3ConfigCommand,i3ConfigAction,i3ConfigActionKeyword,@i3ConfigValue,i3ConfigColor " Define the highlighting. -hi! def link i3ConfigError Error -hi! def link i3ConfigTodo Todo -hi! def link i3ConfigComment Comment -hi! def link i3ConfigFontContent Type -hi! def link i3ConfigFocusOnActivationType Type -hi! def link i3ConfigPopupOnFullscreenType Type -hi! def link i3ConfigOrientationKeyword Type -hi! def link i3ConfigMouseWarpingType Type -hi! def link i3ConfigFocusFollowsMouseType Type -hi! def link i3ConfigGapStyleKeyword Type -hi! def link i3ConfigTitleAlignKeyword Type -hi! def link i3ConfigSmartGapKeyword Type -hi! def link i3ConfigSmartBorderKeyword Type -hi! def link i3ConfigLayoutKeyword Type -hi! def link i3ConfigBorderStyleKeyword Type -hi! def link i3ConfigEdgeKeyword Type -hi! def link i3ConfigAction Type -hi! def link i3ConfigCommand Type -hi! def link i3ConfigOutput Type -hi! def link i3ConfigWindowCommandSpecial Type -hi! def link i3ConfigFocusWrappingType Type -hi! def link i3ConfigUnitOr Type -hi! def link i3ConfigFontSize Constant -hi! def link i3ConfigColor Constant -hi! def link i3ConfigNumber Constant -hi! def link i3ConfigUnit Constant -hi! def link i3ConfigVariableAndModifier Constant -hi! def link i3ConfigTimeUnit Constant -hi! def link i3ConfigModifier Constant -hi! def link i3ConfigString Constant -hi! def link i3ConfigNegativeSize Constant -hi! def link i3ConfigFontSeparator Special -hi! def link i3ConfigVariableModifier Special -hi! def link i3ConfigSizeSpecial Special -hi! def link i3ConfigWindowSpecial Special -hi! def link i3ConfigAssignSpecial Special -hi! def link i3ConfigFontNamespace PreProc -hi! def link i3ConfigBindArgument PreProc -hi! def link i3ConfigNoStartupId PreProc -hi! def link i3ConfigFontKeyword Identifier -hi! def link i3ConfigBindKeyword Identifier -hi! def link i3ConfigOrientation Identifier -hi! def link i3ConfigGapStyle Identifier -hi! def link i3ConfigTitleAlign Identifier -hi! def link i3ConfigSmartGap Identifier -hi! def link i3ConfigSmartBorder Identifier -hi! def link i3ConfigLayout Identifier -hi! def link i3ConfigBorderStyle Identifier -hi! def link i3ConfigEdge Identifier -hi! def link i3ConfigFloating Identifier -hi! def link i3ConfigCommandKeyword Identifier -hi! def link i3ConfigNoFocusKeyword Identifier -hi! def link i3ConfigInitializeKeyword Identifier -hi! def link i3ConfigAssignKeyword Identifier -hi! def link i3ConfigResourceKeyword Identifier -hi! def link i3ConfigExecKeyword Identifier -hi! def link i3ConfigWorkspaceKeyword Identifier -hi! def link i3ConfigClientColorKeyword Identifier -hi! def link i3ConfigInterprocessKeyword Identifier -hi! def link i3ConfigMouseWarpingKeyword Identifier -hi! def link i3ConfigFocusFollowsMouseKeyword Identifier -hi! def link i3ConfigPopupOnFullscreenKeyword Identifier -hi! def link i3ConfigFocusWrappingKeyword Identifier -hi! def link i3ConfigForceXineramaKeyword Identifier -hi! def link i3ConfigAutomaticSwitchKeyword Identifier -hi! def link i3ConfigDelayUrgencyKeyword Identifier -hi! def link i3ConfigFocusOnActivationKeyword Identifier -hi! def link i3ConfigDrawingMarksKeyword Identifier -hi! def link i3ConfigBlockKeyword Identifier -hi! def link i3ConfigVariable Statement -hi! def link i3ConfigArbitraryCommand Type -hi! def link swayConfigInclude Identifier -hi! def link swayConfigFile Constant -hi! def link swayConfigFloatingModifier Identifier -hi! def link swayConfigFloatingMouseAction Type -hi! def link swayConfigFocusKeyword Type -hi! def link swayConfigFocusType Identifier +hi def link i3ConfigError Error +hi def link i3ConfigTodo Todo +hi def link i3ConfigKeyword Keyword +hi def link i3ConfigCommand Statement +hi def link i3ConfigParamLine i3ConfigString +hi def link i3ConfigOperator Operator +hi def link i3ConfigSeparator i3ConfigOperator +hi def link i3ConfigParen Delimiter +hi def link i3ConfigBoolean Boolean +hi def link i3ConfigString String +hi def link i3ConfigColor Constant +hi def link i3ConfigNumber Number +hi def link i3ConfigIdent Identifier +hi def link i3ConfigComment Comment +hi def link i3ConfigColonOperator i3ConfigOperator +hi def link i3ConfigFontNamespace i3ConfigOption +hi def link i3ConfigFontSize i3ConfigNumber +hi def link i3ConfigFont i3ConfigParamLine +hi def link i3ConfigBindArgument i3ConfigShParam +hi def link i3ConfigBindModifier i3ConfigOperator +hi def link i3ConfigBindModkey Special +hi def link i3ConfigBindCombo SpecialChar +hi def link i3ConfigBindKeyword i3ConfigKeyword +hi def link i3ConfigModeIdent i3ConfigIdent +hi def link i3ConfigSizeSpecial i3ConfigOperator +hi def link i3ConfigOrientationOpts i3ConfigOption +hi def link i3ConfigWorkspaceLayoutOpts i3ConfigOption +hi def link i3ConfigTitleAlignOpts i3ConfigOption +hi def link i3ConfigBorderOpts i3ConfigOption +hi def link i3ConfigEdgeOpts i3ConfigOption +hi def link i3ConfigSmartBorderOpts i3ConfigOption +hi def link i3ConfigVariable Variable +hi def link i3ConfigAssignSpecial i3ConfigOption +hi def link i3ConfigShParam PreProc +hi def link i3ConfigShDelim Delimiter +hi def link i3ConfigShOper Operator +hi def link i3ConfigShCommand Normal +hi def link i3ConfigOutputIdent i3ConfigIdent +hi def link i3ConfigOutput i3ConfigMoveType +hi def link i3ConfigWorkspaceIdent i3ConfigIdent +hi def link i3ConfigDotOperator i3ConfigOperator +hi def link i3ConfigClientOpts i3ConfigOption +hi def link i3ConfigFocusFollowsMouseOpts i3ConfigOption +hi def link i3ConfigMouseWarpingOpts i3ConfigOption +hi def link i3ConfigPopupFullscreenOpts i3ConfigOption +hi def link i3ConfigPopupFullscreenOptsExtra i3ConfigPopupFullscreenOpts +hi def link i3ConfigFocusWrappingOpts i3ConfigOption +hi def link i3ConfigTimeUnit i3ConfigNumber +hi def link i3ConfigFocusOnActivationOpts i3ConfigOption +hi def link i3ConfigTilingDragOpts i3ConfigOption +hi def link i3ConfigGapsWhich i3ConfigOption +hi def link i3ConfigGapsWhere i3ConfigOption +hi def link i3ConfigGapsOper i3ConfigOption +hi def link i3ConfigSmartGapOpts i3ConfigOption +hi def link i3ConfigBarModifier i3ConfigKeyword +hi def link i3ConfigBarOpts i3ConfigKeyword +hi def link i3ConfigBarOptVals i3ConfigOption +hi def link i3ConfigColorsOpts i3ConfigOption +hi def link i3ConfigConditionProp i3ConfigShParam +hi def link i3ConfigConditionSpecial Constant +hi def link i3ConfigExecActionKeyword i3ConfigShCommand +hi def link i3ConfigExecAction i3ConfigString +hi def link i3ConfigLayoutOpts i3ConfigOption +hi def link i3ConfigFocusOpts i3ConfigOption +hi def link i3ConfigOutputDir i3ConfigOption +hi def link i3ConfigFocusOutput i3ConfigOutput +hi def link i3ConfigWorkspaceDir i3ConfigOption +hi def link i3ConfigMoveDir i3ConfigOption +hi def link i3ConfigMoveType Constant +hi def link i3ConfigMoveTo i3ConfigOption +hi def link i3ConfigUnit i3ConfigNumber +hi def link i3ConfigResizeExtra i3ConfigOption +hi def link i3ConfigResizeDir i3ConfigOption +hi def link i3ConfigResizeType i3ConfigOption +hi def link i3ConfigMark i3ConfigCommand +hi def link i3ConfigMarkOpt i3ConfigOption +hi def link i3ConfigActionKeyword i3ConfigCommand +hi def link i3ConfigOption Type let b:current_syntax = "i3config" diff --git a/syntax/swayconfig.vim b/syntax/swayconfig.vim new file mode 100644 index 0000000..38a98cd --- /dev/null +++ b/syntax/swayconfig.vim @@ -0,0 +1,188 @@ +" Vim syntax file +" Language: sway config file +" Original Author: Josef Litos (litoj/i3config.vim) +" Maintainer: James Eapen +" Version: 1.2.8 +" Last Change: 2026-04-01 + +" References: +" http://i3wm.org/docs/userguide.html#configuring +" https://github.com/swaywm/sway/blob/b69d637f7a34e239e48a4267ae94a5e7087b5834/sway/sway.5.scd +" http://vimdoc.sourceforge.net/htmldoc/syntax.html +" +" +" Quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +" before i3 load to give i3ConfigKeyword lower priority +syn cluster i3ConfigCommand contains=i3ConfigCommand,i3ConfigAction,i3ConfigActionKeyword,@i3ConfigValue,i3ConfigColor,i3ConfigKeyword + +runtime! syntax/i3config.vim + +" In sway, popup_during_fullscreen does not have options like all option. +syn cluster i3ConfigPopupFullscreenOpts remove=i3ConfigPopupFullscreenOptsExtra + +" Sway extensions to i3 +syn keyword i3ConfigActionKeyword opacity urgent shortcuts_inhibitor splitv splith splitt contained contained skipwhite nextgroup=i3ConfigOption +syn keyword i3ConfigOption set plus minus allow deny csd v h t contained contained skipwhite nextgroup=i3ConfigOption,@i3ConfigValue + +syn keyword i3ConfigConditionProp app_id pid shell sandbox_app_id sandbox_engine sandbox_instance_id tag contained + +syn keyword i3ConfigWorkspaceDir prev_on_output next_on_output contained + +syn match i3ConfigBindArgument /--\(locked\|to-code\|no-repeat\|input-device=[^ '"]*\|no-warn\|inhibited\) / contained contains=i3ConfigShOper,@i3ConfigStrVar nextgroup=i3ConfigBindArgument,i3ConfigBindCombo +syn region i3ConfigBindArgument start=/--input-device=['"]/ end=/\s/ contained contains=@i3ConfigIdent,i3ConfigShOper,i3ConfigString nextgroup=i3ConfigBindArgument,i3ConfigBindCombo + +syn region i3ConfigBindCombo matchgroup=i3ConfigParen start=/{$/ end=/^\s*}$/ contained contains=i3ConfigBindArgument,i3ConfigBindCombo,i3ConfigComment fold keepend extend +" hack for blocks with start outside parsing range +syn region swayConfigBlockOrphan start=/^\s\+\(--[a-z-]\+ \)*\([$A-Z][$0-9A-Za-z_+]\+\|[a-z]\) [a-z[]/ skip=/\\$\|$\n^\s*}$/ end=/$/ contains=i3ConfigBindArgument,i3ConfigBindCombo,i3ConfigParen keepend extend + +" Note: braces highlighted by @i3ConfigSh already +syn region i3ConfigExec start=/ {$/ end=/^\s*}$/ contained contains=i3ConfigExecAction,@i3ConfigSh,i3ConfigComment fold keepend extend + +syn keyword swayConfigFloatingModifierOpts normal inverse none contained +syn match i3ConfigKeyword /floating_modifier \(none\|[$A-Z][0-9A-Za-z]\+ \(normal\|inverse\)\)$/ contained contains=i3ConfigVariable,i3ConfigBindModkey,swayConfigFloatingModifierOpts + +syn match swayConfigI3Param /--i3/ contains=i3ConfigShParam skipwhite nextgroup=i3ConfigEdgeOpts +syn keyword i3ConfigKeyword hide_edge_borders contained skipwhite nextgroup=swayConfigI3Param,i3ConfigEdgeOpts + +" accept bar ids in the form: bar { ... } +syn match swayConfigBarIdent /[^{ ,;]\+/ contained contains=@i3ConfigStrVar skipwhite nextgroup=i3ConfigBarBlock +syn keyword i3ConfigKeyword bar contained skipwhite nextgroup=swayConfigBarIdent,i3ConfigBarBlock + +syn keyword i3ConfigBarOpts swaybar_command contained skipwhite nextgroup=@i3ConfigSh +syn region i3ConfigBarOpts matchgroup=i3ConfigBarOpts start=/gaps/ end=/$/ contained contains=@i3ConfigNumVar +syn keyword i3ConfigBarOpts height pango_markup status_edge_padding status_padding wrap_scroll tray_bindcode tray_bindsym icon_theme contained skipwhite nextgroup=i3ConfigBarOptVals,@i3ConfigValue,i3ConfigShOper +syn keyword i3ConfigBarOptVals overlay contained + +syn keyword i3ConfigExecActionKeyword swaymsg contained + +" Sway-only options +" Xwayland +syn keyword swayConfigXOpt enable disable force contained +syn keyword i3ConfigKeyword xwayland contained skipwhite nextgroup=swayConfigXOpt + +" Inhibit idle +syn keyword swayConfigInhibitOpts focus fullscreen open none visible contained +syn keyword i3ConfigActionKeyword inhibit_idle contained skipwhite nextgroup=swayConfigInhibitOpts + +" Primary selection +syn keyword i3ConfigKeyword primary_selection contained skipwhite nextgroup=i3ConfigBoolean + +" Swaybg command +" Swaynag command +syn keyword i3ConfigKeyword swaybg_command swaynag_command contained nextgroup=i3ConfigExec + +" Bindswitch +syn match swayConfigBindswitchArgument /--\(locked\|no-warn\|reload\) / contained nextgroup=swayConfigBindswitchArgument,swayConfigBindswitchType +syn keyword swayConfigBindswitchType lid tablet contained nextgroup=swayConfigBindswitchCombo +syn keyword swayConfigBindswitchState toggle contained +syn match swayConfigBindswitchCombo /:\(on\|off\|toggle\) / contained contains=i3ConfigColonOperator,swayConfigBindswitchState,i3ConfigBoolean nextgroup=i3ConfigBind +syn region swayConfigBindswitchType matchgroup=i3ConfigParen start=/{$/ end=/^\s*}$/ contained contains=swayConfigBindswitchArgument,swayConfigBindswitchType,i3ConfigComment fold keepend extend +syn keyword i3ConfigBindKeyword bindswitch contained skipwhite nextgroup=swayConfigBindswitchArgument,swayConfigBindswitchType +" hack for blocks with start outside parsing range +syn region swayConfigBlockOrphan start=/^\s\+\(lid\|tablet\):/ skip=/\\$\|$\n^\s*}$/ end=/$/ contains=swayConfigBindswitchArgument,swayConfigBindswitchType,i3ConfigParen keepend extend + +" Bindgesture +syn match swayConfigBindgestureArgument /--\(exact\|input-device=[:0-9A-Za-z_/-]\+\|no-warn\) / contained nextgroup=swayConfigBindgestureArgument,swayConfigBindgestureCombo +syn keyword swayConfigBindgestureType hold swipe pinch contained +syn keyword swayConfigBindgestureDir up down left right inward outward clockwise counterclockwise contained +syn match swayConfigBindgestureCombo /\(hold\(:[1-5]\)\?\|swipe\(:[3-5]\)\?\(:up\|:down\|:left\|:right\)\?\|pinch\(:[2-5]\)\?:\(+\?\(inward\|outward\|clockwise\|counterclockwise\|up\|down\|left\|right\)\)\+\) / contained contains=i3ConfigNumber,swayConfigBindgestureType,i3ConfigColonOperator,swayConfigBindgestureDir,i3ConfigBindModifier nextgroup=swayConfigBindgestureCombo,i3ConfigBind +syn region swayConfigBindgestureCombo matchgroup=i3ConfigParen start=/{$/ end=/^\s*}$/ contained contains=swayConfigBindgestureArgument,swayConfigBindgestureCombo,i3ConfigComment fold keepend extend +syn keyword i3ConfigBindKeyword bindgesture contained skipwhite nextgroup=swayConfigBindgestureArgument,swayConfigBindgestureCombo +" hack for blocks with start outside parsing range +syn region swayConfigBlockOrphan start=/^\s\+\(--[a-z-]\+ \)*\(hold\|swipe\|pinch\):/ skip=/\\$\|$\n^\s*}$/ end=/$/ contains=swayConfigBindgestureArgument,swayConfigBindgestureCombo,i3ConfigParen keepend extend + +" Tiling drag threshold +" Titlebar commands +syn keyword i3ConfigKeyword tiling_drag_threshold titlebar_border_thickness contained skipwhite nextgroup=@i3ConfigNumVar +syn match i3ConfigKeyword /titlebar_padding \(\d\+\|\$\S\+\)\( \d\+\)\?$/ contained contains=@i3ConfigNumVar + +syn match swayConfigDeviceOper /[*:;!]/ contained + +" Input devices +syn keyword swayConfigInputOpts xkb_variant xkb_rules xkb_switch_layout xkb_numlock xkb_file xkb_capslock xkb_model repeat_delay repeat_rate map_to_output map_to_region map_from_region tool_mode accel_profile dwt dwtp drag_lock drag click_method clickfinger_button_map middle_emulation tap events calibration_matrix natural_scroll left_handed pointer_accel scroll_button scroll_button_lock scroll_factor scroll_method tap_button_map contained skipwhite nextgroup=swayConfigInputOptVals,@i3ConfigValue +syn keyword swayConfigInputOptVals absolute relative adaptive flat none button_areas clickfinger toggle two_finger edge on_button_down lrm lmr next prev pen eraser brush pencil airbrush disabled_on_external_mouse disable enable contained skipwhite nextgroup=swayConfigInputOpts,@i3ConfigValue,swayConfigDeviceOper +syn match swayConfigDeviceOper /,/ contained nextgroup=swayConfigXkbOptsPair,swayConfigXkbLayout +syn match swayConfigXkbLayout /[a-z]\+/ contained nextgroup=swayConfigDeviceOper +syn keyword swayConfigInputOpts xkb_layout contained skipwhite nextgroup=swayConfigXkbLayout +syn match swayConfigXkbOptsPairVal /[0-9a-z_-]\+/ contained contains=i3ConfigNumber skipwhite nextgroup=swayConfigDeviceOper,swayConfigInputOpts +syn match swayConfigXkbOptsPair /[a-z]\+:/ contained contains=i3ConfigColonOperator nextgroup=swayConfigXkbOptsPairVal +syn keyword swayConfigInputOpts xkb_options contained skipwhite nextgroup=swayConfigXkbOptsPair +syn match swayConfigInputAngle /\(3[0-5][0-9]\|[1-2]\?[0-9]\{1,2\}\)\(\.[0-9]\+\)\?/ skipwhite nextgroup=swayConfigInputOpts +syn keyword swayConfigInputOpts rotation_angle contained skipwhite nextgroup=swayConfigInputAngle + +syn region swayConfigInput start=/\s/ skip=/\\$/ end=/\ze[,;]\|$/ contained contains=swayConfigInputOpts,@i3ConfigValue keepend +syn region swayConfigInput matchgroup=i3ConfigParen start=/ {$/ end=/^\s*}$/ contained contains=swayConfigInputOpts,@i3ConfigValue,i3ConfigComment keepend +syn keyword swayConfigInputType touchpad pointer keyboard touch tablet_tool tablet_pad switch contained skipwhite nextgroup=swayConfigInput +syn match swayConfigInputTypeIdent /type:!\?/ contained contains=swayConfigDeviceOper skipwhite nextgroup=swayConfigInputType +syn match swayConfigInputIdent /[^t ,;][^ ,;]*/ contained contains=@i3ConfigStrVar skipwhite nextgroup=swayConfigInput extend +syn keyword i3ConfigKeyword input contained skipwhite nextgroup=swayConfigInputTypeIdent,swayConfigInputIdent + +" Seat +syn keyword swayConfigSeatOpts cursor fallback hide_cursor keyboard_grouping shortcuts_inhibitor pointer_constraint xcursor_theme contained skipwhite nextgroup=swayConfigSeatOptVals,@i3ConfigValue +syn match swayConfigInputTypeSeq / \w\+/ contained contains=swayConfigInputType skipwhite nextgroup=swayConfigInputTypeSeq,swayConfigSeatOpts +syn keyword swayConfigSeatOpts idle_inhibit idle_wake contained nextgroup=swayConfigInputTypeSeq +syn keyword swayConfigSeatOpts attach contained skipwhite nextgroup=swayConfigSeatIdent +syn match swayConfigSeatOptVals /when-typing/ contained skipwhite nextgroup=swayConfigSeatOptVals +syn keyword swayConfigSeatOptVals move set press release none smart activate deactivate toggle escape enable disable contained skipwhite nextgroup=swayConfigSeatOpts +syn region swayConfigSeat start=/\s/ skip=/\\$/ end=/\ze[,;]\|$/ contained contains=swayConfigSeatOpts,@i3ConfigValue keepend +syn region swayConfigSeat matchgroup=i3ConfigParen start=/ {$/ end=/^\s*}$/ contained contains=swayConfigSeatOpts,@i3ConfigValue,i3ConfigComment keepend +syn match swayConfigSeatIdent /[^ ,;]\+/ contained contains=@i3ConfigStrVar nextgroup=swayConfigSeat extend +syn keyword i3ConfigKeyword seat contained skipwhite nextgroup=swayConfigSeatIdent + +" Output monitors +syn keyword swayConfigOutputOpts mode resolution res modeline position pos scale scale_filter subpixel transform disable enable toggle power dpms max_render_time adaptive_sync render_bit_depth color_profile allow_tearing hdr contained skipwhite nextgroup=swayConfigOutputOptVals,@i3ConfigValue,swayConfigOutputMode +syn keyword swayConfigOutputOptVals linear nearest smart rgb bgr vrgb vbgr none toggle srgb contained skipwhite nextgroup=swayConfigOutputOptVals,@i3ConfigValue +syn keyword swayConfigOutputBgVals solid_color fill stretch fit center tile contained skipwhite nextgroup=@i3ConfigColVar +syn match swayConfigOutputBg /[#$]\S\+ solid_color/ contained contains=@i3ConfigColVar,swayConfigOutputBgVals skipwhite nextgroup=swayConfigOutputOpts +syn match swayConfigOutputBg /[^b# ,;][^ ,;]*/ contained contains=@i3ConfigStrVar skipwhite nextgroup=swayConfigOutputBgVals extend +syn keyword swayConfigOutputOpts bg background contained skipwhite nextgroup=swayConfigOutputBg +syn match swayConfigOutputFPS /@[0-9.]\+Hz/ contained skipwhite nextgroup=swayConfigOutputOpts +syn match swayConfigOutputMode /\(--custom \)\?[0-9]\+x[0-9]\+/ contained contains=i3ConfigShParam skipwhite nextgroup=swayConfigOutputFPS,swayConfigOutputOpts +" clockwise and anticlockwise are relative -> only as bindings / user actions - not in config setup +syn match swayConfigOutputOptVals /\(\(flipped-\)\?\(90\|180\|270\)\|flipped\|normal\)\( \(anti\)\?clockwise\)\?/ contained contains=i3ConfigNumber skipwhite nextgroup=swayConfigOutputOpts +syn match swayConfigOutputICCPath /\S\+/ contained contains=@i3ConfigStrVar skipwhite nextgroup=swayConfigOutputOpts extend +syn keyword swayConfigOutputOptVals icc contained skipwhite nextgroup=swayConfigOutputICCPath +syn region swayConfigOutput start=/\s/ skip=/\\$/ end=/\ze[,;]\|$/ contained contains=swayConfigOutputOpts,@i3ConfigValue keepend +syn region swayConfigOutput matchgroup=i3ConfigParen start=/ {$/ end=/^\s*}$/ contained contains=swayConfigOutputOpts,@i3ConfigValue,i3ConfigComment keepend +syn match swayConfigOutputIdent /[^ ,;]\+/ contained contains=@i3ConfigIdent skipwhite nextgroup=swayConfigOutput extend +syn keyword i3ConfigKeyword output contained skipwhite nextgroup=swayConfigOutputIdent +syn keyword i3ConfigActionKeyword output contained skipwhite nextgroup=swayConfigOutputIdent + +" Define the highlighting. +hi def link swayConfigFloatingModifierOpts i3ConfigOption +hi def link swayConfigBarIdent i3ConfigIdent +hi def link swayConfigXOpt i3ConfigOption +hi def link swayConfigInhibitOpts i3ConfigOption +hi def link swayConfigBindswitchArgument i3ConfigBindArgument +hi def link swayConfigBindswitchType i3ConfigMoveType +hi def link swayConfigBindswitchState i3ConfigMoveDir +hi def link swayConfigBindgestureArgument i3ConfigBindArgument +hi def link swayConfigBindgestureType i3ConfigMoveType +hi def link swayConfigBindgestureDir i3ConfigMoveDir +hi def link swayConfigDeviceOper i3ConfigOperator +hi def link swayConfigInputType i3ConfigMoveType +hi def link swayConfigInputTypeIdent i3ConfigMoveDir +hi def link swayConfigInputIdent i3ConfigIdent +hi def link swayConfigInputOptVals i3ConfigShParam +hi def link swayConfigInputOpts i3ConfigOption +hi def link swayConfigInputAngle i3ConfigNumber +hi def link swayConfigXkbOptsPairVal i3ConfigParamLine +hi def link swayConfigXkbOptsPair i3ConfigShParam +hi def link swayConfigXkbLayout i3ConfigParamLine +hi def link swayConfigSeatOptVals swayConfigInputOptVals +hi def link swayConfigSeatOpts swayConfigInputOpts +hi def link swayConfigSeatIdent i3ConfigIdent +hi def link swayConfigOutputOptVals swayConfigInputOptVals +hi def link swayConfigOutputBgVals swayConfigInputOptVals +hi def link swayConfigOutputBg i3ConfigString +hi def link swayConfigOutputICCPath i3ConfigString +hi def link swayConfigOutputOpts swayConfigInputOpts +hi def link swayConfigOutputFPS Constant +hi def link swayConfigOutputMode i3ConfigNumber +hi def link swayConfigOutputIdent i3ConfigIdent + +let b:current_syntax = "swayconfig" diff --git a/test.i3config b/test.i3config deleted file mode 100644 index 8c80fc4..0000000 --- a/test.i3config +++ /dev/null @@ -1,289 +0,0 @@ -# 1) ERROR - sdsjdkjsdkO - fon t xft : System San Francisco Display,FontAwesome UI -$var.one -bindsyn --release $mod+x exec --no-startup-id import /tmp/latest-screenshot.png -kjdfdjdfkfO -default_orientation vErtical -floating_maximum_size -1 -1 -workspace_layout defeult -new_window none 0 -new_window pixet new_window normall -new_float none 0 -new_float pixet -new_float normall -hade_edge_borders both -exec_ chromium -mouse_wraping none -include config_file -include .../config_file - -# 2) COMMENT -# This is a comment -# TODO: This is a todo comment - # This is another comment -# 3) FONT -font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -font pango:DejaVu Sans Mono 10 -font pango:DejaVu Sans Mono, Terminus Bold Semi-Condensed 11 -font pango:Terminus 11px - #font xft:Cousine, FontAwesome 10 - font xft:System San Francisco Display, FontAwesome 10 - -# 5) Variable -$var-one -$var-with-more-dashes -$varOne -$var_one -set $m Mod1 -set $focused-bg-color #404552 - -# 5) Keybinding - bindsym $mod+f fullscreen toggle -bindsym $mod+Shift+r restart -bindcode 214 exec --no-startup-id /home/michael/toggle_beamer.sh -bindsym --release $mod+x exec --no-startup-id xdotool key --clearmodifiers ctrl+v -bindsym --release $mod+x exec --no-startup-id import /tmp/latest-screenshot.png -bindsym XF86MonBrightnessUp exec xbacklight -inc 5 -bindsym XF86MonBrightnessDown exec xbacklight -dec 5 -bindsym $mod+u border none -bindsym $mod+y border pixel $def_border_pix - - -# 6) Floating -floating_modifier $mod -floating_modifier $mod normal -floating_minimum_size 75 x 50 -floating_maximum_size -1 x -1 - -# 7) Workspace orientation -default_orientation vertical - -# 9) Workspace layout -workspace_layout default - -# 10) Border style -new_window none -new_window pixel -new_window normal -new_window pixel 1 -new_window normal 2 -new_float none -new_float pixel -new_float normal -new_float pixel 1 -new_float normal 2 -default_border pixel 1 -default_border pixel $def_border_pix -default_floating_border pixel 1 - -# 11) Hide border edge -hide_edge_borders both -hide_edge_borders smart_no_gaps - -# 11) Arbitrary command for specific window -for_window [class="XTerm"] floating enable -for_window [class="urxvt"] border pixel 1 -for_window [title="x200: ~/work"] floating enable - -# 12) Disable focus upon opening -no_focus [window_role="pop-up"] - -# 13) Move client to specific workspace automatically -assign [class="URxvt"] 2 -assign [class="^URxvt$"] 2 -assign [class="^URxvt$"] → 2 -assign [class="^URxvt$"] → work -assign [class="^URxvt$" instance="^irssi$"] → 3 - -# 14) Auto start application -exec chromium -exec --no-startup-id chromium -exec_always ~/my_script.sh - -# 15) Automatically putting workspaces on specific screens -workspace 1 output LVDS1 -workspace 5 output VGA1 -workspace "2: vim" output VGA1 - -# 16) Changing colors -# class border backgr. text indicator child_border -client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 -client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a -client.unfocused #333333 #222222 #888888 #292d2e #222222 -client.urgent #2f343a #900000 #ffffff #900000 #900000 -client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c -client.background #ffffff - -# 17) Interprocess communication -ipc-socket ~/.i3/i3-ipc.sock - -# 18) Focus follows mouse -mouse_warping output -mouse_warping none - -# 19) Popups during fullscreen mode -popup_during_fullscreen smart - -# 20) Force Focus wrapping -force_focus_wrapping yes -# Focus wrapping -focus_wrapping no - -# 21) Forcing Xinerama -force_xinerama no - - -# 22) Automatic back-and-forth when switching to the current workspace -workspace_auto_back_and_forth yes - -# 23) Delay urgency hint -force_display_urgency_hint 1000 ms - -# 24) Focus on window activation -focus_on_window_activation urgent - -# 25) Drawing marks on window decoration -show_marks yes - -# 26) Group mode/bar -mode "resize" { - # Pressing down will grow the window’s height. - bindsym l resize shrink width 10 px or 10 ppt -} -bar { - status_command /home/mohamed/.conkyi3 - position top - colors { - background $bg_color - separator #757575 - urgent_workspace $urgent_bg_color $urgent_bg_color $text_color - } -} - -# 27) Line continuation -bindsym Mod1+f \ -fullscreen toggle - -font \ -xft:System San Francisco Display, \ -xft:System San Francisco Display, \ - -# 28) X resources -set_from_resource $black i3wm.color0 #000000 - -# 29) gaps -gaps inner 1 -gaps outer 2 -gaps outer -1 -gaps left 2 -gaps top 2 -gaps right 2 -gaps top 2 -gaps inner set 3 -gaps inner plus 4 -gaps inner minus 5 -gaps outer set 6 -gaps outer plus 7 -gaps outer minus 8 -gaps inner current 9 -gaps inner current set 10 -gaps inner current plus 11 -gaps inner current minus 12 -gaps inner all 13 -gaps inner all set 14 -gaps inner all plus 15 -gaps inner all minus 16 -gaps outer current 17 -gaps outer current set 18 -gaps outer current plus 19 -gaps outer current minus 20 -gaps outer all 21 -gaps outer all set 22 -gaps outer all plus 23 -gaps outer all minus 24 -gaps inner all set 0 -gaps horizontal current plus 40 -gaps outer current toggle 60 -gaps inner $var -gaps outer $var -gaps left $var -gaps top $var -gaps right $var -gaps top $var -gaps inner set $var -gaps inner plus $var -gaps inner minus $var -gaps outer set $var -gaps outer plus $var -gaps outer minus $var -gaps inner current $var -gaps inner current set $var -gaps inner current plus $var -gaps inner current minus $var -gaps inner all $var -gaps inner all set $var -gaps inner all plus $var -gaps inner all minus $var -gaps outer current $var -gaps outer current set $var -gaps outer current plus $var -gaps outer current minus $var -gaps outer all $var -gaps outer all set $var -gaps outer all plus $var -gaps outer all minus $var -gaps inner all set $var -gaps horizontal current plus $var -gaps outer current toggle $var - -# change focus -bindsym Mod1+h focus left -bindsym Mod1+j focus down -bindsym Mod1+k focus up -bindsym Mod1+l focus right - -# change workspace -bindsym $mod+1 workspace $ws1 - -# switch mode -bindsym $mod+p mode "$pmode" - -# move container to workspace -bindsym $mode+Shift+1 move container to workspace $ws1 - -# grow window -bindsym $mod+u resize grow height 5 px or 5 ppt - -# 30) Focus follow mouse -focus_follows_mouse no -focus_follows_mouse yes - -# 31) Mouse wrapping -mouse_warping none -mouse_warping output - -# 32) smart_gaps -smart_gaps on -smart_gaps inverse_outer - -# 33) smart_borders -smart_borders on -smart_borders no_gaps - - -# 35) title alignment -title_align left -title_align right -title_align center - -# 36) sway config file include -include ~/.config/sway/config -include /.config/sway/config -include ./sway/config -include ../sway/config - -# 36) sway focus and output keywords -focus output eDP-1 -output DP-2 pos 0 0 -output eDP-1 pos 1440 0 diff --git a/test.swayconfig b/test.swayconfig new file mode 100644 index 0000000..57cff1e --- /dev/null +++ b/test.swayconfig @@ -0,0 +1,297 @@ +# 1) ERROR + sdsjdkjsdkO + fon t xft : System San Francisco Display,FontAwesome UI +$var.one +bindsym --border --whole-win Mod1+Mod4s focu 4 +for_window [app=__focused__] move workspace "$work" ; workspace "$work" +floating_maximum_size -1 -1 +floating_modifier inverse +workspace_layout defeult +new_window none +new_window pixel +new_float normal 2 + + +## i3wm test +# 4.1 +include `fd -H "~/.config/sway/config"` +include ~/.config/$DESKTOP/config.d/*.conf +# 4.2 +# This is a comment +# TODO: This is a todo comment + # This is another comment +# 4.3 +font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +font pango:DejaVu Mono, Terminus Bold Semi-Condensed 11 +font pango:Terminus 11px +bar { + #font xft:Cousine, FontAwesome 10 + font xft:System San Francisco Display, FontAwesome 10 +} +# 4.4 +bindsym Ctrl+Shift+Mod4+x [all] kill; restart +bindcode 214 exec --no-startup-id i3-msg "workspace 3" something +bindsym --release $mod+b exec --no-startup-id fd -t f $(ls "$pics") +bindsym XF86MonBrightnessUp exec xbacklight -inc 5 +# 4.5 +bindsym --border --whole-window --exclude-titlebar Ctrl+button3 kill +# 4.6 +mode --pango_markup "extra" { + # empty +} +mode $extra { + bindsym $mod+button3 fullscreen toggle +} +# 4.7 +floating_modifier Mod1 +floating_modifier $Mod1 +# 4.8 +floating_minimum_size -1 x 0 +# 4.9 +default_orientation auto +# 4.10 +workspace_layout tabbed +# 4.11 +title_align center +# 4.12 +default_border none +default_border normal $def_border_pix +default_floating_border pixel 1 +# 4.13 +hide_edge_borders smart_no_gaps +# 4.14 +smart_borders no_gaps +# 4.15 +for_window [title="x200: ~/work"] floating enable, move workspace "$work", focus +# 4.16 +no_focus [window_role="pop-up"] +# 4.17 +set $cmd bg $(fd -H '~/Pictures/') +set $cmd2 \ + var2cmd --output 4 + "should be ERR, not part of ↑↑" +# 4.18 +set_from_resource $black i3wm.color0 #000000 +# 4.19 +assign [all] 1 +assign [class="^URxvt$"] → number "2: work" +# 4.20 +exec_always swayidle 'swaymsg output \* off' --resume 'swaymsg output "Very specific\ + display name" power on' &>/dev/null +# 4.21 +workspace $w1 output primary +workspace "2: vim" output VGA1 +# 4.22 +client.focused #000000 +client.focused_inactive #000000 +client.focused_tab_title #000000 +client.unfocused #000000 +client.urgent #000000 +client.placeholder #000000 +client.background $bg +# 4.23 +ipc-socket ~/.i3/i3-ipc.sock +# 4.24 +focus_follows_mouse yes +# 4.25 +mouse_warping output +mouse_warping none +# 4.26 +popup_during_fullscreen smart +popup_during_fullscreen ignore +popup_during_fullscreen leave_fullscreen +# should be an ERROR in sway, but working in i3 (v4.24+) +popup_during_fullscreen all +# 4.27 +focus_wrapping no +focus_wrapping force +# 4.28 +force_xinerama no +# 4.29 +workspace_auto_back_and_forth yes +# 4.30 +force_display_urgency_hint 1 ms +force_display_urgency_hint 0 +# 4.31 +focus_on_window_activation smart +focus_on_window_activation urgent +focus_on_window_activation focus +focus_on_window_activation none +# 4.32 +show_marks yes +# 4.34 +tiling_drag modifier titlebar +tiling_drag off +# 4.35 +gaps inner all minus 30 +workspace 3 gaps inner 0 +smart_gaps inverse_outer +smart_gaps on +# 5 +bar { + i3bar_command status_command mode dock|hide|invisible hidden_state hide|show + # 5.3 + modifier none + modifier Mod4+Ctrl + # 5.4 + bindsym --release button2 reload + + id position top|bottom output|tray_output none|primary|nonprimary|HDMI... tray_padding 0 + # 5.10 + font pango:DejaVu Sans Mono 10 + + separator_symbol ":|:" workspace_buttons yes|no workspace_min_width 40 + strip_workspace_name yes|no binding_mode_indicator + # 5.16 + colors { + background statusline separator focused_background focused_statusline #fff $color + focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode + } + + padding 0 +} +# 6 +exec i3-msg border none +for_window [all floating tiling] title_window_icon padding 1 +for_window [class instance window_role window_type machine id title urgent workspace con_mark] +for_window [con_id floating_from tiling_from = __focused__] +# 6.1 +bindsym $mod+p exec "notify-send \\"Hello, i3; from $USER\\"" +bindsym $mod+p exec notify-send 'commas, not, working yet' -u low +# 6.2 +bindsym $mod+v split vertical horizontal toggle +# 6.3 +bindsym _ layout split|all|default|tabbed|stacking|splitv|splith +# 6.4 +bindsym _ focus left|right|up|down|parent|child|floating|tiling|mode_toggle|next|prev sibling, \ + focus output left|right|down|up|current|primary|nonprimary|next|HDMI... +# 6.8.2 +bindsym _ exec i3-msg 'rename workspace to "10: www"' +# 6.5,6.9-6.11 +bindsym _ move left|right|down|up 10 px ppt absolute position center mouse scratchpad, \ + move --no-auto-back-and-forth window to mark target, \ + move workspace number 4, move workspace output oname +# 6.12 +bindsym _ resize grow width 10 px or 12 ppt +# 6.14 +bindsym _ mark --add --toggle name, mark --replace name; unmark name +# 6.24 +bindsym _ gaps horizontal current toggle 30 +# 6.other +bindsym _ split vertical|horizontal|toggle, swap container with id|con_id|mark identifier,\ + sticky enable|disable|toggle, title_format "%title: %class %instance %machine",\ + title_window_icon yes|no|toggle|padding 0, border none|normal|pixel|toggle 0,\ + scratchpad show, nop, bar hidden_state hide|show|toggle ID, bar mode dock|hide|invisible|toggle\ + exit, reload, restart, fullscreen|floating enable|disable|toggle +# ignoring: shmlog, debuglog + +## Sway additions +# sway +xwayland force +bindsym _ border toggle|none|normal|pixel|csd 4, focus tiling|floating,\ + inhibit_idle focus, inhibit_idle fullscreen, inhibit_idle open, inhibit_idle visible +primary_selection disabled +# ignoring: max_render_time off +bindsym _ move container, move window, move workspace to output left,\ + shortcuts_inhibitor enable|disable, split v|h|none|t, splitv|splith|splitt +bindswitch --locked --no-warn --reload { + lid:on nop + lid:off nop + tablet:toggle nop +} +bindgesture --exact --input-device=Mouse:3 --no-warn { + hold:1 hold:5 nop + swipe:3 swipe:5:up nop + pinch:2:down pinch:5:inward pinch:4:counterclockwise nop +} +floating_modifier Mod1 normal +floating_modifier $mod1 inverse +floating_modifier none +hide_edge_borders --i3 none +bindsym _ opacity set|plus|minus 1, urgent enable|disable|allow|deny +tiling_drag_threshold 3 +bindsym _ workspace prev_on_output|next_on_output +# sway exec block +exec { + test --command=1 +} +# sway-bar +bar hi $varname { + # shoud be an ERROR +} +bar $varname { + font xft:System San Francisco Display, FontAwesome 10 +} +bar "hello there" { + font xft:System San Francisco Display, FontAwesome 10 + swaybar_command + binding_mode_indicator yes|no + gaps 10 10 10 10 + height 20 + mode overlay + output * + pango_markup enabled|disabled + status_edge_padding|status_padding|workspace_min_width 0 + strip_workspace_name|strip_workspace_numbers|wrap_scroll|workspace_buttons yes|no, + # TRAY + tray_bindcode 1 ContextMenu... + tray_bindsym button1 ScrollUp... + icon_theme 1 +} +# sway-input +input $var { +} +input type:!keyboard { + repeat_delay|repeat_rate 220 xkb_file $name xkb_layout us,de xkb_model xkb_rules + xkb_options x:y rotation_angle -90 + xkb_switch_layout 3|next|prev xkb_variant xkb_capslock|xkb_numlock enabled|disabled +} +input "name test" map_to_output $eDP-1 map_to_region $x $y $width $height map_from_region X1xY1 X2xY2 +input type:tablet_tool tool_mode pen|eraser|brush|pencil|airbrush|* +input type:touchpad { + accel_profile adaptive|flat + calibration_matrix 1 2 3 4 5 6 + click_method none|button_areas|clickfinger + drag|drag_lock|dwt|dwtp|left_handed|middle_emulation|natural_scroll|tap enabled|disabled + events enabled|disabled|disabled_on_external_mouse|toggle + pointer_accel -1 + scroll_button disable|button12389 + tap_button_map lrm|lmr + scroll_factor 1 + scroll_method none|two_finger|edge|on_button_down +} +# SEAT CONFIGURATION +seat $var cursor move|set x y +seat seat1 cursor press|release button1-9 +seat "name test" { + attach 'identifier' + fallback true|false + hide_cursor 5000|when-typing enable|disable + idle_inhibit|idle_wake keyboard pointer touchpad touch tablet_pad tablet_tool switch + keyboard_grouping none|smart + pointer_constraint enable|disable|escape + shortcuts_inhibitor enable|disable|activate|deactivate|toggle + xcursor_theme 'Cursortheme' 32 +} +# sway-output +output $var { +} +output * pos 1920 0 res 1920x1080 +output "Some Company ABC123 0x00000000" { + mode|resolution|res --custom 1920x1080@60.001Hz + modeline 0... + position|pos $X $Y + scale 1 + scale_filter linear|nearest|smart + subpixel rgb|bgr|vrgb|vbgr|none + background "$(fd . ~/Pictures/screen/|shuf -n1)" stretch bg #666 solid_color + bg #666 solid_color + transform flipped-90|180|270|flipped|transform normal clockwise|anticlockwise + disable|enable|toggle + power|dpms on|off|toggle + max_render_time off|100 + adaptive_sync on|off + render_bit_depth 8|10 + allow_tearing on + color_profile srgb color_profile icc "path/to /file" color_profile icc $var +}