spf13和omnisharp(vim)

时间:2014-06-26 10:07:42

标签: vim spf13vim

我正在使用spf13,我想使用omnisharp,所以我按照说明安装(并构建)它。现在我讨论如何将它与spf13集成。

似乎已经有了处理" omni completion"但我也想要问题跟踪器。

spf13 .vimrc

    " PIV {
        let g:DisableAutoPHPFolding = 0
        let g:PIVAutoClose = 0
    " }

    " Misc {
        let g:NERDShutUp=1
        let b:match_ignorecase = 1
    " }

    " OmniComplete {
        " To disable omni complete, add the following to your .vimrc.before.local file:
        "   let g:spf13_no_omni_complete = 1
        if !exists('g:spf13_no_omni_complete')
            if has("autocmd") && exists("+omnifunc")
                autocmd Filetype *
                    \if &omnifunc == "" |
                    \setlocal omnifunc=syntaxcomplete#Complete |
                    \endif
            endif

            hi Pmenu  guifg=#000000 guibg=#F8F8F8 ctermfg=black ctermbg=Lightgray
            hi PmenuSbar  guifg=#8A95A7 guibg=#F8F8F8 gui=NONE ctermfg=darkcyan ctermbg=lightgray cterm=NONE
            hi PmenuThumb  guifg=#F8F8F8 guibg=#8A95A7 gui=NONE ctermfg=lightgray ctermbg=darkcyan cterm=NONE

            " Some convenient mappings
            inoremap <expr> <Esc>      pumvisible() ? "\<C-e>" : "\<Esc>"
            inoremap <expr> <CR>       pumvisible() ? "\<C-y>" : "\<CR>"
            inoremap <expr> <Down>     pumvisible() ? "\<C-n>" : "\<Down>"
            inoremap <expr> <Up>       pumvisible() ? "\<C-p>" : "\<Up>"
            inoremap <expr> <C-d>      pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<C-d>"
            inoremap <expr> <C-u>      pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<C-u>"

            " Automatically open and close the popup menu / preview window
            au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
            set completeopt=menu,preview,longest
        endif
    " }

所以我想完全融入vim。

1 个答案:

答案 0 :(得分:1)

Omnisharp本身并不执行omnicompletion。它只是提供了一个omnifunc,您可以使用它来插入您喜欢的任何完成机制(YCM,Neocomplete,supertab)等。

我从未使用过spf13,但我想你只需要

autocmd FileType cs setlocal omnifunc=OmniSharp#Complete

因为看起来spf13有自己的omnicompletion系统。如果这不起作用,请尝试按Ctrl-X,Ctrl-O手动触发omnicompletion。