From 1fed4412e4ba5f38a8011c8a05f3f4ddc1c441cb Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 25 Apr 2025 10:18:42 +0200 Subject: [PATCH] vim-patch:e36a931: runtime(groff,nroff): improve ftplugin - set options in ftplugin but not in syntax - implement ftplugin/groff.vim (wrapper of ftplugin/nroff.vim) closes: vim/vim#17174 https://github.com/vim/vim/commit/e36a931d9b67110b918604d4e2ebe8aa643ecc03 Co-authored-by: Eisuke Kawashima --- runtime/ftplugin/groff.vim | 15 +++++++++++++++ runtime/ftplugin/nroff.vim | 13 ++++++++++++- runtime/syntax/nroff.vim | 14 +------------- 3 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 runtime/ftplugin/groff.vim diff --git a/runtime/ftplugin/groff.vim b/runtime/ftplugin/groff.vim new file mode 100644 index 0000000000..3ebfa03c6e --- /dev/null +++ b/runtime/ftplugin/groff.vim @@ -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 diff --git a/runtime/ftplugin/nroff.vim b/runtime/ftplugin/nroff.vim index 1c6d4ebc79..cd2680ef58 100644 --- a/runtime/ftplugin/nroff.vim +++ b/runtime/ftplugin/nroff.vim @@ -8,6 +8,7 @@ " 2024 May 24 by Riley Bruins ('commentstring' #14843) " 2025 Feb 12 by Wu, Zhenyu (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\>' diff --git a/runtime/syntax/nroff.vim b/runtime/syntax/nroff.vim index 5667042515..fec966f334 100644 --- a/runtime/syntax/nroff.vim +++ b/runtime/syntax/nroff.vim @@ -4,6 +4,7 @@ " Previous Maintainer: Pedro Alejandro López-Valencia " Previous Maintainer: Jérôme Plût " 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 " ------------------------------------------------------------