]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(groff,nroff): improve ftplugin
authorEisuke Kawashima <e-kwsm@users.noreply.github.com>
Thu, 24 Apr 2025 20:26:02 +0000 (22:26 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 24 Apr 2025 20:26:02 +0000 (22:26 +0200)
- set options in ftplugin but not in syntax
- implement ftplugin/groff.vim (wrapper of ftplugin/nroff.vim)

closes: #17174

Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
.github/MAINTAINERS
runtime/ftplugin/groff.vim [new file with mode: 0644]
runtime/ftplugin/nroff.vim
runtime/syntax/nroff.vim

index 132585e83cfc03dcd55fdb0a208a3b53dec0f445..13c45daf82d6dc6bfeaf2dd333e92fc158c437e2 100644 (file)
@@ -187,6 +187,7 @@ runtime/ftplugin/goaccess.vim               @meonkeys
 runtime/ftplugin/gomod.vim             @yu-yk
 runtime/ftplugin/gprof.vim             @dpelle
 runtime/ftplugin/graphql.vim           @jparise
+runtime/ftplugin/groff.vim             @e-kwsm
 runtime/ftplugin/gyp.vim               @ObserverOfTime
 runtime/ftplugin/haml.vim              @tpope
 runtime/ftplugin/hare.vim              @selenebun
diff --git a/runtime/ftplugin/groff.vim b/runtime/ftplugin/groff.vim
new file mode 100644 (file)
index 0000000..3ebfa03
--- /dev/null
@@ -0,0 +1,15 @@
+" Vim syntax file
+" Language:  groff(7)
+" Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com )
+" Last Change: 2025 Apr 24
+
+if exists('b:did_ftplugin')
+  finish
+endif
+
+let b:nroff_is_groff = 1
+
+runtime! ftplugin/nroff.vim
+
+let b:undo_ftplugin .= '| unlet! b:nroff_is_groff'
+let b:did_ftplugin = 1
index 1c6d4ebc799aa6915e8d4ad83c7693064c4c9727..cd2680ef584a589f6792033495c1698df942c338 100644 (file)
@@ -8,6 +8,7 @@
 "      2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring' #14843)
 "      2025 Feb 12 by Wu, Zhenyu <wuzhenyu@ustc.edu> (matchit configuration #16619)
 "      2025 Apr 16 by Eisuke Kawashima (cpoptions #17121)
+"      2025 Apr 24 by Eisuke Kawashima (move options from syntax to ftplugin #17174)
 
 if exists("b:did_ftplugin")
   finish
@@ -22,7 +23,17 @@ setlocal comments=:.\\\"
 setlocal sections+=Sh
 setlocal define=.\s*de
 
-let b:undo_ftplugin = 'setlocal commentstring< comments< sections< define<'
+if get(b:, 'preprocs_as_sections')
+  setlocal sections=EQTSPS[\ G1GS
+endif
+
+let b:undo_ftplugin = 'setlocal commentstring< comments< sections& define<'
+
+if get(b:, 'nroff_is_groff')
+  " groff_ms exdented paragraphs are not in the default paragraphs list.
+  setlocal paragraphs+=XP
+  let b:undo_ftplugin .= ' paragraphs&'
+endif
 
 if exists('loaded_matchit')
   let b:match_words = '^\.\s*ie\>:^\.\s*el\>'
index 5667042515586b7053f349d62c44d3ac356d6361..fec966f3345d39ce702caaa52ea0f2ff78a2ed5f 100644 (file)
@@ -4,6 +4,7 @@
 " Previous Maintainer: Pedro Alejandro López-Valencia <palopezv@gmail.com>
 " Previous Maintainer: Jérôme Plût <Jerome.Plut@ens.fr>
 " Last Change: 2021 Mar 28
+"      2025 Apr 24 by Eisuke Kawashima (move options from syntax to ftplugin #17174)
 "
 " {{{1 Todo
 "
@@ -40,19 +41,6 @@ if exists("nroff_space_errors")
        syn match nroffError /\s\+$/
        syn match nroffSpaceError /[.,:;!?]\s\{2,}/
 endif
-"
-"
-" {{{1 Special file settings
-"
-" {{{2  ms exdented paragraphs are not in the default paragraphs list.
-"
-setlocal paragraphs+=XP
-"
-" {{{2 Activate navigation to preprocessor sections.
-"
-if exists("b:preprocs_as_sections")
-       setlocal sections=EQTSPS[\ G1GS
-endif
 
 " {{{1 Escape sequences
 " ------------------------------------------------------------