Compare commits

..

4 Commits

Author SHA1 Message Date
Henrik Bakken 0d1702456e nvim stop ftplugin hijacking omnifunc 2026-05-09 02:01:23 +02:00
Henrik Bakken 2914b79ded nvim ty disable autoimports 2026-05-09 02:01:18 +02:00
Henrik Bakken 1c8d5284ca nvim lspconfig 2026-05-09 02:01:18 +02:00
Henrik Bakken 640379c105 sway+tmux added bash emergency brakes 2026-05-06 13:43:03 +02:00
3 changed files with 47 additions and 42 deletions
+44 -41
View File
@@ -42,7 +42,7 @@ vim.opt.smartindent = false
vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" }
-- Completion Window/Popup settings -- Completion Window/Popup settings
vim.opt.completeopt = { "menu", "popup", "preview" } vim.opt.completeopt = { "menu", "menuone", "noselect", "noinsert", "popup", "preview" }
vim.opt.pumblend = 10 vim.opt.pumblend = 10
vim.opt.pumheight = 10 vim.opt.pumheight = 10
vim.opt.winminwidth = 5 vim.opt.winminwidth = 5
@@ -228,30 +228,6 @@ map("n", "]e", diagnostic_goto(1, "ERROR"), { desc = "Next Error" })
map("n", "]w", diagnostic_goto(1, "WARN"), { desc = "Next Warning" }) map("n", "]w", diagnostic_goto(1, "WARN"), { desc = "Next Warning" })
map("n", "gl", vim.diagnostic.setloclist, { desc = "Diagnostics to Location List" }) map("n", "gl", vim.diagnostic.setloclist, { desc = "Diagnostics to Location List" })
-- Buffer-local LSP mappings
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
local bmap = function(mode, keys, func, desc) vim.keymap.set(mode, keys, func, { buffer = ev.buf, desc = desc }) end
bmap("n", "gd", vim.lsp.buf.definition, "Goto Definition")
bmap("n", "gD", vim.lsp.buf.declaration, "Goto Declaration")
bmap("n", "gy", vim.lsp.buf.type_definition, "Goto Type Definition")
bmap({ "n", "i" }, "<M-x>", vim.lsp.buf.signature_help, "Signature Help")
local client = vim.lsp.get_client_by_id(ev.data.client_id)
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
bmap(
"n",
"<leader>uh",
function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end,
"Toggle Inlay Hints"
)
end
end,
})
-- ---------------------------------------- -- ----------------------------------------
-- AUTOCMD -- AUTOCMD
-- ---------------------------------------- -- ----------------------------------------
@@ -345,17 +321,8 @@ local function makespecs_themes()
end end
local function makespec_lspconfig() local function makespec_lspconfig()
local rootdirfix = function(root_markers)
return function(bufnr, on_dir)
on_dir(require("lspconfig").util.root_pattern(unpack(root_markers))(vim.fn.bufname(bufnr)))
end
end
return { return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
lazy = false,
event = { "BufReadPost", "BufNewFile" },
keys = { { "<F4>", "<cmd>checkhealth vim.lsp<cr>", noremap = true, desc = "LSP Info" } },
config = function() config = function()
-- Lua -- Lua
vim.lsp.config("lua_ls", { vim.lsp.config("lua_ls", {
@@ -405,17 +372,17 @@ local function makespec_lspconfig()
vim.lsp.config("ty", { vim.lsp.config("ty", {
cmd = { "ty", "server" }, cmd = { "ty", "server" },
filetypes = { "python" }, filetypes = { "python" },
root_dir = rootdirfix({ ".git", "pyproject.toml", "setup.py", "setup.cfg" }), root_markers = { ".git" },
settings = { ty = { experimental = { rename = true } } }, settings = { ty = { completions = { autoImport = false }, experimental = { rename = true } } },
}) })
vim.lsp.config("pyrefly", { vim.lsp.config("pyrefly", {
cmd = { "pyrefly", "lsp" }, cmd = { "pyrefly", "lsp" },
filetypes = { "python" }, filetypes = { "python" },
root_dir = rootdirfix({ ".git", "pyproject.toml", "setup.py", "setup.cfg", "pyrefly.toml" }), root_markers = { ".git" },
}) })
vim.lsp.config("pylsp", { vim.lsp.config("pylsp", {
filetypes = { "python" }, filetypes = { "python" },
root_dir = rootdirfix({ ".git", "pyproject.toml", "setup.py", "setup.cfg" }), root_markers = { ".git" },
settings = { settings = {
pylsp = { pylsp = {
plugins = { plugins = {
@@ -429,7 +396,7 @@ local function makespec_lspconfig()
vim.lsp.config("basedpyright", { vim.lsp.config("basedpyright", {
cmd = { "basedpyright-langserver", "--stdio", "--threads", "20" }, cmd = { "basedpyright-langserver", "--stdio", "--threads", "20" },
filetypes = { "python" }, filetypes = { "python" },
root_dir = rootdirfix({ ".git", "pyproject.toml", "setup.py", "setup.cfg", "pyrightconfig.json" }), root_markers = { ".git" },
settings = { settings = {
python = { python = {
analysis = { analysis = {
@@ -482,13 +449,13 @@ local function makespec_lspconfig()
vim.lsp.config("tinymist", { vim.lsp.config("tinymist", {
cmd = { "tinymist" }, cmd = { "tinymist" },
filetypes = { "typst" }, filetypes = { "typst" },
root_dir = rootdirfix({ ".git", "typst.toml" }), root_markers = { ".git", "typst.toml" },
}) })
vim.lsp.config("bashls", { vim.lsp.config("bashls", {
cmd = { "bash-language-server", "start" }, cmd = { "bash-language-server", "start" },
filetypes = { "sh", "bash" }, filetypes = { "sh", "bash" },
root_dir = rootdirfix({ ".git" }), root_markers = { ".git" },
}) })
vim.lsp.enable("bashls") vim.lsp.enable("bashls")
@@ -502,6 +469,42 @@ local function makespec_lspconfig()
vim.lsp.enable("tinymist") vim.lsp.enable("tinymist")
vim.lsp.enable("vtsls") vim.lsp.enable("vtsls")
vim.lsp.enable("yamlls") vim.lsp.enable("yamlls")
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("DefeatFtpluginOmnifunc", { clear = true }),
pattern = { "python" },
callback = function(ev)
vim.schedule(function()
if vim.api.nvim_buf_is_valid(ev.buf) then vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" end
end)
end,
})
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", { clear = true }),
callback = function(ev)
local bmap = function(mode, keys, func, desc)
vim.keymap.set(mode, keys, func, { buffer = ev.buf, desc = desc, silent = true })
end
bmap("n", "gd", vim.lsp.buf.definition, "Goto Definition")
bmap("n", "gD", vim.lsp.buf.declaration, "Goto Declaration")
bmap("n", "gy", vim.lsp.buf.type_definition, "Goto Type Definition")
bmap({ "n", "i" }, "<M-x>", vim.lsp.buf.signature_help, "Signature Help")
bmap("i", "<C-Space>", "<C-x><C-o>", "Trigger LSP Completion")
bmap("i", "<C-l>", "<C-n>", "Buffer/Keyword Completion")
bmap("i", "<C-f>", "<C-x><C-f>", "File Path Completion")
local client = vim.lsp.get_client_by_id(ev.data.client_id)
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
bmap(
"n",
"<leader>uh",
function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end,
"Toggle Inlay Hints"
)
end
end,
})
end, end,
} }
end end
+1 -1
View File
@@ -67,7 +67,7 @@ set $powermenu ~/.config/sway/scripts/power_menu.sh
# ------------------------------------------ # ------------------------------------------
# Launch the terminal # Launch the terminal
bindsym $mod+Return exec $term bindsym $mod+Return exec $term
bindsym $mod+Shift+Return exec foot bindsym Mod4+Shift+Return exec foot bash
# Kill focused window # Kill focused window
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# Lock screen # Lock screen
+2
View File
@@ -126,6 +126,8 @@ bind v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}" bind s split-window -v -c "#{pane_current_path}"
bind V split-window -fh -c "#{pane_current_path}" bind V split-window -fh -c "#{pane_current_path}"
bind S split-window -fv -c "#{pane_current_path}" bind S split-window -fv -c "#{pane_current_path}"
bind x split-window -fh bash
# Change layouts # Change layouts
bind o rotate-window bind o rotate-window