vho
vho

Reputation: 1141

ignores comments when reformatting tcl code indentation

I have try to use this plugin: http://www.vim.org/scripts/script.php?script_id=1717.

But indented code in GVim(for vim it work as I expected) is not looks as I have expect.

For example when I indent this code:

if { $cond1 != 1 }  {
    #comment 
    if { $cont2 != 2 }  {
        return
    } else {
    #comment 2
        return
    }
} 

It's become:

if { $cond1 != 1 }  {
#comment 
    if { $cont2 != 2 }  {
        return
    } else {
#comment 2
        return
    }
} 

Is it possible to ignore comments when indenting the code?

For same reason whenever I type # the cursor position changed to the start of the line.

Upvotes: 1

Views: 335

Answers (1)

glenn jackman
glenn jackman

Reputation: 247210

I have this in my .vimrc, it may help you here

" the following line prevents forcing # to be inserted in column 1
inoremap # X<BS>#

If you use compatible, then ensure < is not in cpoptions: cpoptions-=<

Upvotes: 1

Related Questions