[vim/vim] YAML indent question (Issue #11944)

68 views
Skip to first unread message

097115

unread,
Feb 3, 2023, 4:10:38 PM2/3/23
to vim/vim, Subscribed

Let's say we have the following YAML file:

lorem:
  - ipsum: dolor
    sit:
      - amet
      - blandit

Now, let's open it with the command

vi -u NONE --clean 

...then place the cursor on the 4th line and press o:

...which is a bit disappointing since I have to go two spaces back to insert a new item.

Now let's open it with the command

vi -u NONE +'filetype plugin indent on' +'set autoindent' +'set smartindent'

...and then repeat the same operation, first :4, then o:

And that's something very different now, right? :)

The question is, why?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11944@github.com>

matveyt

unread,
Feb 5, 2023, 8:25:18 AM2/5/23
to vim/vim, Subscribed

The question is, why?

Because :filetype on only applies to files that were read afterwards.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11944/1417833577@github.com>

097115

unread,
Feb 5, 2023, 8:39:58 AM2/5/23
to vim/vim, Subscribed

Ah! You are right, @matveyt, thanks.

So, it just my testing was faulty, and this [additional] indenting when entering list items is OK and suits everybody, I guess?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11944/1417869960@github.com>

matveyt

unread,
Feb 5, 2023, 12:02:39 PM2/5/23
to vim/vim, Subscribed

That's a feature. If you type "minus" the line will be dedented automatically. See :help indentkeys-format.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11944/1418159075@github.com>

097115

unread,
Feb 5, 2023, 12:09:43 PM2/5/23
to vim/vim, Subscribed

Closed #11944 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/11944/issue_event/8440774258@github.com>

097115

unread,
Feb 5, 2023, 12:09:46 PM2/5/23
to vim/vim, Subscribed

Damn! Used auto de-indentation so many times and somehow never thought it will also work here.

Thanks :)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11944/1418167759@github.com>

Reply all
Reply to author
Forward
0 new messages