Skip to content

Conversation

zeertzjq
Copy link
Member

vim-patch:9.1.1544: :retab cannot be limited to indentation only

Problem: :retab cannot be limited to indentation only
Solution: add the optional -indentonly parameter
(Hirohito Higashi)

closes: vim/vim#17730

vim/vim@836e54f

Co-authored-by: Hirohito Higashi h.east.727@gmail.com

@zeertzjq zeertzjq changed the title vim-patch:9.1.1544 vim-patch:9.1.1544: :retab cannot be limited to indentation only Jul 14, 2025
@github-actions github-actions bot added the vim-patch See https://neovim.io/doc/user/dev_vimpatch.html label Jul 14, 2025
@justinmk
Copy link
Member

justinmk commented Jul 14, 2025

Ex command options are supposed to start with "+". I confirmed this with Bram. Why is this one using - ? @h-east @chrisbra

@h-east
Copy link
Contributor

h-east commented Jul 15, 2025

Ex command options are supposed to start with "+".

What? Are you perhaps referring to :h +cmd? That's a command, not an option, and it's specific to buffer-manipulating Ex commands.

Now, could you explain the following point?

:command -bang -addr=0 -complete=file -range ...
:delcommand -buffer ...
:mkspell -ascii ...

In all cases, the code was written by Bram.

$ git blame -L 1269,1270 usercmd.c
ac9fb18020 (Bram Moolenaar 2019-04-27 13:04:13 +0200 1269)     // Check for attributes
ac9fb18020 (Bram Moolenaar 2019-04-27 13:04:13 +0200 1270)     while (*p == '-')

$ git blame -L 1403,1403 usercmd.c
bdcba24d85 (Bram Moolenaar 2021-09-12 20:58:02 +0200 1403)     if (STRNCMP(arg, "-buffer", 7) == 0 && VIM_ISWHITE(arg[7]))

$ git blame -L 5460,5460 spellfile.c
9ccfebddc3 (Bram Moolenaar 2016-07-19 16:39:08 +0200 5460)     if (STRNCMP(arg, "-ascii", 6) == 0)

I confirmed this with Bram.

I understand you're busy, but it would be helpful if you could provide a link.

@chrisbra
Copy link
Contributor

Ex command options are supposed to start with "+". I confirmed this with Bram. Why is this one using - ? @h-east @chrisbra

I thought about this while merging, but both +opt and ++cmd have already a very specific meaning that is different to the proposed -indentonly option (only relevant for the :retab command). So I felt it makes sense to have -opt specific for a particular command (and it aligns with Unix command line options).

@justinmk
Copy link
Member

Are you perhaps referring to :h +cmd? That's a command, not an option

I meant ++. See vim/vim#4100 (comment)

Not many Ex commands use a dash for an option. ... More commands use the ++option form

Regarding :command -bang -addr=0 -complete=file -range ... and :mkspell, those are old. But I can't explain :delcommand -buffer since it was apparently introduced in 2021.

I thought about this while merging, but both ++opt and +cmd have already a very specific meaning that is different to the proposed -indentonly

++opt is also used for :autocmd, not just the specific things mentioned at :help ++opt.

For :retab it might not matter, but it sure would be nice to settle on one convention going forward, instead of oscillating.

@chrisbra
Copy link
Contributor

But I can't explain :delcommand -buffer since it was apparently introduced in 2021.

I believe that's because it was not possible to delete buffer-local commands before.

@h-east
Copy link
Contributor

h-east commented Jul 16, 2025

What are you worried about? I think it's already clear enough:

  • Ex commands that take filenames or directory names as arguments (mainly buffer-manipulating) use ++opt.
  • All others use -opt.

@justinmk
Copy link
Member

justinmk commented Jul 17, 2025

:mkspell takes a filename, so that "clear enough" rule doesn't apply. I'm "worried about" having a consistent convention. Aren't you?

Anyway, not a blocker since there does not seem to be interest in this.

@h-east
Copy link
Contributor

h-east commented Jul 17, 2025

  • Ex commands that take filenames or directory names as arguments (mainly buffer-manipulating) use ++opt.
  • All others use -opt.

The above is a statement of intent as a guideline for the future.
The past mistake (:mkspell) can't be helped. In Neovim you can fix it, but Vim values backward compatibility, so we'll leave it as is. 😉

@zeertzjq
Copy link
Member Author

:mkspell is not a buffer manipulation command.

@zeertzjq zeertzjq force-pushed the vim-9.1.1544 branch 2 times, most recently from 2d69e4b to 731d970 Compare July 18, 2025 00:38
Problem:  :retab cannot be limited to indentation only
Solution: add the optional -indentonly parameter
          (Hirohito Higashi)

closes: vim/vim#17730

vim/vim@836e54f

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
@zeertzjq zeertzjq enabled auto-merge (squash) July 18, 2025 01:17
@zeertzjq zeertzjq merged commit 7631302 into neovim:master Jul 18, 2025
53 of 54 checks passed
@zeertzjq zeertzjq deleted the vim-9.1.1544 branch July 18, 2025 01:31
@h-east
Copy link
Contributor

h-east commented Jul 18, 2025

:mkspell is not a buffer manipulation command.

Do you have poor eyesight? It literally says mainly.

@zeertzjq
Copy link
Member Author

zeertzjq commented Jul 18, 2025

What's the problem? :mkspell does not use ++opt anyway, so "mainly" does not matter here.

@h-east
Copy link
Contributor

h-east commented Jul 18, 2025

So why did you bother writing something that everyone already knows?

:mkspell is not a buffer manipulation command.

Come on, understand the flow of the story.

:mkspell is not a buffer manipulation command, but it can take a file path as an argument, so according to Bram's argument, ++opt should have been specified. However, Bram mistakenly adopted -opt in 2016.
The above is a thing of the past, so we will leave it alone in Vim.
From now on, We will choose ++opt or -opt according to the following policy.

Ex commands that take filenames or directory names as arguments (mainly buffer-manipulating) use ++opt.
All others use -opt.

That's the end of the story and everyone is happy with it, right?

I never thought I'd have to explain this to you...

@zeertzjq
Copy link
Member Author

zeertzjq commented Jul 18, 2025

I was just trying to find a way to explain the current behavior of :mkspell. You don't have to explain anything.

@gpanders
Copy link
Member

:mkspell is not a buffer manipulation command.

Do you have poor eyesight? It literally says mainly.

@h-east Rudeness and insults are not acceptable here. Cut it out.

@h-east
Copy link
Contributor

h-east commented Jul 18, 2025

@gpanders
Thank you for your concern.
But it's none of your business.
I've known him (@zeertzjq ) in the Vim community for over a year, and I know he's a very smart guy, and I respect him.
He replied to what I thought was a finished story, so I dug deeper, including the possibility that I might be wrong.
I'm in no way making fun of him.
Thanks.

@clason
Copy link
Member

clason commented Jul 18, 2025

But it's none of your business.

As maintainers, this is very much our business -- civility of discourse matters a lot here. Neovim is an open project that values all its contributors, and it is very important to us to maintain a professional tone in all our public interactions. Even though you two know each other, your exchange here is seen by and influences many other visitors, who may be put off by your tone. How you talk to each other in a private chat or another mailing list is between you two, but here general rules apply (to everyone).

@neovim neovim locked as off-topic and limited conversation to collaborators Jul 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

vim-patch See https://neovim.io/doc/user/dev_vimpatch.html

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants