3

我安装了 .net-core 2.0.0 的 ubuntu 18.04 机器。我还安装了 (neovim)nvim v0.2.2。

我能够在我的 ubuntu 机器上构建和运行 .net-core 项目。我的问题是如何将 vim/nvim 与 c# 自动完成一起用于我的 .net-core 项目。我已经为我的 nvim 安装了 Omnisharp-vim 插件,但它不工作。我尝试配置omnisharp-roslyn,但没有运气。我在 Omnisharp github 页面上读到,我需要安装 Omnisharp-roslyn 服务器才能使 Omnisharp-vim 工作。不幸的是没有运气。我在 youtube 上看到有人在 vim 中使用自动完成功能编写 c#。

知道如何设置吗?因为我很想在我的 ubuntu 机器上拥有这个功能。

谢谢

4

1 回答 1

0

您可以毫无问题地使用。请参阅我的 C# 配置:

" C#
Plug 'https://github.com/adelarsq/vim-csharp', {'for':['cs','csx','cshtml.html','csproj','solution']}
Plug 'https://github.com/OmniSharp/omnisharp-vim', {'for':['cs','csx','cshtml.html','csproj','solution'], 'on': ['OmniSharpInstall']}

let g:OmniSharp_server_stdio = 1
let g:OmniSharp_selector_ui = ''       " Use vim - command line, quickfix etc.
let g:OmniSharp_highlight_types = 2

augroup my_omnisharp
    autocmd!
    au FileType cs nmap <buffer> <silent> ga :OmniSharpGetCodeActions<CR>
    au FileType cs nmap <buffer> <silent> gd :OmniSharpGotoDefinition<CR>
    au FileType cs nmap <buffer> <silent> gq :OmniSharpCodeFormat<CR>
    au FileType cs nmap <buffer> <silent> gu :OmniSharpFixUsings<CR>
    au FileType cs nmap <buffer> <silent> gr :OmniSharpFindUsages<CR>
    au FileType cs nmap <buffer> <silent> gK :OmniSharpDocumentation<CR>
    au FileType cs nmap <buffer> <silent> <F2> :OmniSharpRename<CR>
augroup END
于 2019-10-16T18:08:13.370 回答