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)
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
vim.wo.number = true
|
||||
vim.wo.signcolumn = "yes"
|
||||
vim.opt.number = true
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.o.scrolloff = 3
|
||||
vim.o.sidescrolloff = 2
|
||||
vim.loader.enable()
|
||||
@ -14,7 +14,8 @@ vim.opt.undoreload = 1000000
|
||||
|
||||
-- Loading Lazy plugin manager itself
|
||||
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({
|
||||
"git",
|
||||
"clone",
|
||||
@ -31,9 +32,8 @@ require("lazy").setup({
|
||||
-- Gruvbox colorscheme
|
||||
{ "ellisonleao/gruvbox.nvim", priority = 1000 },
|
||||
-- Treesitter for better highlighting and moving
|
||||
{ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" , tag="v0.9.2"},
|
||||
{ "nvim-telescope/telescope.nvim", tag = "0.1.1", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
{ "ojroques/nvim-osc52" },
|
||||
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
||||
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
{ "nvim-tree/nvim-tree.lua" },
|
||||
{ "jeffkreeftmeijer/vim-numbertoggle" },
|
||||
{ "lukas-reineke/indent-blankline.nvim", main="ibl", opts={} },
|
||||
@ -107,8 +107,6 @@ require("nvim-lastplace").setup({
|
||||
})
|
||||
|
||||
|
||||
require("toggleterm").setup({})
|
||||
|
||||
require("hop").setup()
|
||||
require("mini.ai").setup()
|
||||
require("mini.pairs").setup()
|
||||
@ -160,11 +158,17 @@ require("lspconfig").lua_ls.setup({
|
||||
},
|
||||
})
|
||||
|
||||
require("osc52").setup({
|
||||
max_length = 0, -- Maximum length of selection (0 for no limit)
|
||||
silent = false, -- Disable message on successful copy
|
||||
trim = false, -- Trim surrounding whitespaces before copy
|
||||
})
|
||||
vim.g.clipboard = {
|
||||
name = "OSC 52",
|
||||
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 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)
|
||||
end
|
||||
|
||||
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
||||
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
|
||||
vim.cmd("autocmd BufNewFile,BufRead *.tmpl set syntax=python")
|
||||
local aug = vim.api.nvim_create_augroup("user_autocmds", { clear = true })
|
||||
vim.api.nvim_create_autocmd("TermOpen", {
|
||||
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