Skip to content

Commit

Permalink
refactor(neovim): python
Browse files Browse the repository at this point in the history
  • Loading branch information
henry40408 committed Feb 4, 2025
1 parent f0d626b commit 5a5dce4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
8 changes: 7 additions & 1 deletion home-manager/common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@
# stable
gopls
lua-language-server
rust-analyzer
nixd
prettierd
(python3.withPackages (ps: [
ps.pylsp-rope
ps.python-lsp-server
ps.rope
ps.yapf
]))
rust-analyzer
stylua
taplo
vscode-langservers-extracted
Expand Down
30 changes: 21 additions & 9 deletions home-manager/common/neovim/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
local LANGUAGE_SERVERS = {
"eslint",
"gopls",
"lua_ls",
"nixd",
"taplo",
}

-- Clone 'mini.nvim' manually in a way that it gets managed by 'mini.deps'
local path_package = vim.fn.stdpath("data") .. "/site/"
local mini_path = path_package .. "pack/deps/start/mini.nvim"
Expand Down Expand Up @@ -347,16 +355,20 @@ later(function()

local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local servers = {
"eslint",
"gopls",
"lua_ls",
"nixd",
"taplo",
}
for _, lsp in ipairs(servers) do
for _, lsp in ipairs(LANGUAGE_SERVERS) do
lspconfig[lsp].setup({ capabilities = capabilities, on_attach = on_attach })
end
lspconfig.pylsp.setup({
capabilities = capabilities,
on_attach = on_attach,
settings = {
pylsp = {
plugins = {
rope_autoimport = { enabled = true },
},
},
},
})
lspconfig.rust_analyzer.setup({
capabilities = capabilities,
on_attach = on_attach,
Expand Down Expand Up @@ -393,6 +405,7 @@ later(
lua = { "stylua" },
markdown = { "prettierd" },
nix = { "nixfmt" },
python = { "yapf" },
typescript = { "prettierd" },
vue = { "prettierd" },
},
Expand Down Expand Up @@ -448,7 +461,6 @@ later(function()
require("toggleterm").setup({
direction = "float",
open_mapping = [[<c-\>]],
float_opts = { border = "none" },
})
-- terminal mappings
vim.keymap.set("t", "<esc><esc>", [[<c-\><c-n>]], { desc = "Enter Normal Mode" })
Expand Down

0 comments on commit 5a5dce4

Please # to comment.