My personal Neovim configuration, primarly focused on dotnet web dev
Last tested working on v0.10.0-dev-*
https://github.com/neovim/neovim/releases
Requires you to have a Nerdfont installed, and your terminal configured to use it https://www.nerdfonts.com/font-downloads
choco install mingw
choco install llvm
https://github.com/BurntSushi/ripgrep?tab=readme-ov-file#installation
https://github.com/Samsung/netcoredbg/releases
Same as omnisharp, once downloaded and installed, must be added to PATH
Can validate it works via executing netcoredbg --version
in your terminal
Also, and very importantly, I have a configuration setup to remote debug with netcoredbg over ssh targeting windows, for more info see below
Install latest Omnisharp LSP here: https://github.com/OmniSharp/omnisharp-roslyn/releases/latest
Install it at ~/.local/lib/omnisharp/OmniSharp.dll
Here is my recommended .editorconfig file to go in ~
root = true
[*.{cs,vb}]
csharp_style_namespace_declarations = file_scoped
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true
dotnet_style_prefer_conditional_expression_over_return = false
If opening .cs files triggers this error:
attempt to index local 'decoded' (a nil value)
Then perform this fix:
OmniSharp/omnisharp-roslyn#2574 (comment)
(Note the path to rpc.lua may differ from that comment, use the same path your specific error is giving)
By default omnisharp binds to dotnet 6.x, you can fix this via creating ~/.omnisharp/omnisharp.json
with the following:
{
"sdk": {
"path": "/usr/share/dotnet/sdk/8.0.203",
"version": "8.0.203"
},
"RenameOptions": {
"RenameInComments": true,
"RenameOverloads": true,
"RenameInStrings": true
}
}
The path and version should match the directory that which dotnet
leads you to (specifically the ./sdk/#.#.###
folder underneath it)
npm i -g vscode-langservers-extracted
npm install -g typescript typescript-language-server
https://clangd.llvm.org/installation
Clangd is configured to utilize the pi pico g++ installer. I could probably add configuration to switch which query engine to use but pretty much the only time I use C++ nowadays is for compiling to arm SBCs so...
Download the latest binary from here: https://github.com/redhat-developer/vscode-xml/releases/latest
Ensure it is on PATH, and has been named lemminx
- Checkout Avalonia.Ide here https://github.com/kekekeks/Avalonia.Ide to
~/.local/lib/Avalonia.Ide
- Replace the pngcs submodule with this one: https://github.com/leonbloy/pngcs
- Checkout and update all submodules
- Build
./src/Avalonia.Ide.LanguageServer
viadotnet publish -c Release
- If all went well, the output should be
~/.local/lib/Avalonia.Ide/src/Avalonia.Ide.LanguageServer/bin/Release/netcoreapp2.1/Avalonia.Ide.LanguageServer.dll
nvim folder location should be %LocalAppData%/nvim
, checkout the git repo to that location with that name.
If done correctly the file %LocalAppData%/nvim/README.md
should exist.
nvim folder location should be ~/.config/nvim
, checkout the git repo to that location with that name.
If done correctly the file ~/.config/nvim/README.md
should exist.
First you must have a launch.json configured in your project root. proj-loader will automatically detect the path .vs/launch.json
in the root of your project, and it assumes the project root based off the presence of a greedy depth first search of a .sln file.
Configuration is also setup to have pid-attach work for a running instance of a dotnet app via dap-pid-picker, but it will make your life a lot easier if the below is done:
Example launch.json
file:
{
"version": "0.2.0",
"configurations": [
{
"type": "cs",
"name": "netcoredbg",
"request": "launch",
"program": "Your.Project.Name.dll",
"cwd": "${workspaceFolder}/Your.Project.Name/bin/Debug/net8.0/"
}
]
}
proj-loader is configured to use the found project root (where your .sln file is) as its relative cwd for the launch.json, so you very likely wwill always want your cwd
entry to be similiar to the one above.
Note that nvim-dap supports multiple matching configs for the same build out of the box, and if multiple matches are found it will just prompt you with which one you want to use, allowing you to define multiple build configs in your launch.json
file
List of major plugins included in this setup and a quick blurb about them, and relevant keybinds for them
Debugger and interface. Currently just setup with netcoredbg
to debug dotnet applications
- TODO: Add node/npm support for web dev
F9
- Toggle Breakpoint
F5
- Build and run
All other keybinds are largely the same
Autocomplete/code suggestions/etc
Currently using the following LSPs:
- Dotnet: Roslyn
- html: vscode-langservers-extracted
- TS/JS/Node/NPM/Json: typescript-language-server
- Lua: lua_ls
- TODO: Figure out the best LSP for CSS/SASS/SCSS
Adds a nice status line at the bottom of the editor with tonnes of meta info like git, line ending type, character format, filetype, line number and char pos, etc etc.
Toggling code comments on/off
Ctrl + /
- Comments out a selected block of lines, if you have a block selected
Ctrl + / Ctrl + /
- Comments out the current line the cursor is on, if no selection is made
Git integration for multiple other plugins, primarily used to show del/add/modify status of files, folders, individual lines of code, etc
VSCode style File browser on lefthand side + tabs on the top. nvim-tree supports a bunch of commands for adding/removing/changing files and directories
Navigation tool for quickly "remembering" the last place you were in a buffer when you change buffers, providing a "history" style functionality to quickly hop back to the last place you were in the prior buffer. Has "hot" memory for quick swapping between 4 buffers
Pretty but minimalist scrollbar on buffers. Has both lsp-config
integration to show potential code warnings/errors/suggestions, as well as git integration to show status of individual lines
- TODO: Modify the icons and highlighting to make more sense and be less messy. We have nerdfont capability and can definitely improve the UX here
Mandatory treesitter as every vim config has. Code highlighting / coloring / etc. You'd be a madlad to not have this plugin
Another mandatory plugin everyone uses. Searching, Grepping, but also a handy tool for pickers and floating selectors and whatnot, many other plugins depend on this
Replaces vim's default select picker with above aformentioned telescope's much fancier and prettier picker, which includes filtering options by text input
new-file-template (custom fork)
Templating for new files created if they match specific filename matches. Custom fork of the original plugin that switches the API to a callback system to support pickers/inputs with callback patterns
Handy tool for detecting git conflict >...
+ ..<
in files. Disables code suggestions until git conflicts are resolved, and enables a handful of handy commands for resolving conflicts and navigating them.
Prompts for templates for the following currently supported types:
- class
- struct
- enum
- interface
Defaults, built in
Defaults, built in, I dunno how these work tbh they came with the plugin and I dont use ruby so /shrug
WIP, TODO
WIP, TODO
Extremely handy plugin for toggling visibility of the signature of methods, as well as browsing the method's overloads
ctrl-s
- Force show overloads popup, for the method currently selected in the buffer
alt-s
- Hide the overloads popup
ctrl-h/l
- browse the paramaters and their definitions of the current signature
ctrl-j/k
- browse the list of overloads
Pretty powerful and handy note taking, journal, calender, to-do list, etc AIO for neovim. Lets you designate predifined "workspace" folders your notes/journals etc get saved in. My preferred use case is journal+todo lists to have tracked to-do items day by day for work.
There's a solid youtube series on how to use it here: https://www.youtube.com/watch?v=NnmRVY22Lq8
Keybinds: WIP
Default workspace config:
- Notes:
~/Documents/notes/
(default workspace) - Journal:
~/Documents/journal/
(default journal workspace) Note: the above folders will need to exist prior to using any of the Neorg commands, or you'll get some errors
Inline autocomplete support for a locally run, self hosted llm API Full configuration is in ./lua/lsp-config/llm-config.lua
See documentation here on configuring the values: https://github.com/gnanakeethan/llm.nvim?tab=readme-ov-file#adaptors
Requires, by default, the installation of ollama (running on server mode), as well as llm-ls
By default I have the configuration expecting ollama to have stable-code-3b installed, which is one of the faster and better performing "in the middle" trained llms I have tested so far. Its fast and light enough it can run off CPU and still have decent response speed, especially if you keep the max tokens config low, as well as the max context low.
Step 0 (optional): If you dont have them already and want to use your gpu, ensure you have your cuda drivers installed (varies by OS and GPU a lot so you'll have to do some googling to figure this one out)
Step 1: install Cargo: https://doc.rust-lang.org/cargo/getting-started/installation.html
Step 2: Install llm-ls: cargo install --branch main --git https://github.com/huggingface/llm-ls llm-ls
Step 3: install ollama
Step 4: download the stable-code-3b .guff file here (I recommend the basic stable-code-3b.gguf file, its the largest but still wicked fast and has best accuracy/quality)
Step 5: in the same directory as the .guff file you just downloaded, create stable-code-3b.modelfile
with the following contents: FROM <absolute path to your .gguf file you just downloaded>
Step 6: ollama create stable-code-3b -f ./stable-code-3b.modelfile
Step 7: ollama serve
(this might error saying the port is already in use, thats fine it means ollama is just already running)
Step 8: if you open up a fresh instance of neovim, the autocomplete should start showing up while in edit mode!
Step 9: feel free to configure llm-config.lua
as needed if you want to lower/increase memory usage.
Keybinds are setup (aside from the handful that need to work in insert mode) to follow three steps to their chords.
<leader>
, which is by default set to be Spacebar- Category key, which is a key for each category of commands.
- Command key, which is the final key for the actual command itself.
For example, for the command "Format" below, the chord would be:
<Spacebar>rf
for Leader -> [R]efactor -> [F]ormat
For both of the above, requires tmux to be installed and neovim to be running inside a tmux session.
Will open up a new tmux panel (if one hasnt been opened yet) and pipe the current line (normal mode) or selected text (visual mode) into the tmux panel, executing it.
This section deals with all keybinds for interacting with the debugger
Toggles a breakpoint being set on the given line for nvim-dap debugger
Clears all stored breakpoints in the current session for nvim-dap debugger
Opens up a Telescope Picker for all existing breakpoints
Starts nvim-dap, running the debugger for given configurations
This section deals with all navigation to change files/buffers
Opens a Telescope Picker for all currently opened buffers
Opens a Telescope file picker, pulled from git history to list all modified files both from uncommitted changes, stashed changes, and unpushed changes
Opens a Telescope file picker for all files except for those ignored by .gitignore
Opens a Telescope file picker based on recently opened files in all neovim sessions
Opens a Grep fuzzy finder, that will find files with text that matches the grep fuzzy find.
This section deals with all registered hotkeys to help with git functionality
Opens a Telescope picker to switch Git branches
Jumps to the previous detected merge conflict in the buffer
Jumps to the next detected merge conflict in the buffer
Opens up a list of navigable detected merge conflicts in the buffer
Chooses neither of the options for a merge conflict
Chooses Your (Local/Current) changes in the merge conflict (Option A)
Chooses Their (Remote/Incoming) changes in the merge conflict (Option B)
Chooses both Local + Remote changes in the merge conflict (Options A+B)
Keybinds related to Harpoon
Tags the given line as a Harpoon'd mark
Navigate back/forward Harpoon marks
Jump to Harpoon marks 1 through 5
All keybinds related to modifying the buffer
Opens up the LSP's Action Menu at the given cursor
Formats the buffer's code
Opens a prompt to rename the selected symbol (most LSPs will propogate this rename across all files, mileage will vary)
Brings up a Telescope picker for all Undo history, including with a diff display for the changes! Uses the following default keybinds:
<CR>
- Yanks the specific discrete++
changes into default register<S-CR>
- Yanks the specific discrete--
changes into default register<C-CR>
- Reverts the buffer back to the selected point in History
Handles keybinds involved in navigating based on the current buffer
Opens a telescope picker to show all definitions of selected symbol. Will jump straight to the definition if only one exists.
Opens up a fuzzy Grep for within the current buffer
Opens up a telescope list for Implementations of the selected symbol. Will jump directly to the result if only one exists.
Opens up a telescope picker for all references of the selected symbol
Opens up a telescope picker showing for declared symbols in the current buffer
Opens up a telescope picker for all diagnostic warnings of the current buffer
Category for all keybinds regarding tests
Triggers a debug session with nvim-dap of the nearest declared test to the cursor
Runs the full test suite for the opened file
Runs the nearest declared test to the cursor
Shows a popup browseable test report coverage summary, based on a loaded in Test Coverage Report (loaded in via the above command)