summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Monsen <haircut@gmail.com>2024-08-02 19:54:15 +0200
committerChristian Brabandt <cb@256bit.org>2024-08-02 19:58:00 +0200
commit0aa65b48fbe64e18a767b207802483026baecb5d (patch)
treebb42528aed3b00d7d424a768116a861cbca0c44a
parent22a22529afc9854dffaf32c742e4796ac6c9999b (diff)
patch 9.1.0655: filetype: goaccess config file not recognizedv9.1.0655
Problem: filetype: goaccess config file not recognized Solution: detect 'goaccess.conf' as goaccess filetype, also include a basic syntax and ftplugin (Adam Monsen) Add syntax highlighting for GoAccess configuration file. GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser. GoAccess home page: https://goaccess.io closes: #15414 Signed-off-by: Adam Monsen <haircut@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--.github/MAINTAINERS6
-rw-r--r--runtime/filetype.vim3
-rw-r--r--runtime/ftplugin/goaccess.vim14
-rw-r--r--runtime/syntax/goaccess.vim34
-rw-r--r--src/testdir/test_filetype.vim1
-rw-r--r--src/version.c2
6 files changed, 58 insertions, 2 deletions
diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index ee268f8802..04dd18fde2 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -160,11 +160,12 @@ runtime/ftplugin/gitconfig.vim @tpope
runtime/ftplugin/gitignore.vim @ObserverOfTime
runtime/ftplugin/gitrebase.vim @tpope
runtime/ftplugin/gitsendemail.vim @tpope
-runtime/ftplugin/graphql.vim @ribru17
-runtime/ftplugin/gyp.vim @ObserverOfTime
runtime/ftplugin/go.vim @dbarnett
+runtime/ftplugin/goaccess.vim @meonkeys
runtime/ftplugin/gomod.vim @yu-yk
runtime/ftplugin/gprof.vim @dpelle
+runtime/ftplugin/graphql.vim @ribru17
+runtime/ftplugin/gyp.vim @ObserverOfTime
runtime/ftplugin/haml.vim @tpope
runtime/ftplugin/hare.vim @selenebun
runtime/ftplugin/haredoc.vim @selenebun
@@ -446,6 +447,7 @@ runtime/syntax/gitolite.vim @sitaramc
runtime/syntax/gitrebase.vim @tpope
runtime/syntax/glsl.vim @gpanders
runtime/syntax/go.vim @bhcleek
+runtime/syntax/goaccess.vim @meonkeys
runtime/syntax/godoc.vim @dbarnett
runtime/syntax/gp.vim @KBelabas
runtime/syntax/gprof.vim @dpelle
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 676738078c..220b37173e 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -953,6 +953,9 @@ au BufNewFile,BufRead *.go setf go
au BufNewFile,BufRead Gopkg.lock setf toml
au BufRead,BufNewFile go.work setf gowork
+" GoAccess configuration
+au BufNewFile,BufRead goaccess.conf setf goaccess
+
" GrADS scripts
au BufNewFile,BufRead *.gs setf grads
diff --git a/runtime/ftplugin/goaccess.vim b/runtime/ftplugin/goaccess.vim
new file mode 100644
index 0000000000..fb557300c9
--- /dev/null
+++ b/runtime/ftplugin/goaccess.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: GoAccess configuration
+" Maintainer: Adam Monsen <haircut@gmail.com>
+" Last Change: 2024 Aug 1
+
+if exists('b:did_ftplugin')
+ finish
+endif
+
+let b:did_ftplugin = 1
+
+setl comments=:# commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/syntax/goaccess.vim b/runtime/syntax/goaccess.vim
new file mode 100644
index 0000000000..4ca8f6d921
--- /dev/null
+++ b/runtime/syntax/goaccess.vim
@@ -0,0 +1,34 @@
+" Vim syntax file
+" Language: GoAccess configuration
+" Maintainer: Adam Monsen <haircut@gmail.com>
+" Last Change: 2024 Aug 1
+" Remark: see https://goaccess.io/man#configuration
+"
+" The GoAccess configuration file syntax is line-separated settings. Settings
+" are space-separated key value pairs. Comments are any line starting with a
+" hash mark.
+" Example: https://github.com/allinurl/goaccess/blob/master/config/goaccess.conf
+"
+" This syntax definition supports todo/fixme highlighting in comments, and
+" special (Keyword) highlighting if a setting's value is 'true' or 'false'.
+"
+" TODO: a value is required, so use extreme highlighting (e.g. bright red
+" background) if a setting is missing a value.
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match goaccessSettingName '^[a-z-]\+' nextgroup=goaccessSettingValue
+syn match goaccessSettingValue '\s\+.\+$' contains=goaccessKeyword
+syn match goaccessComment "^#.*$" contains=goaccessTodo,@Spell
+syn keyword goaccessTodo TODO FIXME contained
+syn keyword goaccessKeyword true false contained
+
+hi def link goaccessSettingName Type
+hi def link goaccessSettingValue String
+hi def link goaccessComment Comment
+hi def link goaccessTodo Todo
+hi def link goaccessKeyword Keyword
+
+let b:current_syntax = "goaccess"
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 9c2a5e8e59..1e6c39ed99 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -300,6 +300,7 @@ def s:GetFilenameChecks(): dict<list<string>>
gnash: ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'],
gnuplot: ['file.gpi', '.gnuplot', 'file.gnuplot', '.gnuplot_history'],
go: ['file.go'],
+ goaccess: ['goaccess.conf'],
gomod: ['go.mod'],
gosum: ['go.sum', 'go.work.sum'],
gowork: ['go.work'],
diff --git a/src/version.c b/src/version.c
index 1ff7fdc628..a9fae005dc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 655,
+/**/
654,
/**/
653,