nvim: del v0.11 migrations.lua, lazydev support

This commit is contained in:
js0ny 2025-10-29 03:26:29 +00:00
parent 7540d37422
commit 6fb3efd1dc
11 changed files with 80 additions and 92 deletions

View file

@ -1,8 +1,16 @@
local signs = require("config.icons").diagnostics
local dsigns = require("config.icons").diagnostics
-- This provides the diagnostics signs near the line numbers
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
-- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
vim.diagnostic.config(hl, { text = icon, texthl = hl, numhl = "" })
end
vim.diagnostic.config({
virtual_text = true,
virtual_lines = false,
severity_sort = true,
update_in_insert = true,
float = true,
signs = {
text = {
[vim.diagnostic.severity.HINT] = dsigns.Hint,
[vim.diagnostic.severity.WARN] = dsigns.Warning,
[vim.diagnostic.severity.ERROR] = dsigns.Error,
},
},
})

View file

@ -0,0 +1,6 @@
local lsp_configs = {}
for _, v in ipairs(vim.api.nvim_get_runtime_file("lsp/*", true)) do
local name = vim.fn.fnamemodify(v, ":t:r")
lsp_configs[name] = true
end
vim.lsp.enable(vim.tbl_keys(lsp_configs))

View file

@ -1,31 +0,0 @@
local nvim_version = vim.version()
if nvim_version.minor ~= 11 then
return
end
vim.diagnostic.config({
virtual_lines = true,
})
-- vim.lsp.enable({
-- "clangd",
-- "luals",
-- })
local lsp_configs = {}
for _, v in ipairs(vim.api.nvim_get_runtime_file('lsp/*', true)) do
local name = vim.fn.fnamemodify(v, ':t:r')
lsp_configs[name] = true
end
vim.lsp.enable(vim.tbl_keys(lsp_configs))
-- Delete 0.11 new gr- keymaps
vim.keymap.del({ "n" }, "grn")
vim.keymap.del({ "n", "x" }, "gra")
vim.keymap.del({ "n" }, "gri")

View file

@ -52,25 +52,54 @@ local keymaps_basic = { -- Modification of Original Keymap - Colemak
opts = { desc = "Up", silent = true },
},
{ mode = mode_arrow, keys = "h", cmd = "h", opts = { desc = "Left", silent = true } },
{
mode = mode_arrow,
keys = "h",
cmd = "h",
opts = { desc = "Left", silent = true },
},
-- { mode = mode_arrow, keys = "i", cmd = "l", opts = { desc = "Right", silent = true } },
{ mode = { "n" }, keys = "H", cmd = "<cmd>bprevious<CR>", opts = { desc = "Previous Buffer" } },
{ mode = { "n" }, keys = "L", cmd = "<cmd>bnext<CR>", opts = { desc = "Next Buffer" } },
{ mode = { "v", "o", "x" }, keys = "H", cmd = "^", opts = { desc = "Start of Line" } },
{ mode = { "v", "o", "x" }, keys = "L", cmd = "$", opts = { desc = "End of Line" } },
{ mode = mode_arrow, keys = "J", cmd = "5j", opts = { desc = "Up 5 Lines" } },
{ mode = mode_arrow, keys = "K", cmd = "5e", opts = { desc = "Down 5 Lines" } },
{ keys = "Y", cmd = "y$", opts = { desc = "Yank to End of Line" } },
{ mode = mode_arrow, keys = "J", cmd = "5j" },
{ mode = mode_arrow, keys = "K", cmd = "5k" },
-- { mode = { "n", "o", "x" }, keys = "l", cmd = "i", opts = { desc = "Insert" } },
-- { keys = "L", cmd = "I", opts = { desc = "Insert at Start of Line" } },
-- { mode = mode_arrow, keys = "k", cmd = "n", opts = { desc = "Next Search" } },
-- { mode = mode_arrow, keys = "K", cmd = "N", opts = { desc = "Previous Search" } },
-- { mode = mode_arrow, keys = "j", cmd = "e", opts = { desc = "jump to end of word" } },
-- { mode = mode_arrow, keys = "J", cmd = "E", opts = { desc = "jump to end of WORD" } },
{
mode = { "n" },
keys = "H",
cmd = "<cmd>bprevious<CR>",
opts = { desc = "Previous Buffer" },
},
{
mode = { "n" },
keys = "L",
cmd = "<cmd>bnext<CR>",
opts = { desc = "Next Buffer" },
},
{
mode = { "v", "o", "x" },
keys = "H",
cmd = "^",
opts = { desc = "Start of Line" },
},
{
mode = { "v", "o", "x" },
keys = "L",
cmd = "$",
opts = { desc = "End of Line" },
},
{
mode = mode_arrow,
keys = "J",
cmd = "5j",
opts = { desc = "Up 5 Lines" },
},
{
mode = mode_arrow,
keys = "K",
cmd = "5e",
opts = { desc = "Down 5 Lines" },
},
{ keys = "Y", cmd = "y$", opts = { desc = "Yank to End of Line" } },
{ mode = mode_arrow, keys = "J", cmd = "5j" },
{ mode = mode_arrow, keys = "K", cmd = "5k" },
-- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L60
{ keys = "<Esc>", cmd = "<Cmd>nohlsearch<Bar>diffupdate<CR>", opts = { desc = "Clear Search Highlight" } },
{ keys = "<Esc>", cmd = "<Cmd>nohlsearch<Bar>diffupdate<CR>", opts = { desc = "Clear Search Highlight" } },
}
return keymaps_basic

View file

@ -17,24 +17,14 @@ utils.set_keymaps(keymaps_basic)
utils.set_keymaps(keymaps_nvim_tree_general)
utils.set_keymaps(keymaps_modifier)
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin
-- local function set_markdown_keymaps(bufnr)
-- local opts = { noremap = true, silent = true, buffer = bufnr }
-- vim.keymap.set("v", "`", 'c`<C-r>"`<Esc>', opts)
-- end
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = "markdown",
-- callback = function()
-- set_markdown_keymaps(0)
-- end,
-- })
-- Added in neovim 0.11
-- vim.keymap.del({ "n", "x" }, "grn")
vim.keymap.del({ "n", "x" }, "gra")
vim.keymap.del({ "n" }, "gri")
-- which-key.nvim
if vim.g.loaded_which_key then
require("keymaps.which")
end
require("keymaps.visual-multi")
return M

View file

@ -1,9 +1,12 @@
return {
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
ft = "lua", -- only load on lua files
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
enabled = function(root_dir)
return vim.g.lazydev_enabled == nil and true or vim.g.lazy
end,
}

View file

@ -12,6 +12,7 @@ return {
python = { "isort", "black" },
javascript = { "prettierd", "prettier", stop_after_first = true },
},
-- Set default options
default_format_opts = {
lsp_format = "fallback",

View file

@ -80,6 +80,9 @@ M.command = {
M.encoding = {
"o:encoding",
color = { fg = colors.scheme.green, gui = "bold" },
cond = function()
return vim.opt.encoding:get() ~= "utf-8"
end,
}
M.indent = {