├── README.md ├── ftdetect └── i3.vim ├── ftplugin └── i3.vim └── syntax └── i3.vim /README.md: -------------------------------------------------------------------------------- 1 | :warning: *This syntax file is not maintained anymore. Feel free to take over or try some alternative 2 | (eg: [i3config.vim](https://github.com/mboughaba/i3config.vim)).* 3 | 4 | --- 5 | 6 | This is a [Vim](http://vim.org) syntax file for [i3](http://i3wm.org/) config file. 7 | 8 | ![Screenshot](https://raw.githubusercontent.com/PotatoesMaster/i3-vim-syntax/junk/screenshot.png) 9 | 10 | ## Using it 11 | 12 | You can install it using a Vim plugin manager ([Vundle], [Pathogen], …) or just by putting [i3.vim][i3vim] in your `~/.vim/syntax` directory. 13 | 14 | I recommend you to add `# vim:filetype=i3` at the end of your i3 config file, unless you really want to type `:set filetype=i3` every time you edit this file. 15 | 16 | [Vundle]:http://github.com/gmarik/vundle/ 17 | [Pathogen]:http://github.com/tpope/vim-pathogen/ 18 | [i3vim]: http://raw.github.com/PotatoesMaster/i3-vim-syntax/master/syntax/i3.vim 19 | -------------------------------------------------------------------------------- /ftdetect/i3.vim: -------------------------------------------------------------------------------- 1 | augroup i3_ftdetect 2 | au! 3 | au BufRead,BufNewFile *i3/config,*sway/config set ft=i3 4 | augroup END 5 | -------------------------------------------------------------------------------- /ftplugin/i3.vim: -------------------------------------------------------------------------------- 1 | setlocal commentstring=#\ %s 2 | -------------------------------------------------------------------------------- /syntax/i3.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: i3-wm config file 3 | " Maintainer: Emanuel Guével 4 | " Latest Revision: 16 October 2012 5 | 6 | if exists("b:current_syntax") 7 | finish 8 | endif 9 | 10 | " Symbols 11 | syn match i3Operators "+\|→" 12 | syn match i3ChainDelimiter ";" 13 | 14 | syn match i3Var "\$\w\+" 15 | 16 | " Key modifiers 17 | syn keyword i3KeyModifier Shift Control Ctrl Mod1 Mod2 Mod3 Mod4 Mod5 Mode_switch 18 | 19 | " Strings 20 | syn region i3SimpleString keepend start='[^ \t]' end='$\|;' contained contains=i3ChainDelimiter,i3Var 21 | syn match i3QuotedString '"[^"]\+"' contained 22 | syn cluster i3String contains=i3SimpleString,i3QuotedString 23 | 24 | " Config commands 25 | syn keyword i3ConfigCommand 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 tray_output workspace_buttons workspace_auto_back_and_forth binding_mode_indicator debuglog floating_minimum_size floating_maximum_size force_focus_wrapping force_xinerama force_display_urgency_hint hidden_state modifier new_float shmlog socket_path verbose mouse_warping strip_workspace_numbers focus_on_window_activation no_focus 26 | syn match i3IpcSocket "ipc[-_]socket" nextgroup=@i3String skipwhite 27 | 28 | " Command keywords 29 | syn keyword i3Command 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 30 | syn keyword i3Param 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 31 | syn match i3DashedParam '--\(release\|border\|whole-window\|toggle\)' skipwhite 32 | syn match i3NoStartupId '--no-startup-id' contained 33 | syn keyword i3WsSpecialParam next prev next_on_output prev_on_output back_and_forth current number 34 | syn keyword i3BordersSpecialParam none vertical horizontal both 35 | syn keyword i3ModeParam dock hide invisible skipwhite 36 | syn keyword i3GapsCommand gaps smart_gaps smart_borders 37 | syn keyword i3GapsParam inner outer current all set plus minus no_gaps 38 | 39 | " these are not keywords but we add them for consistency 40 | syn keyword i3PseudoParam no false inactive 41 | 42 | " Exec commands 43 | syn region i3ExecCommand keepend start='[^ \t]' end='$\|;' contained contains=i3ChainDelimiter,i3Var,i3NoStartupId 44 | syn match i3QuotedExecCommand '"[^"]\+"' contained 45 | syn keyword i3ExecKeyword exec exec_always i3bar_command nextgroup=i3QuotedExecCommand,i3ExecCommand skipwhite 46 | 47 | " Status command 48 | syn match i3StatusCommand ".*$" contained 49 | syn keyword i3StatusCommandKeyword status_command nextgroup=i3StatusCommand skipwhite 50 | 51 | " Font statement 52 | syn keyword i3FontStatement font nextgroup=@i3String skipwhite 53 | 54 | " Separator symbol 55 | syn keyword i3SeparatorSymbol separator_symbol nextgroup=@i3String skipwhite 56 | 57 | " Set statement 58 | syn match i3SetVar "\$\w\+" contained nextgroup=@i3String skipwhite 59 | syn keyword i3SetKeyword set set_from_resource nextgroup=i3SetVar skipwhite 60 | 61 | " Workspaces 62 | syn keyword i3WsKeyword workspace nextgroup=i3WsSpecialParam,@i3String skipwhite 63 | 64 | " Hide edge borders 65 | syn keyword i3BordersConfigCommand hide_edge_borders nextgroup=i3BordersSpecialParam skipwhite 66 | 67 | " Mode 68 | syn keyword i3ModeKeyword mode nextgroup=i3ModeParam,@i3String skipwhite 69 | 70 | " Comments 71 | syn keyword i3Todo contained TODO FIXME XXX NOTE 72 | syn match i3Comment "^\s*#.*$" contains=i3Todo 73 | 74 | " Error (at end of line) 75 | syn match i3Error ".*$" contained 76 | 77 | " Hex color code 78 | syn match i3ColorLast "#[0-9a-fA-F]\{6\}" contained nextgroup=i3Error skipwhite 79 | syn match i3Color2nd "#[0-9a-fA-F]\{6\}" contained nextgroup=i3ColorLast skipwhite 80 | syn match i3Color1st "#[0-9a-fA-F]\{6\}" contained nextgroup=i3Color2nd skipwhite 81 | 82 | syn match i3ColorDef1 "client\.background\|statusline\|background\|separator\|statusline" nextgroup=i3ColorLast skipwhite 83 | syn match i3ColorDef3 "client\.\(focused_inactive\|focused\|unfocused\|urgent\)\|inactive_workspace\|urgent_workspace\|focused_workspace\|active_workspace" nextgroup=i3Color1st skipwhite 84 | 85 | highlight link i3ChainDelimiter Operator 86 | highlight link i3Operators Operator 87 | 88 | highlight link i3ExecCommand Special 89 | highlight link i3QuotedExecCommand Special 90 | highlight link i3StatusCommand Special 91 | 92 | highlight link i3Param Constant 93 | highlight link i3PseudoParam Constant 94 | highlight link i3DashedParam Constant 95 | highlight link i3NoStartupId Constant 96 | highlight link i3Color1st Constant 97 | highlight link i3Color2nd Constant 98 | highlight link i3ColorLast Constant 99 | highlight link i3WsSpecialParam Constant 100 | highlight link i3BordersSpecialParam Constant 101 | highlight link i3ModeParam Constant 102 | highlight link i3GapsParam Constant 103 | 104 | highlight link i3Var Identifier 105 | highlight link i3SetVar Identifier 106 | 107 | highlight link i3KeyModifier Function 108 | 109 | highlight link i3SimpleString String 110 | highlight link i3QuotedString String 111 | highlight link i3WsName String 112 | highlight link i3QuotedWsName String 113 | highlight link i3SetValue String 114 | highlight link i3Font String 115 | 116 | highlight link i3ExecKeyword Keyword 117 | highlight link i3Command Keyword 118 | highlight link i3WsKeyword Keyword 119 | highlight link i3GapsCommand Keyword 120 | 121 | highlight link i3ColorDef1 Define 122 | highlight link i3ColorDef3 Define 123 | highlight link i3ConfigCommand Define 124 | highlight link i3IpcSocket Define 125 | highlight link i3SetKeyword Define 126 | highlight link i3ModeKeyword Define 127 | highlight link i3FontStatement Define 128 | highlight link i3SeparatorSymbol Define 129 | highlight link i3StatusCommandKeyword Define 130 | highlight link i3BordersConfigCommand Define 131 | 132 | highlight link i3Todo Todo 133 | highlight link i3Comment Comment 134 | highlight link i3Error Error 135 | --------------------------------------------------------------------------------