简体   繁体   中英

Vim auto indent private keyword

I'm learning Vim (I'm using gVim)
I need to do the following: Suppose I typed this:

class MyClass {
    private
}

After typing the : after private, result should be:

class MyClass {
private:
}

How can I do automate that behaviour?
I tried with

:imap private: <Home><Delete>

But I feel it's not an elegant solution at all. I already installed c.vim by Fritz Mehner.

set cindent
set cinoptions=g-1

Reference: http://vimdoc.sourceforge.net/htmldoc/indent.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM