From 6aa3658c10ba12c41930feb9814c3a60dd46f718 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Sun, 2 May 2021 18:11:17 -0700 Subject: [PATCH] Improve handling of comments and doc comments Doc comments are now properly formatted with `gq` and `J`. For example, on this input text: ``` /// one /// two ``` pressing `J` on the top line used to result in `/// one / two`, and now results in `/// one two`. Conversely, on this input text: ``` /// this long line exceeds the text width ``` pressing `gqgq` with a `textwidth` of 20 now yields: ``` /// this long line /// exceeds the text /// width ``` instead of: ``` /// this long line //exceeds the text //width ``` Furthermore, adding a new line to an existing comment, by pressing `o` in normal mode or `Enter` in insert mode, now automatically inserts the appropriate comment leader (`//` or `///`). wchargin-branch: comment-doc-and-leader wchargin-source: 93a80fff55389ecf7f5a0ae67850bdc40b5f0346 --- ftplugin/solidity.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ftplugin/solidity.vim b/ftplugin/solidity.vim index 9cb4ab3d..47bc84db 100644 --- a/ftplugin/solidity.vim +++ b/ftplugin/solidity.vim @@ -1 +1,3 @@ setlocal commentstring=//\ %s +setlocal comments=s1:/*,mb:*,ex:*/,:///,:// +setlocal formatoptions+=croqn