Saturday, June 28, 2025

Re: Indent block inline with other blocks is too far

Noice, good mana and potions your way :-)

On Saturday, 28 June 2025 at 10:41:47 UTC+2 dva...@internode.on.net wrote:
On 27.06.25 06:25, K otgc wrote:
> I ended up using the below, but unsure which of the 3 choices is easiest.
> The Tab doesn't indent a highlighted block, so I need the Shift+> to indent
> the highlighted lines. Fortunately Shift+> seems to use the Tab spacing
> amount.
> set expandtab
> set tabstop=2
> set shiftwidth=2

They are not separate choices, but elements of one choice.
set  tabstop=2  shiftwidth=2
changes from default to a 2-space width, while
set expandtab
avoids it all coming undone when you share the file with someone with some other tabstop setting. It does that by inserting 2 spaces instead of a tab, thus protecting your code from foreign interference.

set autoindent
is productivity enhancing, as you can then hit <tab> on the first line inside a block to indent it, and subsequent lines in the block will automatically hold that indentation, without you having to find the mouse and faff with it.

A quick way to outdent after the block is to hit ^D on the first line after, e.g. the closing '}'in C. It isn't even necessary to remember to do it before typing the post-block line - the ^D also outdents any time while you're still in insert mode on the line.

In this way, you type your way through the indented block, then back out again, without moving your hands from the keyboard - no slowing for the curve, at all.

Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/075a24c8-e4b4-4477-a639-951e35208947n%40googlegroups.com.

No comments: