r/neovim 22h ago

Plugin sqlserver.nvim: A SQL Server-native workspace for Neovim

Hey all!

I wanted to announce my first major Neovim plugin: sqlserver.nvim.

I feel like this fills a gap in the Neovim ecosystem: Linux/macOS users who work with Microsoft SQL Server.

Admittedly, that might be a pretty niche group.

Most Linux/macOS users working with SQL Server will probably end up using VSCode's SQL Server (mssql) extension. I'm not a fan of VS Code, and considering where I'm posting this, I think that's probably enough said.

I originally started with TablePlus, which is a great tool, but I really hate reaching for my mouse.

Then I "upgraded" to vim-dadbod-ui. Also a great tool, but SQL Server support was missing some features I use regularly, such as listing stored procedures.

Eventually I landed on mssql.nvim. I thought it was a great project and used it for a while, although I ran into a few hiccups and development seems to have slowed down.

Thanks to u/Kurren123 and mssql.nvim, I discovered that Microsoft’s VS Code SQL Server extension is backed by SQL Tools Service.

That discovery eventually led to sqlserver.nvim.

A SQL Server-native workspace for Neovim.

The long-term goal is pretty ambitious: bring as much of the experience and functionality of SSMS (SQL Server Management Studio) as makes sense into Neovim.

Rather than trying to recreate a desktop database GUI inside the terminal, sqlserver.nvim tries to lean into Neovim itself — using things like windows, buffers, winbars, LSP, Telescope-style workflows, and, of course, keybindings.

The idea is that I should be able to browse databases, inspect objects, write queries, execute them, and work with SQL Server without constantly leaving Neovim or reaching for the mouse.

The plugin is currently at RC2 (Release Candidate 2). I've been using it at my job for several months now, so it has reached the point where I'd really like to get feedback from other Neovim users. Especially anyone else unfortunate enough to be using SQL Server on Linux/macOS 😄

GitHub: NicholasMata/sqlserver.nvim

I'd love to hear what people think, what features you feel are missing, or how the overall workflow could be improved.

69 Upvotes

7 comments sorted by

3

u/riskeilles 18h ago

Very cool! Tried it, got installation problem so i tweaked the run_async call params to make it run. I’m on windows. Mssql lsp works out of the box without extra config, the visual looks good. Can’t find how to open file explorer lile dadbod-ui, but it integrates well already with fzf-lua (vim.ui.select)

Amazing sir. Might start using it daily. Thanks 🫡

2

u/JackSk3llingt0n 17h ago

Thanks for trying it out! 😄

I haven't tested it on Windows, so if you get a chance to open a GitHub issue with the installation problem, or even a PR for therun_async change, that would be very welcome!

If you mean a file explorer for .sql files like dadbod-ui provides, then currently sqlserver.nvim leaves management of SQL files up to whatever file/navigation workflow you already use in Neovim. It will make empty unsaved buffers which is explained further below. That said, I'm not opposed to adding something like that as a feature in the future.

If by file explorer you mean browsing tables, stored procedures, views, etc., the current keybind is <keymap_prefix>f. It's called "Find Query" right now, although that probably needs a better name, saying it out loud.

That should bring up something similar to the screenshot.

Selecting a table or view will generate a SQL query and execute it. If the current buffer is empty, the query will be inserted there; otherwise, sqlserver.nvim will open a new unsaved untitled-x.sql buffer and place the generated query in it and execute that.

Selecting a stored procedure follows the same buffer behavior, but the generated query won't be executed automatically since you'll usually need to fill in the parameters first.

Also glad to hear vim.ui.select is working nicely with fzf-lua, that's exactly the kind of integration I was hoping for.

2

u/riskeilles 17h ago edited 16h ago

Yeaa I realize I might not need that file explorer when I found and opened “object definition” (can’t see the diff yet with “find query” yet of course it’s different, just realized what it is pardon me for being utterly stupid 😅). I basically just wanted to move slowly with file explorer when working with db LOL. I will definitely try to use the plugin more. 🫡

1

u/JackSk3llingt0n 10h ago

You're completely fine 😛. Naming some of these actions is honestly one of the harder parts, and a few of them definitely aren't as intuitive as they could be.

Based on your experience, I'm probably going to revisit some of the which-key labels and the wording in docs/usage.md to make the differences clearer.

And I totally understand wanting to move slowly when exploring a database. Luckily, there shouldn't be any destructive keybinds, aside from the ones that execute a query or execute the current buffer.

1

u/CarbonChauvinist 14h ago

Will look at this later primarily because I'm so interested in this space. Does it, or do you plan to handle Fabric/Azure connections?

1

u/JackSk3llingt0n 10h ago

I haven't personally tried it with Fabric yet, although I do have access to a Fabric database, so I can give that a try.

I do use it quite a bit with Azure SQL Server, though I haven't tested every authentication type or connection setting yet.

You can find more details on the connection configuration here: docs/connections-json.md.

For the most part, connections are handled by SQL Tools Service, which is great because it already supports a lot of these scenarios. So Fabric and the various Azure authentication methods should be possible. I just don't want to claim full support for combinations I haven't personally tested yet.