nvim: qol on lualine, bufferline, use nixd as nix lsp

This commit is contained in:
js0ny 2025-10-29 04:55:00 +00:00
parent 6fb3efd1dc
commit cd9c91b9bc
11 changed files with 76 additions and 67 deletions

View file

@ -1,3 +1,3 @@
git:
paging:
- pager: delta --dark --paging=never
pager: delta --dark --paging=never

View file

@ -66,6 +66,9 @@ return {
telemetry = {
enable = false,
},
diagnostics = {
globals = { "vim" },
},
-- Lua LS offers a code formatter
-- Ref: https://github.com/LuaLS/lua-language-server/wiki/Formatter
-- format = {

View file

@ -1,32 +0,0 @@
-- <nixCats>/lsp/nil.lua
-- Nil LSP config
vim.lsp.config("nil", {
cmd = { "nil" },
root_markers = {
"flake.nix",
"flake.lock",
},
filetypes = {
"nix",
},
-- Global config options
settings = {
["nil"] = {
formatting = {
command = { "alejandra" },
},
diagnostics = {
ignored = {},
},
nix = {
maxMemoryMB = 2560,
},
flake = {
autoArchive = false,
autoEvalImputs = true,
nixpkgsInputName = "nixpkgs",
},
},
},
})

View file

@ -0,0 +1,22 @@
---@type vim.lsp.Config
return {
cmd = { "nixd" },
root_markers = { "flake.nix", "flake.lock" },
filetypes = { "nix" },
settings = {
nixpkgs = {
expr = "import <nixpkgs> { }",
},
formatting = {
command = { "alejandra" },
},
options = {
nixos = {
expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.k-on.options',
},
home_manager = {
expr = '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."ruixi@k-on".options',
},
},
},
}

View file

@ -23,7 +23,7 @@ return {
integrations = {
-- lualine = true,
"lualine",
"blink_cmp"
"blink_cmp",
},
},
},
@ -90,11 +90,11 @@ return {
{ "]g", "<cmd>Gitsigns next_hunk<CR>", desc = "Next hunk" },
},
},
-- { -- Highlight and navigate between TODOs
-- "folke/todo-comments.nvim",
-- cmd = { "TodoTelescope" },
-- event = "BufRead",
-- opts = {},
-- dependencies = { "nvim-lua/plenary.nvim" },
-- },
{ -- Highlight and navigate between TODOs
"folke/todo-comments.nvim",
cmd = { "TodoTelescope" },
event = "BufRead",
opts = {},
dependencies = { "nvim-lua/plenary.nvim" },
},
}

View file

@ -23,6 +23,6 @@ return {
-- configuration goes here
},
},
{ import = "plugins.mod.image-nvim" },
-- { import = "plugins.mod.image-nvim" },
{ import = "plugins.mod.snacks-nvim" },
}

View file

@ -5,7 +5,7 @@ return {
-- use a release tag to download pre-built binaries
version = "*",
event = "InsertEnter",
event = { "InsertEnter", "CmdlineEnter" },
---@module 'blink.cmp'
---@type blink.cmp.Config
@ -49,6 +49,16 @@ return {
preset = "luasnip",
},
cmdline = {
keymap = {
preset = "cmdline",
["<CR>"] = { "fallback" },
},
completion = {
menu = { auto_show = true },
},
},
sources = {
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
per_filetype = {

View file

@ -21,6 +21,7 @@ return {
{ "<leader>b7", "<cmd>BufferLineGotoBuffer 7<CR>", desc = "Switch to Buffer #7" },
{ "<leader>b8", "<cmd>BufferLineGotoBuffer 8<CR>", desc = "Switch to Buffer #8" },
{ "<leader>b9", "<cmd>BufferLineGotoBuffer 9<CR>", desc = "Switch to Buffer #9" },
{ "<leader>b#", "<cmd>BufferLineGotoBuffer #<CR>", desc = "Switch to Buffer #" },
{ "<leader>bb", "<cmd>BufferLinePick<CR>", desc = "Quick Switch Buffers" },
{ "<leader>bD", "<cmd>BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>bxx", "<cmd>BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
@ -48,7 +49,7 @@ return {
offsets = {
{ filetype = "NvimTree", text = "资源管理器", text_align = "center" },
},
separator_style = "thin",
separator_style = "slope",
},
highlights = get_highlight(),
},

View file

@ -1,18 +1,22 @@
-- I forgot why I keep this plugin, I use snacks.nvim currently
return {}
-- 2025-03-03
-- If current session is not spawn by neovide, do not load image.nvim
-- neovide did not support image viewer yet
-- https://github.com/neovide/neovide/issues/2088
-- Disable on: Neovide, alacritty and windows
if vim.g.neovide then
return {}
elseif vim.env.TERM_PROGRAM == "alacritty" then
return {}
elseif vim.loop.os_uname().sysname:lower() == "windows_nt" then
return {}
else
return {
"3rd/image.nvim",
opts = {},
event = "BufReadPre",
}
end
-- if vim.g.neovide then
-- return {}
-- elseif vim.env.TERM_PROGRAM == "alacritty" then
-- return {}
-- elseif vim.loop.os_uname().sysname:lower() == "windows_nt" then
-- return {}
-- else
-- return {
-- "3rd/image.nvim",
-- opts = {},
-- event = "BufReadPre",
-- }
-- end

View file

@ -20,7 +20,7 @@ local config = {
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
-- theme = "catppuccin",
theme = vim.g.colors_name,
theme = "auto",
-- IDE-like Global Status
globalstaus = true,
},

View file

@ -93,7 +93,8 @@
"Nix": {
"formatter": {
"external": {
"command": "alejandra"
"command": "alejandra",
"arguments": ["--quiet", "--"]
}
},
"completions": {