commit 583b8c982e3159a41aa13f7987d1196541866d98
parent 9601661483c02e24aa2c578f31dfbb6abc0575a2
Author: Milutin Popovic <milutin@popovic.xyz>
Date: Fri, 3 Apr 2026 14:34:47 +0100
vim 0.12
Diffstat:
2 files changed, 43 insertions(+), 25 deletions(-)
diff --git a/.config/nvim/lua/config/set.lua b/.config/nvim/lua/config/set.lua
@@ -33,7 +33,7 @@ vim.opt.timeoutlen = 1000
vim.opt.scrolloff = 10
vim.opt.mouse = ""
vim.opt.mousescroll = "ver:0,hor:0"
-vim.opt.wildmode= "longest,list,full"
+vim.opt.wildmode = "longest,list,full"
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
@@ -41,3 +41,28 @@ vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.spellsuggest = { "best", 5 }
+
+-- Undotree toggle
+vim.cmd("packadd nvim.undotree")
+vim.keymap.set("n", "<leader>u", function()
+ require("undotree").open({
+ command = math.floor(vim.api.nvim_win_get_width(0) / 3) .. "vnew",
+ })
+end, { desc = "[U]ndotree toggle" })
+
+-- incremental selection treesitter/lsp
+vim.keymap.set({ "n", "x", "o" }, "<A-o>", function()
+ if vim.treesitter.get_parser(nil, nil, { error = false }) then
+ require("vim.treesitter._select").select_parent(vim.v.count1)
+ else
+ vim.lsp.buf.selection_range(vim.v.count1)
+ end
+end, { desc = "Select parent treesitter node or outer incremental lsp selections" })
+
+vim.keymap.set({ "n", "x", "o" }, "<A-i>", function()
+ if vim.treesitter.get_parser(nil, nil, { error = false }) then
+ require("vim.treesitter._select").select_child(vim.v.count1)
+ else
+ vim.lsp.buf.selection_range(-vim.v.count1)
+ end
+end, { desc = "Select child treesitter node or inner incremental lsp selections" })
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
@@ -130,36 +130,29 @@ return {
["lua_ls"] = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({
- on_init = function(client)
- if client.workspace_folders then
- local path = client.workspace_folders[1].name
- if
- path ~= vim.fn.stdpath("config")
- and (
- vim.uv.fs_stat(path .. "/.luarc.json")
- or vim.uv.fs_stat(path .. "/.luarc.jsonc")
- )
- then
- return
- end
- end
-
- client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
+ settings = {
+ Lua = {
runtime = {
- version = "LuaJIT",
- path = {
- "lua/?.lua",
- "lua/?/init.lua",
+ -- Tell the language server which version of Lua you're using
+ -- (most likely LuaJIT in the case of Neovim)
+ version = 'LuaJIT',
+ },
+ diagnostics = {
+ -- Get the language server to recognize the `vim` global
+ globals = {
+ 'vim',
+ 'require'
},
},
workspace = {
- checkThirdParty = false,
+ -- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
- })
- end,
- settings = {
- Lua = {},
+ -- Do not send telemetry data containing a randomized but unique identifier
+ telemetry = {
+ enable = false,
+ },
+ },
},
})
end,