Skip to content

Commit

Permalink
contrib/vim: match profile files more broadly
Browse files Browse the repository at this point in the history
Currently it only sets the appropriate filetype for files in
`/etc/firejail` and `~/.config/firejail`.

With this commit, the firejail filetype should also be set when opening
`etc/inc/*.inc`, for example, as long as there is a "firejail" directory
somewhere before that (such as in `/foo/firejail/bar/etc/inc/*.inc`).

Note: At least `*/firejail/*.inc` needs to force the match (by using
`set filetype` rather than `setfiletype`), or else the default vim
checks take precedence (and the filetype for all files in
`etc/inc/*.inc` gets set to `pov`).

Fixes #4319.

Relates to #2679.

Co-authored-by: rusty-snake <[email protected]>
  • Loading branch information
kmk3 and rusty-snake committed Jun 10, 2023
1 parent 2f87ae1 commit 6273865
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contrib/vim/ftdetect/firejail.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
" Default paths
autocmd BufNewFile,BufRead /etc/firejail/*.inc setfiletype firejail
autocmd BufNewFile,BufRead /etc/firejail/*.local setfiletype firejail
autocmd BufNewFile,BufRead /etc/firejail/*.profile setfiletype firejail
autocmd BufNewFile,BufRead ~/.config/firejail/*.inc setfiletype firejail
autocmd BufNewFile,BufRead ~/.config/firejail/*.local setfiletype firejail
autocmd BufNewFile,BufRead ~/.config/firejail/*.profile setfiletype firejail

" Arbitrary paths
autocmd BufNewFile,BufRead */firejail/*.inc set filetype=firejail
autocmd BufNewFile,BufRead */firejail/*.local set filetype=firejail
autocmd BufNewFile,BufRead */firejail/*.profile set filetype=firejail

0 comments on commit 6273865

Please sign in to comment.