]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(mail): add commentstring '> %s' to ftplugin
authorLucas Eekhof <105216949+eekhof@users.noreply.github.com>
Thu, 20 Feb 2025 21:32:07 +0000 (22:32 +0100)
committerChristian Brabandt <cb@256bit.org>
Thu, 20 Feb 2025 21:32:07 +0000 (22:32 +0100)
The new native commenting functionality is currently not used when
editing mail. One could reasonably expect it to change the "quote" state
of any given line in the mail (i.e. the preceding ">"), which would be
very handy and feel natural when editing mail. Especially since the
current file already uses "setlocal comments+=n:>".

Solution: Add commentstring to `> %s` to be used in files of type mail.

closes: #16669

Signed-off-by: Lucas Eekhof <105216949+eekhof@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/filetype.txt
runtime/ftplugin/mail.vim

index cbf038afd36d022d7abe4fe4cdc679edb705e5e0..7f338a561887f2bb5daffefbcfd5c60dd59599d1 100644 (file)
@@ -1,4 +1,4 @@
-*filetype.txt* For Vim version 9.1.  Last change: 2024 Dec 04
+*filetype.txt* For Vim version 9.1.  Last change: 2025 Feb 20
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -762,7 +762,7 @@ Options:
                You can also format quoted text with |gq|.
 
 Local mappings:
-<LocalLeader>q   or   \\MailQuote
+<LocalLeader>q   or   \MailQuote
        Quotes the text selected in Visual mode, or from the cursor position
        to the end of the file in Normal mode.  This means "> " is inserted in
        each line.
index 3cef84f52832b13be884070e0555ecc0afec4a26..de88f4d1e84cdec4ac1980ad2cf7ac16014a04f5 100644 (file)
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language:    Mail
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2025 Feb 20
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " Only do this when not done yet for this buffer
@@ -10,7 +10,7 @@ if exists("b:did_ftplugin")
 endif
 let b:did_ftplugin = 1
 
-let b:undo_ftplugin = "setl modeline< tw< fo< comments<"
+let b:undo_ftplugin = "setl modeline< tw< fo< comments< commentstring<"
 
 " Don't use modelines in e-mail messages, avoid trojan horses and nasty
 " "jokes" (e.g., setting 'textwidth' to 5).
@@ -24,6 +24,9 @@ endif
 " Set 'formatoptions' to break text lines and keep the comment leader ">".
 setlocal fo+=tcql
 
+" Set commentstring to quoting sign ">" so comment shortcuts can be used to
+" edit quoted parts of mail
+setlocal commentstring=>\ %s
 " Add n:> to 'comments, in case it was removed elsewhere
 setlocal comments+=n:>