Skip to content

Latest commit

 

History

165 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meon - Neovim Configuration for C# Development

A fully-featured Neovim configuration optimized for C# / .NET development on macOS. Includes Roslyn LSP, debugging with netcoredbg, unit testing with Neotest, and 50+ carefully configured plugins.

Features

  • Roslyn Language Server - Modern C# LSP with intelligent code analysis
  • Integrated Debugging - netcoredbg with DAP UI, breakpoints, watches, and REPL
  • Unit Testing - Neotest integration with test running and debugging
  • .NET Build Integration - Direct dotnet build with quickfix error navigation
  • VS Code Compatibility - Reads launch.json and settings.json configurations
  • macOS ARM64 Optimized - Native Apple Silicon debugger and clipboard support

Requirements

  • Neovim 0.9+
  • .NET SDK 8.0+
  • macOS (ARM64/Apple Silicon)
  • Git
  • fzf (for fuzzy finding)
  • A Nerd Font (for icons)

Installation

# Backup existing config
mv ~/.config/nvim ~/.config/nvim.bak

# Clone this repository
git clone https://github.com/Eftiand/neovim-csharp-config.git ~/.config/nvim

# Open Neovim - plugins will install automatically
nvim

Structure

~/.config/nvim/
├── init.lua                 # Entry point
├── lazy-lock.json          # Plugin version locks
└── lua/meon/
    ├── core/
    │   ├── options.lua     # Editor settings
    │   └── keymaps.lua     # Key bindings
    ├── lazy.lua            # Plugin manager setup
    ├── plugins/
    │   ├── lsp/
    │   │   ├── roslyn.lua  # C# language server
    │   │   ├── lspconfig.lua
    │   │   └── mason.lua
    │   ├── nvim-dap.lua    # Debug adapter
    │   ├── nvim-dap-ui.lua # Debug UI
    │   ├── neotest.lua     # Test runner
    │   └── [...]           # 50+ plugin configs
    └── util/
        └── json5.lua       # VS Code launch.json parser

Key Bindings

Leader key: <Space>

LSP Navigation

Key Action
gd Go to definition
gD Go to declaration
gi Go to implementations
gr Go to references
gt Go to type definition
K Hover documentation
<leader>ca Code actions
<leader>rn Rename symbol
<leader>D Document diagnostics
<leader>d Line diagnostics

Building & Debugging

Key Action
<leader>bp Build project (dotnet build)
<F5> Continue / Start debugging
<F9> Toggle breakpoint
<F10> Step over
<F11> Step into
<F8> Step out
<leader>du Toggle DAP UI
<leader>dw Watch variable
<leader>dr Open REPL

Testing (Neotest)

Key Action
<leader>tr Run nearest test
<leader>tf Run file tests
<leader>td Debug nearest test
<leader>ts Toggle test summary
<leader>to Open test output
<leader>tx Stop tests

File Navigation

Key Action
<leader>ff Find files
<leader>fa Find all files (including hidden)
<leader>fr Recent files
<leader>fs Live grep
<leader>fc Grep word under cursor
<leader>ft Find TODOs

Harpoon (Quick File Access)

Key Action
<leader>ha Add file to harpoon
<leader>hh Open harpoon menu
<leader>1-4 Jump to harpooned file 1-4

Window Management

Key Action
sh Split vertical
sv Split horizontal
se Equal split sizes
sx Close split
<leader>sm Maximize/restore window

Other

Key Action
jk Exit insert mode
<leader>nh Clear search highlights
<leader>rr Reload config
T Toggle floating terminal
:Ofinder Open current file in Finder

C# Development Setup

Roslyn LSP

The configuration uses roslyn.nvim for C# language support. It automatically activates for .cs files with optimized settings:

  • Background analysis scoped to open files (better performance)
  • Inlay hints disabled for cleaner code view
  • Full diagnostics from analyzers and compiler

Debugging

Debugging uses netcoredbg compiled for macOS ARM64. The debugger is bundled via netcoredbg-macOS-arm64.nvim.

To debug a project:

  1. Create a .vscode/launch.json in your project (VS Code format supported)
  2. Set breakpoints with <F9>
  3. Start debugging with <F5>

Example launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": ".NET Core Launch (console)",
      "type": "coreclr",
      "request": "launch",
      "program": "${workspaceFolder}/bin/Debug/net8.0/YourApp.dll",
      "args": [],
      "cwd": "${workspaceFolder}",
      "stopAtEntry": false
    }
  ]
}

Building

Press <leader>bp to build your solution. The command:

  1. Reads .vscode/settings.json for dotnet.defaultSolution
  2. Falls back to finding .sln or .slnx files
  3. Runs dotnet build with live output
  4. Opens quickfix list on errors

Unit Testing

Testing uses neotest with neotest-dotnet.

  • <leader>tr - Run the test under cursor
  • <leader>td - Debug the test under cursor
  • <leader>ts - View test summary panel

Plugin Highlights

Core

Navigation

UI

Development

macOS Features

  • System clipboard - Uses pbcopy/pbpaste for seamless copy/paste
  • ARM64 debugger - Native Apple Silicon netcoredbg
  • Finder integration - :Ofinder reveals file in Finder
  • Tmux navigation - Seamless pane switching with vim-tmux-navigator

Customization

Adding Plugins

Create a new file in lua/meon/plugins/ with a lazy.nvim spec:

return {
  "author/plugin-name",
  config = function()
    require("plugin-name").setup({})
  end,
}

Modifying Keymaps

Edit lua/meon/core/keymaps.lua to add or change key bindings.

Changing Theme

Edit lua/meon/plugins/colorscheme.lua to modify colors or switch themes.

Troubleshooting

Roslyn not starting

  1. Ensure .NET SDK 8.0+ is installed: dotnet --version
  2. Check Mason installed the server: :Mason and look for roslyn
  3. View LSP logs: :LspLog

Debugger not working

  1. Verify netcoredbg path exists: ~/.local/share/nvim/lazy/netcoredbg-macOS-arm64.nvim/netcoredbg/netcoredbg
  2. Check launch.json syntax is valid
  3. Ensure project is built before debugging

Plugins not loading

  1. Run :Lazy to check plugin status
  2. Try :Lazy sync to update plugins
  3. Check for errors: :messages

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages