chore: node & python updates

This commit is contained in:
Michel 2024-06-18 15:57:33 +02:00
parent da7df522a3
commit 0f27f15870
6 changed files with 69 additions and 275 deletions

View File

@ -43,6 +43,32 @@ do echo "\n ❌ $plugin"; rg $plugin; done
- <https://www.lazyvim.org/keymaps#noicenvim> - <https://www.lazyvim.org/keymaps#noicenvim>
- <https://github.com/folke/noice.nvim/wiki/A-Guide-to-Messages> - <https://github.com/folke/noice.nvim/wiki/A-Guide-to-Messages>
# 🛠️ Upgrade
## Node
After upgrading node.js with `asdf`,
you may need to execute the following commands:
```sh
npm install -g neovim
npm ls neovim
```
## Python
After upgrading python version with `asdf`,
you may need to execute the following commands:
```sh
# Update symbolic links
python -m venv --upgrade "$VIRTUAL_ENV"
# Install PyNvim
python -m pip install --upgrade pynvim
pip list --format=columns
```
# 🛠️ Installation # 🛠️ Installation
## TL;DR ## TL;DR
@ -53,6 +79,9 @@ cd ~/.config/nvim
direnv allow direnv allow
``` ```
Read also the _Upgrade_ section.
And in neovim, check the output of `:LazyHealth`.
## Make a backup of your current Neovim files ## Make a backup of your current Neovim files
```sh ```sh

View File

@ -7,9 +7,10 @@ vim.env.PATH = vim.env.HOME .. "/.asdf/installs/nodejs/22.2.0/bin/" .. ":" .. vi
-- Use Python from neoovim "config" folder -- Use Python from neoovim "config" folder
local python_root = vim.fn.glob(vim.fn.stdpath("config") .. "/.direnv/python*", true, true)[1] local python_root = vim.fn.glob(vim.fn.stdpath("config") .. "/.direnv/python*", true, true)[1]
local python_bin = python_root .. "/bin"
vim.env.VIRTUAL_ENV = python_root vim.env.VIRTUAL_ENV = python_root
vim.env.PATH = python_root .. "/bin" .. ":" .. vim.env.PATH vim.env.PATH = python_bin .. ":" .. vim.env.PATH
vim.g.python3_host_prog = vim.fn.findfile("python3", python_root .. "/**3") vim.g.python3_host_prog = vim.fn.findfile("python3", python_bin .. "/python3")
-- bootstrap lazy.nvim, LazyVim and your plugins -- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy") require("config.lazy")

View File

@ -1,238 +0,0 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, { name = "emoji" })
end,
},
-- change some telescope options and a keymap to browse plugin files
{
"nvim-telescope/telescope.nvim",
keys = {
-- add a keymap to browse plugin files
-- stylua: ignore
{
"<leader>fp",
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
desc = "Find Plugin File",
},
},
-- change some options
opts = {
defaults = {
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
},
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").lsp.on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add tsx and treesitter
vim.list_extend(opts.ensure_installed, {
"tsx",
"typescript",
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, "😄")
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
-- Use <tab> for completion and snippets (supertab)
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.snippet.active({ direction = 1 }) then
vim.schedule(function()
vim.snippet.jump(1)
end)
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.snippet.active({ direction = -1 }) then
vim.schedule(function()
vim.snippet.jump(-1)
end)
else
fallback()
end
end, { "i", "s" }),
})
end,
},
}

67
package-lock.json generated
View File

