Hi Folks,
When I comment out a line, vim left justifies the line, but I want the indentation to say exactly where it is! Does anybody now when vim setting is responsible for either 1) Causing the shifty left justification of comments, so I can delete it 2) Suppresses this shifty left justification that is maybe part of some other setting, which maybe does things I want.
I just want it to stop! (-:
Thanks for the help,
On Mon, Feb 06, 2023 at 10:41:37AM -0800, Chris Miller wrote:
Hi Folks, When I comment out a line, vim left justifies the line, but I want the indentation to say exactly where it is! Does anybody now when vim setting is responsible for either
- Causing the shifty left justification of comments, so I can delete
it 2) Suppresses this shifty left justification that is maybe part of some other setting, which maybe does things I want. I just want it to stop! (-:
I often get stuck with visual mode in vi and the crazy one tab means indent the next line with a tab too and then crazy stair step ensues!
What language are you commenting in?
O'Reilly has a new edition!
Learning the vi and Vim Editors, 8th Edition https://www.oreilly.com/library/view/learning-the-vi/9781492078791/
Maybe try emacs? M-x tutorial
Hi Linus, Gary, and Brian,
Hi Folks,
When I comment out a line, vim left justifies the line, but I want the indentation to say exactly where it is! Does anybody now when vim setting is responsible for either
- Causing the shifty left justification of comments, so I can delete it
- Suppresses this shifty left justification that is maybe part of some other
setting, which maybe does things I want.
Well, the mystery is partly solved. The VIM setting that I need to fix is apparently "SmartIndent": Do smart autoindenting when starting a new line. Works for C-like programs, but can also be used for other languages. 'cindent' does something like this, works better in most cases, but is more strict, see |C-indenting|. When 'cindent' is on or 'indentexpr' is set, setting 'si' has no effect. 'indentexpr' is a more advanced alternative. Normally 'autoindent' should also be on when using 'smartindent'. An indent is automatically inserted: - After a line ending in '{'. - After a line starting with a keyword from 'cinwords'. - Before a line starting with '}' (only with the "O" command). When typing '}' as the first character in a new line, that line is given the same indent as the matching '{'. When typing '#' as the first character in a new line, the indent for that line is removed, the '#' is put in the first column. The indent is restored for the next line. If you don't want this, use this mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H. When using the ">>" command, lines starting with '#' are not shifted right. NOTE: This option is reset when 'compatible' is set. This option is reset when 'paste' is set and restored when 'paste' is reset. And look at that! The solution is right there! Only I can't get it to work. I just goes merrily along putting hashes in the first column! Maybe the easiest solution is to map a key to "s/^#/^I#/"
Thanks for the help,