Member-only story
Neovim PDE — Plugins and Configuration Recipes
Plugins and configuration recipes to customize a modern development environment with Neovim.
We will go through plugins and configuration recipes to customize a modern development environment with Neovim.
This article is part of the Neovim PDE series.
The Neovim configuration files are available in this repository.
TypeScript
Replace typescript.nvim with typescript-tools.nvim
In the previous configuration, we configure our TypeScript PDE to use typescript.nvim
.
As typescript.nvim
is getting archived, let’s try out typescript-tools.nvim
.
In the lua/pde/typescript.lua
file, we configure the plugin and the keymappings to use the custom user commands.
{
"pmizio/typescript-tools.nvim",
opts = {},
config = function(_, opts)
require("plugins.lsp.utils").on_attach(function(client, bufnr)
if client.name == "tsserver" then
vim.keymap.set("n", "<leader>lo", "<cmd>TSToolsOrganizeImports<cr>", { buffer = bufnr, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>lO", "<cmd>TSToolsSortImports<cr>", { buffer = bufnr, desc = "Sort Imports" })
vim.keymap.set("n", "<leader>lu", "<cmd>TSToolsRemoveUnused<cr>", { buffer = bufnr, desc = "Removed Unused" })
vim.keymap.set("n", "<leader>lz", "<cmd>TSToolsGoToSourceDefinition<cr>", { buffer = bufnr, desc = "Go To Source Definition" })
vim.keymap.set("n", "<leader>lR", "<cmd>TSToolsRemoveUnusedImports<cr>", { buffer = bufnr, desc = "Removed Unused Imports" })
vim.keymap.set("n", "<leader>lF", "<cmd>TSToolsFixAll<cr>", { buffer = bufnr, desc = "Fix All" })
vim.keymap.set("n", "<leader>lA", "<cmd>TSToolsAddMissingImports<cr>", { buffer = bufnr, desc = "Add Missing Imports" })
end
end)
require("typescript-tools").setup(opts)
end,
}
We remove the nvim-lspconfig
setup for TypesSript language server configuration since it is replaced by typescript-tools.nvim
.
{
"neovim/nvim-lspconfig",
dependencies = { "pmizio/typescript-tools.nvim" }…