mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:40:03 +08:00
commit
14cf41a944
117
autoload/SpaceVim/layers/lang/csharp.vim
Normal file
117
autoload/SpaceVim/layers/lang/csharp.vim
Normal file
@ -0,0 +1,117 @@
|
||||
"=============================================================================
|
||||
" csharp.vim --- SpaceVim lang#csharp layer
|
||||
" Copyright (c) 2016-2017 Wang Shidong & Contributors
|
||||
" Author: VyronLee < lwz_jz # hotmail.com >
|
||||
" URL: https://spacevim.org
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section lang#csharp, layer-lang-csharp
|
||||
" @parentsection layers
|
||||
" This layer includes utilities and language-specific mappings for csharp development.
|
||||
"
|
||||
" @subsection Key Mappings
|
||||
" >
|
||||
" Mode Key Function
|
||||
" ---------------------------------------------
|
||||
" normal SPC l b compile the project
|
||||
" normal SPC l f format current file
|
||||
" normal SPC l d show doc
|
||||
" normal SPC l e rename symbol under cursor
|
||||
" normal SPC l g g go to definition
|
||||
" normal SPC l g i find implementations
|
||||
" normal SPC l g t find type
|
||||
" normal SPC l g s find symbols
|
||||
" normal SPC l g u find usages of symbol under cursor
|
||||
" normal SPC l g m find members in the current buffer
|
||||
" normal SPC l s r reload the solution
|
||||
" normal SPC l s s start the OmniSharp server
|
||||
" normal SPC l s S stop the OmniSharp server
|
||||
" <
|
||||
|
||||
function! SpaceVim#layers#lang#csharp#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, ['OmniSharp/omnisharp-vim', {'on_ft' : 'cs'}])
|
||||
|
||||
if has('nvim')
|
||||
call add(plugins, ['autozimu/deoplete-omnisharp', {'on_ft' : 'cs'}])
|
||||
else
|
||||
call add(plugins, ['tpope/vim-dispatch', {'on_ft' : 'cs'}])
|
||||
endif
|
||||
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#csharp#config() abort
|
||||
" Get Code Issues and syntax errors
|
||||
let g:syntastic_cs_checkers = ['syntax', 'semantic', 'issues']
|
||||
|
||||
augroup spacevim_csharp
|
||||
autocmd!
|
||||
|
||||
if !has('nvim')
|
||||
" Set autocomplete function to OmniSharp by default
|
||||
autocmd FileType cs setlocal omnifunc=OmniSharp#Complete
|
||||
endif
|
||||
|
||||
" Automatically add new cs files to the nearest project on save
|
||||
autocmd BufWritePost *.cs call OmniSharp#AddToProject()
|
||||
|
||||
" Show type information automatically when the cursor stops moving
|
||||
autocmd CursorHold *.cs call OmniSharp#TypeLookupWithoutDocumentation()
|
||||
augroup END
|
||||
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('cs', function('s:language_specified_mappings'))
|
||||
endfunction
|
||||
|
||||
" Add language specific mappings
|
||||
function! s:language_specified_mappings() abort
|
||||
" Suggested bindings
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','b'],
|
||||
\ 'OmniSharpBuildAsync',
|
||||
\ 'compile the project', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','f'],
|
||||
\ 'OmniSharpCodeFormat',
|
||||
\ 'format current file', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','d'],
|
||||
\ 'OmniSharpDocumentation',
|
||||
\ 'show doc', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','e'],
|
||||
\ 'OmniSharpRename',
|
||||
\ 'rename symbol under cursor', 1)
|
||||
|
||||
" Navigation
|
||||
let g:_spacevim_mappings_space.l.g = {'name' : '+Navigation'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','g', 'g'],
|
||||
\ 'OmniSharpGotoDefinition',
|
||||
\ 'go to definition', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','g', 'i'],
|
||||
\ 'OmniSharpFindImplementations',
|
||||
\ 'find implementations', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','g', 't'],
|
||||
\ 'OmniSharpFindType',
|
||||
\ 'find type', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','g', 's'],
|
||||
\ 'OmniSharpFindSymbol',
|
||||
\ 'find symbols', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','g', 'u'],
|
||||
\ 'OmniSharpFindUsages',
|
||||
\ 'find usages of symbol under cursor', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','g', 'm'],
|
||||
\ 'OmniSharpFindMembers',
|
||||
\ 'find members in the current buffer', 1)
|
||||
|
||||
" Server interaction
|
||||
let g:_spacevim_mappings_space.l.s = {'name' : '+Server interaction'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'r'],
|
||||
\ 'OmniSharpReloadSolution',
|
||||
\ 'Reload the solution', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'],
|
||||
\ 'OmniSharpStartServer',
|
||||
\ 'Start the OmniSharp server', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'S'],
|
||||
\ 'OmniSharpStopServer',
|
||||
\ 'Stop the OmniSharp server', 1)
|
||||
|
||||
endfunction
|
@ -45,38 +45,44 @@ call SpaceVim#layers#disable('shell')
|
||||
|
||||
## Available layers
|
||||
|
||||
| Name | Description |
|
||||
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [autocomplete](https://spacevim.org/layers/autocomplete/) | This layer provides auto-completion to SpaceVim |
|
||||
| [chat](https://spacevim.org/layers/chat/) | SpaceVim chatting layer provide chatting with qq and weixin in vim. |
|
||||
| [checkers](https://spacevim.org/layers/checkers/) | This layer provides syntax checking feature |
|
||||
| [chinese](https://spacevim.org/layers/chinese/) | Layer for chinese users, include chinese docs and runtime messages |
|
||||
| [colorscheme](https://spacevim.org/layers/colorscheme/) | colorscheme provides a list of colorscheme for SpaceVim, default colorscheme is gruvbox with dark theme. |
|
||||
| [cscope](https://spacevim.org/layers/cscope/) | This layer provide cscope manager for project |
|
||||
| [debug](https://spacevim.org/layers/debug/) | This layer provide debug workflow support in SpaceVim |
|
||||
| [default](https://spacevim.org/layers/default/) | lt layer contains none plugins, but it has some better default config for vim and neovim |
|
||||
| [git](https://spacevim.org/layers/git/) | This layers adds extensive support for git |
|
||||
| [lang#c](https://spacevim.org/layers/lang/c/) | This layer is for c/c++/object-c development |
|
||||
| [lang#dart](https://spacevim.org/layers/lang/dart/) | This layer is for dart development, provide autocompletion, syntax checking, code format for dart file. |
|
||||
| [lang#elixir](https://spacevim.org/layers/lang/elixir/) | This layer is for elixir development, provide autocompletion, syntax checking, code format for elixir file. |
|
||||
| [lang#go](https://spacevim.org/layers/lang/go/) | This layer is for golang development. It also provides additional language-specific key mappings. |
|
||||
| [lang#haskell](https://spacevim.org/layers/lang/haskell/) | This layer is for haskell development |
|
||||
| [lang#java](https://spacevim.org/layers/lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. |
|
||||
| [lang#javascript](https://spacevim.org/layers/lang/javascript/) | This layer is for JaveScript development |
|
||||
| [lang#lisp](https://spacevim.org/layers/lang/lisp/) | for lisp development |
|
||||
| [lang#lua](https://spacevim.org/layers/lang/lua/) | This layer is for lua development, provide autocompletion, syntax checking, code format for lua file. |
|
||||
| [lang#markdown](https://spacevim.org/layers/lang/markdown/) | Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file. |
|
||||
| [lang#ocaml](https://spacevim.org/layers/lang/ocaml/) | This layer is for OCaml development
|
||||
| [lang#php](https://spacevim.org/layers/lang/php/) | This layer adds PHP language support to SpaceVim |
|
||||
| [lang#python](https://spacevim.org/layers/lang/python/) | This layer is for Python development, provide autocompletion, syntax checking, code format for python file. |
|
||||
| [lang#ruby](https://spacevim.org/layers/lang/ruby/) | This layer is for ruby development, provide autocompletion, syntax checking, code format for ruby file. |
|
||||
| [lang#typescript](https://spacevim.org/layers/lang/typescript/) | This layer is for TypeScript development |
|
||||
| [lang#vim](https://spacevim.org/layers/lang/vim/) | This layer is for writting vim script, including code completion, syntax checking and buffer formatting |
|
||||
| [language-server-protocol](https://spacevim.org/layers/language-server-protocol/) | This layers provides language server protocol for vim and neovim |
|
||||
| [shell](https://spacevim.org/layers/shell/) | This layer provide shell support in SpaceVim |
|
||||
| [tags](https://spacevim.org/layers/tags/) | This layer provide tags manager for project |
|
||||
| [ui](https://spacevim.org/layers/ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI |
|
||||
|
||||
| Name | Description |
|
||||
| ---------- | ------------ |
|
||||
| [autocomplete](https://spacevim.org/layers/autocomplete/) | This layer provides auto-completion to SpaceVim |
|
||||
| [chat](https://spacevim.org/layers/chat/) | SpaceVim chatting layer provide chatting with qq and weixin in vim. |
|
||||
| [checkers](https://spacevim.org/layers/checkers/) | This layer provides syntax checking feature |
|
||||
| [chinese](https://spacevim.org/layers/chinese/) | Layer for chinese users, include chinese docs and runtime messages |
|
||||
| [colorscheme](https://spacevim.org/layers/colorscheme/) | colorscheme provides a list of colorscheme for SpaceVim, default colorscheme is gruvbox with dark theme. |
|
||||
| [cscope](https://spacevim.org/layers/cscope/) | This layer provide cscope manager for project |
|
||||
| [ctrlp](https://spacevim.org/layers/ctrlp/) | This layers adds extensive support for git |
|
||||
| [debug](https://spacevim.org/layers/debug/) | This layer provide debug workflow support in SpaceVim |
|
||||
| [default](https://spacevim.org/layers/default/) | lt layer contains none plugins, but it has some better default config for vim and neovim |
|
||||
| [denite](https://spacevim.org/layers/denite/) | Another Unite centric work-flow which use denite |
|
||||
| [git](https://spacevim.org/layers/git/) | This layers adds extensive support for git |
|
||||
| [github](https://spacevim.org/layers/github/) | This layer provides GitHub integration for SpaceVim |
|
||||
| [index](https://spacevim.org/layers/index/) | list of available layers in SpaceVim |
|
||||
| [lang#c](https://spacevim.org/layers/lang/c/) | This layer is for c/c++/object-c development |
|
||||
| [lang#csharp](https://spacevim.org/layers/lang/csharp/) | This layer is for csharp development |
|
||||
| [lang#dart](https://spacevim.org/layers/lang/dart/) | This layer is for dart development, provide autocompletion, syntax checking, code format for dart file. |
|
||||
| [lang#elixir](https://spacevim.org/layers/lang/elixir/) | This layer is for elixir development, provide autocompletion, syntax checking, code format for elixir file. |
|
||||
| [lang#go](https://spacevim.org/layers/lang/go/) | This layer is for golang development. It also provides additional language-specific key mappings. |
|
||||
| [lang#haskell](https://spacevim.org/layers/lang/haskell/) | This layer is for haskell development |
|
||||
| [lang#html](https://spacevim.org/layers/lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. |
|
||||
| [lang#java](https://spacevim.org/layers/lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. |
|
||||
| [lang#javascript](https://spacevim.org/layers/lang/javascript/) | This layer is for JaveScript development |
|
||||
| [lang#lisp](https://spacevim.org/layers/lang/lisp/) | for lisp development |
|
||||
| [lang#lua](https://spacevim.org/layers/lang/lua/) | This layer is for lua development, provide autocompletion, syntax checking, code format for lua file. |
|
||||
| [lang#markdown](https://spacevim.org/layers/lang/markdown/) | Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file. |
|
||||
| [lang#ocaml](https://spacevim.org/layers/lang/ocaml/) | This layer is for Python development, provide autocompletion, syntax checking, code format for ocaml file. |
|
||||
| [lang#php](https://spacevim.org/layers/lang/php/) | This layer adds PHP language support to SpaceVim |
|
||||
| [lang#python](https://spacevim.org/layers/lang/python/) | This layer is for Python development, provide autocompletion, syntax checking, code format for python file. |
|
||||
| [lang#ruby](https://spacevim.org/layers/lang/ruby/) | This layer is for ruby development, provide autocompletion, syntax checking, code format for ruby file. |
|
||||
| [lang#typescript](https://spacevim.org/layers/lang/typescript/) | This layer is for TypeScript development |
|
||||
| [lang#vim](https://spacevim.org/layers/lang/vim/) | This layer is for writting vim script, including code completion, syntax checking and buffer formatting |
|
||||
| [language-server-protocol](https://spacevim.org/layers/language-server-protocol/) | This layers provides language server protocol for vim and neovim |
|
||||
| [shell](https://spacevim.org/layers/shell/) | This layer provide shell support in SpaceVim |
|
||||
| [tags](https://spacevim.org/layers/tags/) | This layer provide tags manager for project |
|
||||
| [tools#dash](https://spacevim.org/layers/tools/dash/) | This layer provides Dash integration for SpaceVim |
|
||||
| [ui](https://spacevim.org/layers/ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI |
|
||||
<!-- SpaceVim layer list end -->
|
||||
|
||||
<!-- vim:set nowrap: -->
|
||||
|
64
docs/layers/lang/csharp.md
Normal file
64
docs/layers/lang/csharp.md
Normal file
@ -0,0 +1,64 @@
|
||||
---
|
||||
title: "SpaceVim lang#csharp layer"
|
||||
description: "This layer is for csharp development"
|
||||
---
|
||||
|
||||
# [SpaceVim Layers:](https://spacevim.org/layers) lang#csharp
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [Description](#description)
|
||||
- [Installation](#installation)
|
||||
- [Layer](#layer)
|
||||
- [OmniSharp Server](#omnisharp-server)
|
||||
- [Key bindings](#key-bindings)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## Description
|
||||
|
||||
This layer is for csharp development.
|
||||
|
||||
## Installation
|
||||
|
||||
### Layer
|
||||
|
||||
To use this configuration layer, add `SPLayer 'lang#csharp'` to your custom configuration file.
|
||||
|
||||
### OmniSharp Server
|
||||
|
||||
You must build the *OmniSharp Server* before using this layer's features.
|
||||
|
||||
After all plugins installed, *cd* to the directory `$SPACEVIM_PLUGIN_BUNDLE_DIR/repos/github.com/OmniSharp/omnisharp-vim/server` (by default `$HOME/.cache/vimfiles/repos/github.com/OmniSharp/omnisharp-vim/server`, and then run
|
||||
|
||||
```
|
||||
xbuild
|
||||
```
|
||||
for macOS and linux, or
|
||||
|
||||
```
|
||||
msbuild
|
||||
```
|
||||
for Windows.
|
||||
|
||||
For more information, please read this [link](https://github.com/OmniSharp/omnisharp-vim#installation).
|
||||
|
||||
|
||||
## Key bindings
|
||||
|
||||
| Key Binding | Description |
|
||||
| ----------- | ------------------------------------------------ |
|
||||
| `SPC l b` | compile the project |
|
||||
| `SPC l f` | format current file |
|
||||
| `SPC l d` | show doc |
|
||||
| `SPC l e` | rename symbol under cursor |
|
||||
| `SPC l g g` | go to definition |
|
||||
| `SPC l g i` | find implementations |
|
||||
| `SPC l g t` | find type |
|
||||
| `SPC l g s` | find symbols |
|
||||
| `SPC l g u` | find usages of symbol under cursor |
|
||||
| `SPC l g m` | find members in the current buffer |
|
||||
| `SPC l s r` | reload the solution |
|
||||
| `SPC l s s` | start the OmniSharp server |
|
||||
| `SPC l s S` | stop the OmniSharp server |
|
||||
|
Loading…
Reference in New Issue
Block a user