<commit_before>![OmniSharp](logo.jpg)

#OmniSharp

OmniSharp is a plugin for Vim to provide IDE like abilities for C#. A list of currently implemented features is provided below.

OmniSharp works both on Windows and on Linux and OS X with Mono.

OmniSharp is just a thin wrapper around the awesome [NRefactory] (https://github.com/icsharpcode/NRefactory) library, so it provides the same
completions as MonoDevelop/SharpDevelop. The [server](https://github.com/nosami/OmniSharpServer) knows nothing about Vim, so could be plugged into most editors fairly easily.
[Sublime Text 2](https://github.com/PaulCampbell/OmniSharpSublimePlugin) now has a completion plugin utilising the OmniSharp server.

##Features

* Contextual code completion
	* Code documentation is displayed in the preview window when available
	* CamelCase completions are supported, e.g Console.WL(TAB) will complete to Console.WriteLine
	* "Subsequence" completions are also supported. e.g. Console.Wline would also complete to Console.WriteLine
	* Completions are ranked in the following order
		* Exact start match (case sensitive)
		* Exact start match (case insensitive)
		* CamelCase completions
		* Subsequence match completions

* Jump to the definition of a type/variable/method
* Find implementations/derived types
* Find usages
* Contextual code actions (sort usings, use var....etc.)
* Rename refactoring
* Lookup type information of an type/variable/method
	* Can be printed to the status line or in the preview window
* Simple syntax error highlighting
* Integrated xbuild/msbuild
* Code formatter
* Add file to project (currently will only add .cs files to a .csproj file)


##Screenshots
####Auto Complete
![Omnisharp screenshot](https://raw.github.com/nosami/Omnisharp/gh-pages/Omnisharp.png)

####Find Usages
![Find Usages screenshot](https://raw.github.com/nosami/Omnisharp/gh-pages/FindUsages.png)

####Code Actions
![Code Actions screenshot](https://raw.github.com/nosami/Omnisharp/gh-pages/CodeActions.png)

##Installation

[pathogen.vim](https://github.com/tpope/vim-pathogen) is the recommended way to install OmniSharp.

###OSX / Linux
    cd ~/.vim/bundle
    git clone https://github.com/nosami/Omnisharp.git
    git submodule init
    git submodule update
    cd Omnisharp/server
    xbuild

###Windows
    c:\
    cd c:\Users\username\vimfiles\bundle
    git clone https://github.com/nosami/Omnisharp.git
    git submodule init
    git submodule update
    cd Omnisharp\server
    msbuild

###Install Python
Install [Python 2.7.5] (http://www.python.org/download/releases/2.7.5/). Make sure that you pick correct version of Python to match the architecture of Vim. 
For example, if you installed Vim using the default Windows installer, you will need to install the x86 (32 bit!) version of Python.

Verify that Python is working inside Vim with 

```vim
:python print "hi"
```


(Optional but highly recommended) Install [SuperTab] (https://github.com/ervandew/supertab) Vim plugin.

### Run the [server](https://github.com/nosami/OmniSharpServer)

	OmniSharp.exe -s (path\to\sln)

OmniSharp listens to requests from Vim on port 2000 by default, so make sure that your firewall is configured to accept requests from localhost on this port.
Also if you are running OmniSharp as a non-privileged user, or without UAC elevation on Vista or later, you will need to run the following

```
http add urlacl url=http://+:2000/ user=DOMAIN\user
```

This will give your user permission to bind to port 2000.

To get completions, open one of the C# files from the solution within Vim and press Ctrl-X Ctrl-O in Insert mode (or just TAB if you have SuperTab installed). 
Repeat to cycle through completions, or use the cursor keys (eugh!)

Simple syntax error highlighting is automatically performed when saving the current buffer.

To use the other features, you'll want to create key bindings for them. See the example vimrc for more info.



### Example vimrc

```vim
" OmniSharp won't work without this setting
filetype plugin on

"This is the default value, setting it isn't actually necessary
let g:OmniSharp_host = "http://localhost:2000"<commit_msg>fixed README.md<commit_after>![OmniSharp](logo.jpg)

#OmniSharp

OmniSharp is a plugin for Vim to provide IDE like abilities for C#. A list of currently implemented features is provided below.

OmniSharp works both on Windows and on Linux and OS X with Mono.

OmniSharp is just a thin wrapper around the awesome [NRefactory] (https://github.com/icsharpcode/NRefactory) library, so it provides the same
completions as MonoDevelop/SharpDevelop. The [server](https://github.com/nosami/OmniSharpServer) knows nothing about Vim, so could be plugged into most editors fairly easily.
[Sublime Text 2](https://github.com/PaulCampbell/OmniSharpSublimePlugin) now has a completion plugin utilising the OmniSharp server.

##Features

* Contextual code completion
	* Code documentation is displayed in the preview window when available
	* CamelCase completions are supported, e.g Console.WL(TAB) will complete to Console.WriteLine
	* "Subsequence" completions are also supported. e.g. Console.Wline would also complete to Console.WriteLine
	* Completions are ranked in the following order
		* Exact start match (case sensitive)
		* Exact start match (case insensitive)
		* CamelCase completions
		* Subsequence match completions

* Jump to the definition of a type/variable/method
* Find implementations/derived types
* Find usages
* Contextual code actions (sort usings, use var....etc.)
* Rename refactoring
* Lookup type information of an type/variable/method
	* Can be printed to the status line or in the preview window
* Simple syntax error highlighting
* Integrated xbuild/msbuild
* Code formatter
* Add file to project (currently will only add .cs files to a .csproj file)


##Screenshots
####Auto Complete
![Omnisharp screenshot](https://raw.github.com/nosami/Omnisharp/gh-pages/Omnisharp.png)

####Find Usages
![Find Usages screenshot](https://raw.github.com/nosami/Omnisharp/gh-pages/FindUsages.png)

####Code Actions
![Code Actions screenshot](https://raw.github.com/nosami/Omnisharp/gh-pages/CodeActions.png)

##Installation

[pathogen.vim](https://github.com/tpope/vim-pathogen) is the recommended way to install OmniSharp.

###OSX / Linux
    cd ~/.vim/bundle
    git clone https://github.com/nosami/Omnisharp.git
    git submodule init
    git submodule update
    cd Omnisharp/server
    xbuild

###Windows
    c:\
    cd c:\Users\username\vimfiles\bundle
    git clone https://github.com/nosami/Omnisharp.git
    git submodule init
    git submodule update
    cd Omnisharp\server
    msbuild

###Install Python
Install [Python 2.7.5] (http://www.python.org/download/releases/2.7.5/). Make sure that you pick correct version of Python to match the architecture of Vim. 
For example, if you installed Vim using the default Windows installer, you will need to install the x86 (32 bit!) version of Python.

Verify that Python is working inside Vim with 

```vim
:python print "hi"
```


(Optional but highly recommended) Install [SuperTab] (https://github.com/ervandew/supertab) Vim plugin.

### Run the [server](https://github.com/nosami/OmniSharpServer)

	OmniSharp.exe -s (path\to\sln)

OmniSharp listens to requests from Vim on port 2000 by default, so make sure that your firewall is configured to accept requests from localhost on this port.
Also if you are running OmniSharp as a non-privileged user, or without UAC elevation on Vista or later, you will need to run the following

```
netsh http add urlacl url=http://+:2000/ user=DOMAIN\user
```

This will give your user permission to bind to port 2000.

To get completions, open one of the C# files from the solution within Vim and press Ctrl-X Ctrl-O in Insert mode (or just TAB if you have SuperTab installed). 
Repeat to cycle through completions, or use the cursor keys (eugh!)

Simple syntax error highlighting is automatically performed when saving the current buffer.

To use the other features, you'll want to create key bindings for them. See the example vimrc for more info.



### Example vimrc

```vim
" OmniSharp won't work without this setting
filetype plugin on

"This is the default value, setting it isn't actually necessary
let g:OmniSharp_host = "http://localhost:2000"
{'fraction_non_alphanumeric': 0.08283096214130697, 'fraction_numerical': 0.0065107306486616836, 'mean_word_length': 4.344716494845361, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 22, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1235701', 'n_tokens_mistral': 2545, 'n_tokens_neox': 2348, 'n_words': 991}