Tip #644: restoring indent for '#'
tip karma |
Rating 16/4, Viewed by 534
|
created: |
|
January 27, 2004 1:50 |
|
complexity: |
|
basic |
author: |
|
stsi |
|
as of Vim: |
|
6.0 |
In 'smatrindent' mode '#' removes the indent if it is the first char on the line.
Very annoying for me.
From Vim's help:
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.
This helps, but it failes to work when placed in ~/.vimrc.
The fillowing mapping work in any case:
:inoremap # a#^Oh^Ox^OA, where ^O is entered with CTRL-V CTRL-O.
<<Disable built-in command |
Enabling Windows shortcuts (eg alt+space, F10 etc) for gvim window >>
Additional Notes
|