Configuring Vim for C++

后端 未结 3 1354
清歌不尽
清歌不尽 2020-12-04 04:13

I would like to make vim my C++ editor. I have very little experience working with it and need help in configuring vim to work with C++. I need such features as

3条回答
  •  时光取名叫无心
    2020-12-04 04:47

    I'm using vim as my C++ editor, however I'm not using many 'exotic' stuff.

    • Regarding completion, I'm using the non-contextual ^P and ^N.
    • I have a bunch of user defined abbreviations for my C++ use, for example :

      abbreviate bptr boost::shared_ptr
      abbreviate cstr const std::string &
      
    • I have several functions for "code snippets" like things, for example :

      function! IncludeGuard()
        let basename = expand("%:t:r")
        let includeGuard = '__' . basename . '_h__'
        call append(0, "#ifndef " . includeGuard)
        call append(1, "#define " . includeGuard)
        call append(line("$"), "#endif /* !" . includeGuard . " */")
      endfunction
      
    • The only plugin I really couldn't live without is Command-T (which requires ruby support)

    • For easy .cc to .h switching, you can try this plugin

提交回复
热议问题