summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-11-02 15:44:43 +0100
committerChristian Brabandt <cb@256bit.org>2024-11-02 15:44:43 +0100
commit84b5b1c660beb2f9e27de70687e41d39a023ae81 (patch)
tree65e9ad2ef0d8475ba0536c605a27e2d39ba656ba
parent26113e5ae3c4762ab718d5f006afa71f67e6f459 (diff)
patch 9.1.0826: filetype: sway files are not recognizedv9.1.0826
Problem: filetype: sway files are not recognized Solution: detect '*.sw' files as sway filetype, include a filetype plugin (Riley Bruins) References: https://github.com/FuelLabs/sway. Comments taken from their syntax documentation. File extension taken from the same documentation/GitHub's own recognition of these file types closes: #15973 Signed-off-by: Riley Bruins <ribru17@hotmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--.github/MAINTAINERS1
-rw-r--r--runtime/filetype.vim3
-rw-r--r--runtime/ftplugin/sway.vim15
-rw-r--r--src/testdir/test_filetype.vim1
-rw-r--r--src/version.c2
5 files changed, 22 insertions, 0 deletions
diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS
index e24fbc4c8c..ea342ef7a0 100644
--- a/.github/MAINTAINERS
+++ b/.github/MAINTAINERS
@@ -263,6 +263,7 @@ runtime/ftplugin/squirrel.vim @ribru17
runtime/ftplugin/ssa.vim @ObserverOfTime
runtime/ftplugin/sshdconfig.vim @jiangyinzuo
runtime/ftplugin/svelte.vim @igorlfs
+runtime/ftplugin/sway.vim @ribru17
runtime/ftplugin/swayconfig.vim @jamespeapen
runtime/ftplugin/systemverilog.vim @Kocha
runtime/ftplugin/swig.vim @jmarrec
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 7b0014d764..36461f69f8 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -2430,6 +2430,9 @@ au BufNewFile,BufRead *.sml setf sml
" Sratus VOS command macro
au BufNewFile,BufRead *.cm setf voscm
+" Sway (programming language)
+au BufNewFile,BufRead *.sw setf sway
+
" Swift
au BufNewFile,BufRead *.swift,*.swiftinterface setf swift
au BufNewFile,BufRead *.swift.gyb setf swiftgyb
diff --git a/runtime/ftplugin/sway.vim b/runtime/ftplugin/sway.vim
new file mode 100644
index 0000000000..35970b257c
--- /dev/null
+++ b/runtime/ftplugin/sway.vim
@@ -0,0 +1,15 @@
+" Vim filetype plugin
+" Language: Sway
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Nov 01
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl commentstring=//\ %s
+" From Rust comments
+setl comments=s0:/*!,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,://
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 777f908fcb..050ff5f391 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -729,6 +729,7 @@ def s:GetFilenameChecks(): dict<list<string>>
svelte: ['file.svelte'],
svg: ['file.svg'],
svn: ['svn-commitfile.tmp', 'svn-commit-file.tmp', 'svn-commit.tmp'],
+ sway: ['file.sw'],
swayconfig: ['/home/user/.sway/config', '/home/user/.config/sway/config', '/etc/sway/config', '/etc/xdg/sway/config'],
swift: ['file.swift', 'file.swiftinterface'],
swiftgyb: ['file.swift.gyb'],
diff --git a/src/version.c b/src/version.c
index 891327afdd..493de72f68 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 */
/**/
+ 826,
+/**/
825,
/**/
824,