@ -5,13 +5,13 @@
"packages": { "packages": {
"": { "": {
"dependencies": { "dependencies": {
"neovim": "^4.10.1" "neovim": "^4.11.0"
} }
}, },
"node_modules/@colors/colors": { "node_modules/@colors/colors": {
"version": "1.5.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz",
"integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==",
"engines": { "engines": {
"node": ">=0.1.90" "node": ">=0.1.90"
} }
@ -35,14 +35,14 @@
} }
}, },
"node_modules/@types/triple-beam": { "node_modules/@types/triple-beam": {
"version": "1.3.2", "version": "1.3.5",
"resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.2.tgz", "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz",
"integrity": "sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==" "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw=="
}, },
"node_modules/async": { "node_modules/async": {
"version": "3.2.4", "version": "3.2.5",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz",
"integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg=="
}, },
"node_modules/color": { "node_modules/color": {
"version": "3.2.1", "version": "3.2.1",
@ -126,16 +126,19 @@
"integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A=="
}, },
"node_modules/logform": { "node_modules/logform": {
"version": "2.5.1", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/logform/-/logform-2.5.1.tgz", "resolved": "https://registry.npmjs.org/logform/-/logform-2.6.0.tgz",
"integrity": "sha512-9FyqAm9o9NKKfiAKfZoYo9bGXXuwMkxQiQttkT4YjjVtQVIQtK6LmVtlxmCaFswo6N4AfEkHqZTV0taDtPotNg==", "integrity": "sha512-1ulHeNPp6k/LD8H91o7VYFBng5i1BDE7HoKxVbZiGFidS1Rj65qcywLxX+pVfAPoQJEjRdvKcusKwOupHCVOVQ==",
"dependencies": { "dependencies": {
"@colors/colors": "1.5.0", "@colors/colors": "1.6.0",
"@types/triple-beam": "^1.3.2", "@types/triple-beam": "^1.3.2",
"fecha": "^4.2.0", "fecha": "^4.2.0",
"ms": "^2.1.1", "ms": "^2.1.1",
"safe-stable-stringify": "^2.3.1", "safe-stable-stringify": "^2.3.1",
"triple-beam": "^1.3.0" "triple-beam": "^1.3.0"
},
"engines": {
"node": ">= 12.0.0"
} }
}, },
"node_modules/lru-cache": { "node_modules/lru-cache": {
@ -155,13 +158,13 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
}, },
"node_modules/neovim": { "node_modules/neovim": {
"version": "4.10.1", "version": "4.11.0",
"resolved": "https://registry.npmjs.org/neovim/-/neovim-4.10.1.tgz", "resolved": "https://registry.npmjs.org/neovim/-/neovim-4.11.0.tgz",
"integrity": "sha512-H46Jl2bh/LAFJsitv2MiIK3oCxvQnEK9t3efNMUUkKzsTYlLIikVxGWVk/vJnHzvxoHYBIRB/KHwPAOm+9UStg==", "integrity": "sha512-8JJr7fr43xvldrrM0Y+Oij5JNdHrpi8x/EulEGexshMMWWGgBqL+QN2IbYkwWv8UyArQRbJnawqeuEH7OEu43g==",
"dependencies": { "dependencies": {
"@msgpack/msgpack": "^2.7.1", "@msgpack/msgpack": "^2.8.0",
"semver": "^7.3.5", "semver": "^7.5.4",
"winston": "3.3.3" "winston": "3.11.0"
}, },
"bin": { "bin": {
"neovim-node-host": "bin/cli.js" "neovim-node-host": "bin/cli.js"
@ -275,35 +278,37 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
}, },
"node_modules/winston": { "node_modules/winston": {
"version": "3.3.3", "version": "3.11.0",
"resolved": "https://registry.npmjs.org/winston/-/winston-3.3.3.tgz", "resolved": "https://registry.npmjs.org/winston/-/winston-3.11.0.tgz",
"integrity": "sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw==", "integrity": "sha512-L3yR6/MzZAOl0DsysUXHVjOwv8mKZ71TrA/41EIduGpOOV5LQVodqN+QdQ6BS6PJ/RdIshZhq84P/fStEZkk7g==",
"dependencies": { "dependencies": {
"@colors/colors": "^1.6.0",
"@dabh/diagnostics": "^2.0.2", "@dabh/diagnostics": "^2.0.2",
"async": "^3.1.0", "async": "^3.2.3",
"is-stream": "^2.0.0", "is-stream": "^2.0.0",
"logform": "^2.2.0", "logform": "^2.4.0",
"one-time": "^1.0.0", "one-time": "^1.0.0",
"readable-stream": "^3.4.0", "readable-stream": "^3.4.0",
"safe-stable-stringify": "^2.3.1",
"stack-trace": "0.0.x", "stack-trace": "0.0.x",
"triple-beam": "^1.3.0", "triple-beam": "^1.3.0",
"winston-transport": "^4.4.0" "winston-transport": "^4.5.0"
}, },
"engines": { "engines": {
"node": ">= 6.4.0" "node": ">= 12.0.0"
} }
}, },
"node_modules/winston-transport": { "node_modules/winston-transport": {
"version": "4.5.0", "version": "4.7.0",
"resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.5.0.tgz", "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.7.0.tgz",
"integrity": "sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==", "integrity": "sha512-ajBj65K5I7denzer2IYW6+2bNIVqLGDHqDw3Ow8Ohh+vdW+rv4MZ6eiDvHoKhfJFZ2auyN8byXieDDJ96ViONg==",
"dependencies": { "dependencies": {
"logform": "^2.3.2", "logform": "^2.3.2",
"readable-stream": "^3.6.0", "readable-stream": "^3.6.0",
"triple-beam": "^1.3.0" "triple-beam": "^1.3.0"
}, },
"engines": { "engines": {
"node": ">= 6.4.0" "node": ">= 12.0.0"
} }
}, },
"node_modules/yallist": { "node_modules/yallist": {

View File

@ -1,5 +1,5 @@
{ {
"dependencies": { "dependencies": {
"neovim": "^4.10.1" "neovim": "^4.11.0"
} }
} }

View File

@ -1,3 +0,0 @@
greenlet==3.0.3
msgpack==1.0.8
pynvim==0.5.0