发布新日志

  • Make Vim Comfortable With C++ ACE

    2008-07-13 17:44:18

    I built ACE-5.6 in Ubuntu Linux. The headers and sources live in /usr/local/include/ace and the libraries go to /usr/local/lib.

    To simplify the words below, let ACE_INCLUDE represent /usr/local/include/ace.

    -- Build tags

    ACE_INCLUDE$ sudo ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .

    -- Install scrīpt OmniCppComplete for Vim

    You can find it here: http://www.vim.org/scrīpts/scrīpt.php?scrīpt_id=1520

    Configuration for it in my .vimrc:

    "-------------------------------------------------------------------------------
    " plugin - omnicppcomplete

    let OmniCpp_NamespaceSearch = 2 " search in included files too
    let OmniCpp_DisplayMode = 1 " always show all members for class scope(::)
    let OmniCpp_ShowPrototypeInAbbr = 1 " useful for overloaded functions
    let OmniCpp_MayCompleteDot = 1 " default 1
    let OmniCpp_MayCompleteArrow = 1 " default 1
    let OmniCpp_MayCompleteScope = 1 " default 0 (::)
    let OmniCpp_SelectFirstItem = 0 " default 0

    -- Build cscope.out

    ACE_INCLUDE$ sudo cscope -Rbk *.h *.cpp *.inl

    -- Add a function in .vimrc to add those databases

    function! ACE_AddDB()
        if filereadable("/usr/bin/ctags")
            set tags+=/usr/local/include/ace/tags
        endif

        if has("cscope") && filereadable("/usr/bin/cscope")
            if filereadable("/usr/local/include/ace/cscope.out")
                cs add /usr/local/include/ace/cscope.out /usr/local/include/ace
            endif
        endif
    endfunction

    Note the second argument of 'cs add'. It's important.

    You can call it via :call ACE_AddDB() or bind a key to it.

    The reason why I don't add them directly is for Vim's performance. I don't want unnecessary databases to be added until I am really working on a ACE project.

    -- Screen shots

我的栏目

数据统计

  • 访问量: 212
  • 日志数: 4
  • 建立时间: 2007-12-23
  • 更新时间: 2008-08-25

RSS订阅

Open Toolbar