Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3d152e4
Edited colors + minor changes, not tested.
litoj May 9, 2021
c0736bd
Improved highlighting.
litoj May 10, 2021
4fdc0af
Fixed missing variable highlighting.
litoj May 10, 2021
25b71a1
Fixed missing highlighting of bind keywords.
litoj May 10, 2021
179f3a1
Added more missing keywords.
litoj May 10, 2021
b6b5c3f
Added 'height' to the block highlights.
litoj May 12, 2021
75e640e
Improved highlighting in blocks.
litoj May 25, 2021
b191b1d
Made color bindings as in original.
litoj Aug 6, 2021
e328ccf
Merge branch 'master' into master
litoj Aug 6, 2021
3ef9e53
Hopefully working now
litoj Nov 18, 2021
e1624fd
Changed --options to colorize as parameters
litoj Jan 21, 2022
7d2dcff
updated visuals
litoj Jan 26, 2022
8151c3a
removed alpha from the screenshot
litoj Feb 20, 2022
fe0d068
fixed highlighting of keycombos
litoj Jun 16, 2022
98c059d
Improved multiline support
litoj Jun 20, 2022
a18f3b3
updated screenshot
litoj Jun 20, 2022
c196e5f
updated to highlight include keyword
litoj Jul 24, 2022
a372659
added 'show' for scratchpad
litoj Jul 24, 2022
8bd0462
fixed string line continuation
litoj Sep 23, 2022
a0fc2c0
added support for majority of sway config
litoj Oct 17, 2022
866b2f4
update to latest i3 and sway specification
litoj Dec 19, 2022
d7b0c6e
syntax(sway): updated possible bar subcommands
litoj Sep 9, 2023
a8fc052
refactor!: structure overhaul
litoj Sep 12, 2023
badbf26
chore: cleanup + exec swaymsg/i3-msg recursive highlighting
litoj Sep 14, 2023
56797ac
fix(versioning)
litoj Sep 26, 2023
a084e5f
docs: typo + clarifications
litoj Oct 3, 2023
4c9b8c7
fix: string matching
litoj Oct 23, 2023
017fa4f
Merge branch 'master' of github.com:JosefLitos/i3config.vim
litoj Oct 23, 2023
3039d05
fix: added comments in sway blocks
litoj Oct 25, 2023
b0d36ef
fix: string seethrough for shell regions
litoj Oct 26, 2023
9667d1d
refactor(groups): simplify structure by using `@clusters`
litoj Oct 31, 2023
4b47fd8
fix(syntax): multiline `set`
litoj Apr 12, 2024
900ea11
fix(swayconfig): more picky orphan detection
litoj Apr 13, 2024
0d685dd
feat: use `nextgroup`
litoj Apr 13, 2024
3ccf7d6
fixup: wrong bindswitch group name
litoj Apr 13, 2024
ce18f34
ref: nextgroup + separate config&runtime command variants
litoj Apr 14, 2024
a6aa778
fix(rename): wrong workspace highlight
litoj Apr 15, 2024
5264f01
fix: allow indent for all commands
litoj May 12, 2024
5285a1a
fix: indentation issues
litoj Aug 6, 2024
ea13765
sway/i3config: fix shell param highlight
litoj Sep 27, 2025
ba3e7f6
fix(i3): support comments in shell commands
litoj Oct 3, 2025
1cd20a5
feat: implemented corrected version of vim/vim#18293
litoj Nov 24, 2025
287009a
fix: mismatch extra opts syntax keyword name with highlight name
bruhtus Nov 25, 2025
52a7d6f
feat: link highlight popup fullscreen opts extra with opts
bruhtus Nov 25, 2025
fb07dc6
Merge pull request #3 from bruhtus/master
litoj Nov 26, 2025
4015805
ref: Unify identifier matching and allow identifier for sway bar
litoj Nov 28, 2025
db203bc
docs: update i3config maintainer
litoj Dec 6, 2025
b6107b6
swayonfig: add additional criteria and hdr
litoj Apr 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 35 additions & 102 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

<http://i3wm.org/docs/userguide.html#configuring>
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
<https://github.com/PotatoesMaster/i3-vim-syntax>
+ vim-scripts/edifact.vim
<https://github.com/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: <https://github.com/mboughaba/i3config.vim>
Make sure to add a line to cover your test in `test.swayconfig`.

## License

Expand Down
6 changes: 3 additions & 3 deletions ftdetect/i3config.vim
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion ftplugin/i3config.vim

This file was deleted.

Binary file removed i3config.vim.gif
Binary file not shown.
Loading