modernize neovim config for 0.10+
- Replace deprecated vim.loop with vim.uv (compat shim for older nvim) - Fix lazy.nvim spec: run -> build for TSUpdate - Remove pinned tags for telescope and treesitter - Replace nvim-osc52 plugin with native vim.g.clipboard OSC 52 - Replace vim.cmd autocmds with nvim_create_augroup/nvim_create_autocmd - Fix vim.wo -> vim.opt for number and signcolumn (apply to all windows) - Remove duplicate toggleterm setup call Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
44ddaefee5
commit
8dfb94ee94
@ -1,8 +1,8 @@
|
|||||||
-- disable netrw at the very start of your init.lua (strongly advised)
|
-- disable netrw at the very start of your init.lua (strongly advised)
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
vim.wo.number = true
|
vim.opt.number = true
|
||||||
vim.wo.signcolumn = "yes"
|
vim.opt.signcolumn = "yes"
|
||||||
vim.o.scrolloff = 3
|
vim.o.scrolloff = 3
|
||||||
vim.o.sidescrolloff = 2
|
vim.o.sidescrolloff = 2
|
||||||
vim.loader.enable()
|
vim.loader.enable()
|
||||||
@ -14,7 +14,8 @@ vim.opt.undoreload = 1000000
|
|||||||
|
|
||||||
-- Loading Lazy plugin manager itself
|
-- Loading Lazy plugin manager itself
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
local uv = vim.uv or vim.loop
|
||||||
|
if not uv.fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
"git",
|
"git",
|
||||||
"clone",
|
"clone",
|
||||||
@ -31,9 +32,8 @@ require("lazy").setup({
|
|||||||
-- Gruvbox colorscheme
|
-- Gruvbox colorscheme
|
||||||
{ "ellisonleao/gruvbox.nvim", priority = 1000 },
|
{ "ellisonleao/gruvbox.nvim", priority = 1000 },
|
||||||
-- Treesitter for better highlighting and moving
|
-- Treesitter for better highlighting and moving
|
||||||
{ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" , tag="v0.9.2"},
|
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
||||||
{ "nvim-telescope/telescope.nvim", tag = "0.1.1", dependencies = { "nvim-lua/plenary.nvim" } },
|
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||||
{ "ojroques/nvim-osc52" },
|
|
||||||
{ "nvim-tree/nvim-tree.lua" },
|
{ "nvim-tree/nvim-tree.lua" },
|
||||||
{ "jeffkreeftmeijer/vim-numbertoggle" },
|
{ "jeffkreeftmeijer/vim-numbertoggle" },
|
||||||
{ "lukas-reineke/indent-blankline.nvim", main="ibl", opts={} },
|
{ "lukas-reineke/indent-blankline.nvim", main="ibl", opts={} },
|
||||||
@ -107,8 +107,6 @@ require("nvim-lastplace").setup({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
require("toggleterm").setup({})
|
|
||||||
|
|
||||||
require("hop").setup()
|
require("hop").setup()
|
||||||
require("mini.ai").setup()
|
require("mini.ai").setup()
|
||||||
require("mini.pairs").setup()
|
require("mini.pairs").setup()
|
||||||
@ -160,11 +158,17 @@ require("lspconfig").lua_ls.setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require("osc52").setup({
|
vim.g.clipboard = {
|
||||||
max_length = 0, -- Maximum length of selection (0 for no limit)
|
name = "OSC 52",
|
||||||
silent = false, -- Disable message on successful copy
|
copy = {
|
||||||
trim = false, -- Trim surrounding whitespaces before copy
|
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
|
||||||
})
|
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
|
||||||
|
},
|
||||||
|
paste = {
|
||||||
|
["+"] = require("vim.ui.clipboard.osc52").paste("+"),
|
||||||
|
["*"] = require("vim.ui.clipboard.osc52").paste("*"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
local hop = require("hop")
|
local hop = require("hop")
|
||||||
-- local directions = require("hop.hint").HintDirection
|
-- local directions = require("hop.hint").HintDirection
|
||||||
@ -264,10 +268,15 @@ function _G.set_terminal_keymaps()
|
|||||||
vim.keymap.set("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
|
vim.keymap.set("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
local aug = vim.api.nvim_create_augroup("user_autocmds", { clear = true })
|
||||||
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
|
vim.api.nvim_create_autocmd("TermOpen", {
|
||||||
vim.cmd("autocmd BufNewFile,BufRead *.tmpl set syntax=python")
|
group = aug,
|
||||||
|
pattern = "term://*",
|
||||||
|
callback = set_terminal_keymaps,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
|
||||||
|
group = aug,
|
||||||
|
pattern = "*.tmpl",
|
||||||
|
command = "set syntax=python",
|
||||||
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>c", require("osc52").copy_operator, { expr = true })
|
|
||||||
vim.keymap.set("n", "<leader>cc", "<leader>c_", { remap = true })
|
|
||||||
vim.keymap.set("v", "<leader>c", require("osc52").copy_visual)
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user