many small fixes and improvements, i think

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-10-07 19:40:37 -05:00
parent 31a6fc294d
commit 468195ab00
7 changed files with 53 additions and 57 deletions

View file

@ -32,7 +32,7 @@ vim.filetype.add({
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
group = group,
callback = function()
if vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then
if vim.bo.buftype ~= "terminal" and vim.bo.filetype ~= "TelescopePrompt" and vim.bo.filetype ~= nil and vim.bo.filetype ~= "" then
vim.api.nvim_command("stopinsert")
end
end,

View file

@ -14,7 +14,7 @@ vim.opt.mouse = "a"
vim.opt.updatetime = 250
-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
vim.opt.timeoutlen = 300
vim.opt.timeoutlen = 250
-- line numbering, relative
vim.opt.number = true
@ -54,7 +54,6 @@ vim.opt.list = true
vim.opt.listchars = { tab = "", trail = "·", nbsp = "", eol = "" }
-- Search settings
vim.opt.hlsearch = true
vim.opt.incsearch = true
-- Preview substitutions live, as you type
@ -71,6 +70,7 @@ vim.opt.splitright = true
vim.opt.completeopt = "menu,menuone,noinsert"
vim.diagnostic.config({
float = { border = "single" },
virtual_text = false,
})
-- Minimal number of screen lines to keep above and below the cursor.

View file

@ -46,6 +46,7 @@ return {
-- Scroll the documentation window [b]ack / [f]orward
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.abort(),
["<esc>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.abort()

View file

@ -159,9 +159,6 @@ return {
vim.keymap.set("n", "m", api.marks.toggle, opts("Toggle Bookmark"))
vim.keymap.set("n", "<leader>c", api.fs.copy.absolute_path, opts("Copy Path to Clipboard"))
vim.keymap.set("n", "h", api.node.navigate.parent_close, opts("Close Directory"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
end,
}

View file

@ -70,11 +70,13 @@ return {
end,
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
U.safeRequire("cmp_nvim_lsp", function(c)
capabilities = vim.tbl_deep_extend("force", capabilities, c.default_capabilities())
end)
local schemastore = require("schemastore")
local capabilities = vim.lsp.protocol.make_client_capabilities()
U.safeRequire("cmp_nvim_lsp", function(c)
capabilities = vim.tbl_deep_extend("force", capabilities, c.default_capabilities())
end)
-- Export common capabilities to all servers via vim.lsp.config('*')
vim.lsp.config('*', { capabilities = capabilities })
local schemastore = require("schemastore")
-- TODO finish porting over lsp configs: https://github.com/RingOfStorms/nvim/blob/master/lua/plugins/lsp.lua
local servers = {
@ -84,7 +86,6 @@ return {
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- Note that `rust-analyzer` is done via mrcjkb/rustaceanvim plugin above, do not register it here.
lua_ls = {
capabilities = capabilities,
settings = {
Lua = {
runtime = {
@ -133,26 +134,21 @@ return {
-- },
-- },
gopls = {
capabilities = capabilities,
single_file_support = true,
},
nil_ls = { -- nix
capabilities = capabilities,
},
ts_ls = {
-- typescript/javascript
capabilities = capabilities,
implicitProjectConfiguration = {
checkJs = true,
},
},
svelte = {
-- svelte
capabilities = capabilities,
},
tailwindcss = {
-- tailwind css
capabilities = capabilities,
-- https://www.tailwind-variants.org/docs/getting-started#intellisense-setup-optional
tailwindCSS = {
experimental = {
@ -164,11 +160,9 @@ return {
},
cssls = {
-- css
capabilities = capabilities,
},
jsonls = {
-- json
capabilities = capabilities,
settings = {
json = {
schemas = schemastore.json.schemas(),
@ -178,19 +172,15 @@ return {
},
-- python
pylsp = {
capabilities = capabilities,
},
marksman = {
-- markdown
capabilities = capabilities,
},
taplo = {
-- toml
capabilities = capabilities,
},
yamlls = {
-- yaml
capabilities = capabilities,
settings = {
yaml = {
schemas = schemastore.yaml.schemas(),
@ -203,40 +193,53 @@ return {
},
lemminx = {
-- xml
capabilities = capabilities,
},
-- ocamllsp = {
-- -- ocaml
-- capabilities = capabilities,
-- }
}
if NIX then
local lsp_servers = vim.tbl_keys(servers or {})
for _, server_name in ipairs(lsp_servers) do
local server_opts = servers[server_name] or {}
vim.lsp.config[server_name] = server_opts
-- Remove new global default keymaps added by Nvim if you prefer your own bindings
local global_unmaps = {
{ mode = 'n', lhs = 'gra' },
{ mode = 'n', lhs = 'gri' },
{ mode = 'n', lhs = 'grn' },
{ mode = 'n', lhs = 'grr' },
{ mode = 'n', lhs = 'grt' },
{ mode = 'n', lhs = 'gO' },
{ mode = 'n', lhs = 'K' },
{ mode = 'i', lhs = '<C-S>' },
}
for _, m in ipairs(global_unmaps) do
pcall(vim.keymap.del, m.mode, m.lhs)
end
if NIX then
local lsp_servers = vim.tbl_keys(servers or {})
for _, server_name in ipairs(lsp_servers) do
local server_opts = servers[server_name] or {}
vim.lsp.config(server_name, server_opts)
vim.lsp.enable(server_name)
end
else
-- TODO test this out on a non nix setup...
require("mason").setup()
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
"stylua", -- Used to format Lua code TODO come back to this, more about linter/formatter configs
})
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
require("mason-lspconfig").setup({
handlers = {
function(server_name)
local server = servers[server_name] or {}
server.capabilities =
vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
vim.lsp.config[server_name] = server
vim.lsp.enable(server_name)
end,
},
})
end
else
-- TODO test this out on a non nix setup...
require("mason").setup()
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
"stylua", -- Used to format Lua code TODO come back to this, more about linter/formatter configs
})
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
require("mason-lspconfig").setup({
handlers = {
function(server_name)
local server = servers[server_name] or {}
-- let vim.lsp.config('*') provide the base capabilities; do not reassign capabilities here
vim.lsp.config(server_name, server)
vim.lsp.enable(server_name)
end,
},
})
end
end,
},
}

View file

@ -44,14 +44,9 @@ return {
end,
additional_vim_regex_highlighting = false,
},
incremental_selection = { enable = true },
ident = { enable = true },
autotag = { enable = true },
rainbow = {
enable = true,
extended_mode = true,
max_file_lines = nil,
},
incremental_selection = { enable = true },
indent = { enable = true },
autotag = { enable = true },
}, nonNixOpts)
end,
config = function(_, opts)