feat: neovim better split direction, compile-mode.nvim, format config.lua

This commit is contained in:
2026-03-09 15:44:17 -04:00
parent 7d8d0bb269
commit 57e2fe7ea7
+35 -8
View File
@@ -11,6 +11,8 @@ vim.opt.wildmenu = true
vim.opt.undofile = true
vim.opt.termguicolors = true
vim.opt.shell = "fish"
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>n", "<cmd>Explore .<cr>", {})
@@ -33,8 +35,32 @@ vim.pack.add({
"https://github.com/nvimtools/none-ls.nvim",
"https://github.com/nvim-lua/plenary.nvim",
"https://github.com/nvim-telescope/telescope.nvim",
"https://github.com/ej-shafran/compile-mode.nvim"
})
vim.g.compile_mode = {
default_command = "nix build",
recompile_no_fail = true,
buffer_name = "*compile*"
}
vim.keymap.set("n", "<leader>c", function()
local id = -1
local bufname = vim.g.compile_mode.buffer_name
for _, bufid in ipairs(vim.api.nvim_list_bufs()) do
local name = vim.api.nvim_buf_get_name(bufid)
if string.sub(name, -string.len(bufname)) == bufname then
id = bufid
break
end
end
if id == -1 then
vim.cmd("Recompile")
else
vim.bo[id].buflisted = false
vim.api.nvim_buf_delete(id, { unload = false })
end
end)
local file_types = { "rust", "zig", "haskell", "c", "cpp" }
require("nvim-treesitter").install(file_types)
vim.api.nvim_create_autocmd("FileType", {
@@ -51,7 +77,7 @@ vim.keymap.set("n", "<leader>f", telescope.find_files, {})
vim.keymap.set("n", "<leader>t", telescope.live_grep, {})
vim.keymap.set("n", "<leader>m", function()
telescope.man_pages({
sections = {"2", "3", "4", "5"},
sections = { "2", "3", "4", "5" },
})
end, {})
@@ -110,19 +136,20 @@ local __wrapConfig = function(cfg)
return cfg
end
vim.lsp.config("clangd", {cmd = {"clangd"}, filetypes = {"c", "cpp"}})
vim.lsp.config("clangd", { cmd = { "clangd" }, filetypes = { "c", "cpp" } })
vim.lsp.enable("clangd")
vim.lsp.config("haskell-language-server", { cmd = {"haskell-language-server-wrapper", "--lsp"}, filetypes = {"haskell"}})
vim.lsp.config("haskell-language-server",
{ cmd = { "haskell-language-server-wrapper", "--lsp" }, filetypes = { "haskell" } })
vim.lsp.enable("haskell-language-server")
vim.lsp.config("lua_ls", { cmd = {"lua-language-server"}, filetypes = {"lua"}})
vim.lsp.config("lua_ls", { cmd = { "lua-language-server" }, filetypes = { "lua" } })
vim.lsp.enable("lua_ls")
vim.lsp.config("nil_ls", { cmd = {"nil"}, filetypes = {"nix"}})
vim.lsp.config("nil_ls", { cmd = { "nil" }, filetypes = { "nix" } })
vim.lsp.enable("nil_ls")
vim.lsp.config("nixd", { cmd = {"nixd"}, filetypes = {"nix"}})
vim.lsp.config("nixd", { cmd = { "nixd" }, filetypes = { "nix" } })
vim.lsp.enable("nixd")
vim.lsp.config("pyright", {cmd = {"pyright"}, filetypes = {"python"}})
vim.lsp.config("pyright", { cmd = { "pyright" }, filetypes = { "python" } })
vim.lsp.enable("pyright")
vim.lsp.config("zls", {cmd = {"zls"}, filetypes = {"zig"}})
vim.lsp.config("zls", { cmd = { "zls" }, filetypes = { "zig" } })
vim.lsp.enable("zls")
-- https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/palettes/mocha.lua