On Sat, Jan 3, 2015 at 1:35 PM, Eric Christopherson
<[email protected]> wrote:
> On Sat, Jan 03, 2015, kamaraju kusumanchi wrote:
>> I am finding that the default indentation settings used for perl code
>> are not very intuitive.
>>
>> After spending some time scourging through help files, google etc., I
>> arrived at these
>>
>> autocmd FileType perl set autoindent | set smartindent
>> autocmd FileType perl inoremap # X ^H#
>
> What is the purpose of the second autocmd?
>

I used it to get the comment(s) indentation right. With out that if I
write a comment after a subroutine definition, the comment would be
moved to the first column.

For example, say I have

sub read_file()
{
    # some comment here

this would be changed as

sub read_file()
{
# some comment here

This is explained in ":help smartindent" as follows

    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.

hope that helps
raju

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to