Skip to content

Commit 27f5136

Browse files
eekhofchrisbra
authored andcommitted
runtime(mail): add commentstring '> %s' to ftplugin
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent e3fed48 commit 27f5136

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

runtime/doc/filetype.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*filetype.txt* For Vim version 9.1. Last change: 2024 Dec 04
1+
*filetype.txt* For Vim version 9.1. Last change: 2025 Feb 20
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -762,7 +762,7 @@ Options:
762762
You can also format quoted text with |gq|.
763763

764764
Local mappings:
765-
<LocalLeader>q or \\MailQuote
765+
<LocalLeader>q or \MailQuote
766766
Quotes the text selected in Visual mode, or from the cursor position
767767
to the end of the file in Normal mode. This means "> " is inserted in
768768
each line.

runtime/ftplugin/mail.vim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim filetype plugin file
22
" Language: Mail
33
" Maintainer: The Vim Project <https://github.com/vim/vim>
4-
" Last Change: 2023 Aug 10
4+
" Last Change: 2025 Feb 20
55
" Former Maintainer: Bram Moolenaar <[email protected]>
66

77
" Only do this when not done yet for this buffer
@@ -10,7 +10,7 @@ if exists("b:did_ftplugin")
1010
endif
1111
let b:did_ftplugin = 1
1212

13-
let b:undo_ftplugin = "setl modeline< tw< fo< comments<"
13+
let b:undo_ftplugin = "setl modeline< tw< fo< comments< commentstring<"
1414

1515
" Don't use modelines in e-mail messages, avoid trojan horses and nasty
1616
" "jokes" (e.g., setting 'textwidth' to 5).
@@ -24,6 +24,9 @@ endif
2424
" Set 'formatoptions' to break text lines and keep the comment leader ">".
2525
setlocal fo+=tcql
2626

27+
" Set commentstring to quoting sign ">" so comment shortcuts can be used to
28+
" edit quoted parts of mail
29+
setlocal commentstring=>\ %s
2730
" Add n:> to 'comments, in case it was removed elsewhere
2831
setlocal comments+=n:>
2932

0 commit comments

Comments
 (0)