Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c61efc6f5c | |||
| 3cbfe566e4 | |||
| 26e9593aab |
@@ -1,6 +1,7 @@
|
||||
{ themeName }:
|
||||
''
|
||||
require("kanagawa").setup({
|
||||
dimInactive = true,
|
||||
colors = {
|
||||
theme = {
|
||||
all = {
|
||||
@@ -37,6 +38,24 @@
|
||||
DiagnosticVirtualTextInfo = makeDiagnosticColor(theme.diag.info),
|
||||
DiagnosticVirtualTextWarn = makeDiagnosticColor(theme.diag.warning),
|
||||
DiagnosticVirtualTextError = makeDiagnosticColor(theme.diag.error),
|
||||
|
||||
DiagnosticVirtualLinesHint = makeDiagnosticColor(theme.diag.hint),
|
||||
DiagnosticVirtualLinesInfo = makeDiagnosticColor(theme.diag.info),
|
||||
DiagnosticVirtualLinesWarn = makeDiagnosticColor(theme.diag.warning),
|
||||
DiagnosticVirtualLinesError = makeDiagnosticColor(theme.diag.error),
|
||||
|
||||
FloatBorder = { fg = theme.ui.float.fg_border, bg = theme.ui.float.bg },
|
||||
NormalFloat = { fg = theme.ui.float.fg, bg = theme.ui.float.bg },
|
||||
WinBar = { fg = theme.ui.fg_dim, bg = "NONE" },
|
||||
WinBarNC = { fg = theme.ui.nontext, bg = theme.ui.bg_dim },
|
||||
|
||||
BufferLineFill = { bg = theme.ui.bg_m3 },
|
||||
BufferLineBackground = { fg = theme.ui.fg_dim, bg = theme.ui.bg_m3 },
|
||||
BufferLineBufferSelected = { fg = theme.ui.fg, bg = theme.ui.bg, bold = true },
|
||||
BufferLineModified = { fg = theme.vcs.changed, bg = theme.ui.bg_m3 },
|
||||
BufferLineModifiedSelected = { fg = theme.vcs.changed, bg = theme.ui.bg },
|
||||
BufferLineDiagnostic = { fg = theme.ui.nontext, bg = theme.ui.bg_m3 },
|
||||
BufferLineDiagnosticSelected = { fg = theme.ui.fg_dim, bg = theme.ui.bg },
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -57,6 +57,7 @@ in
|
||||
astro-language-server
|
||||
tinymist
|
||||
typstyle
|
||||
websocat
|
||||
|
||||
# ty
|
||||
# basedpyright
|
||||
@@ -64,51 +65,88 @@ in
|
||||
ruff
|
||||
];
|
||||
|
||||
# 3. Plugins (from startupPlugins & optionalPlugins)
|
||||
# Since you use lz.n in Lua, we just list them all here.
|
||||
# The wrapper will add them to the packpath.
|
||||
# 3. Plugins
|
||||
# Nix provisions plugins; lz.n controls when lazy specs are packadd'd.
|
||||
specs = {
|
||||
# Core lazy-loading plugin
|
||||
lz-n = {
|
||||
data = pkgs.vimPlugins.lz-n;
|
||||
};
|
||||
plenary = {
|
||||
data = pkgs.vimPlugins.plenary-nvim;
|
||||
};
|
||||
|
||||
# All other plugins
|
||||
general = {
|
||||
support = {
|
||||
data = with pkgs.vimPlugins; [
|
||||
plenary-nvim
|
||||
kanagawa-nvim
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-treesitter-textobjects
|
||||
trouble-nvim
|
||||
guess-indent-nvim
|
||||
which-key-nvim
|
||||
telescope-nvim
|
||||
telescope-fzf-native-nvim
|
||||
telescope-ui-select-nvim
|
||||
conform-nvim
|
||||
];
|
||||
};
|
||||
|
||||
completion = {
|
||||
lazy = true;
|
||||
data = with pkgs.vimPlugins; [
|
||||
blink-cmp
|
||||
luasnip
|
||||
friendly-snippets
|
||||
mini-nvim
|
||||
colorful-menu-nvim
|
||||
];
|
||||
};
|
||||
|
||||
lsp = {
|
||||
lazy = true;
|
||||
data = with pkgs.vimPlugins; [
|
||||
nvim-lspconfig
|
||||
lazydev-nvim
|
||||
colorful-menu-nvim
|
||||
lualine-nvim
|
||||
zen-mode-nvim
|
||||
kanagawa-nvim
|
||||
project-nvim
|
||||
nvim-navic
|
||||
trouble-nvim
|
||||
typst-preview-nvim
|
||||
];
|
||||
};
|
||||
|
||||
formatting = {
|
||||
lazy = true;
|
||||
data = with pkgs.vimPlugins; [
|
||||
conform-nvim
|
||||
];
|
||||
};
|
||||
|
||||
core = {
|
||||
lazy = true;
|
||||
data = with pkgs.vimPlugins; [
|
||||
mini-nvim
|
||||
guess-indent-nvim
|
||||
direnv-vim
|
||||
codecompanion-nvim
|
||||
copilot-lua
|
||||
];
|
||||
};
|
||||
|
||||
ui = {
|
||||
lazy = true;
|
||||
data = with pkgs.vimPlugins; [
|
||||
lualine-nvim
|
||||
bufferline-nvim
|
||||
gitsigns-nvim
|
||||
zen-mode-nvim
|
||||
which-key-nvim
|
||||
];
|
||||
};
|
||||
|
||||
project = {
|
||||
lazy = true;
|
||||
data = with pkgs.vimPlugins; [
|
||||
project-nvim
|
||||
];
|
||||
};
|
||||
|
||||
telescope = {
|
||||
lazy = true;
|
||||
data = with pkgs.vimPlugins; [
|
||||
telescope-nvim
|
||||
telescope-fzf-native-nvim
|
||||
telescope-ui-select-nvim
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# 4. Passing Data to Lua (Replacing nixCats.extra)
|
||||
# We put these in `settings` so they appear in require('nix-info').settings
|
||||
# 4. Values exposed to Lua through require("nix-info").settings.
|
||||
settings = {
|
||||
# Hostname/ConfigDir needed for nixd
|
||||
nixdExtras = {
|
||||
@@ -121,6 +159,11 @@ in
|
||||
themeName = repoTheme.name;
|
||||
};
|
||||
|
||||
typstPreviewDependencies = {
|
||||
tinymist = "${pkgs.tinymist}/bin/tinymist";
|
||||
websocat = "${pkgs.websocat}/bin/websocat";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
# 5. Wrapper Configuration
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
vim.loader.enable()
|
||||
|
||||
require("options")
|
||||
require("plugins.lsp")
|
||||
require("plugins.completion")
|
||||
@@ -6,4 +8,3 @@ require("plugins.treesitter")
|
||||
require("plugins.telescope")
|
||||
require("plugins.ui")
|
||||
require("plugins.core")
|
||||
require("plugins.ai")
|
||||
|
||||
@@ -1,137 +1,76 @@
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
-- For more options, you can see `:help option-list`
|
||||
|
||||
vim.o.expandtab = true
|
||||
vim.o.shiftwidth = 2
|
||||
vim.o.tabstop = 2
|
||||
vim.o.softtabstop = 2
|
||||
|
||||
-- Make line numbers default
|
||||
vim.o.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
-- vim.o.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.o.mouse = "a"
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.o.showmode = false
|
||||
|
||||
vim.opt.shortmess:append("Wc")
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.schedule(function()
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
end)
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.o.signcolumn = "yes"
|
||||
|
||||
-- Decrease update time
|
||||
vim.o.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
vim.o.splitright = true
|
||||
vim.o.splitbelow = true
|
||||
|
||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||
-- See `:help 'list'`
|
||||
-- and `:help 'listchars'`
|
||||
--
|
||||
-- Notice listchars is set using `vim.opt` instead of `vim.o`.
|
||||
-- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables.
|
||||
-- See `:help lua-options`
|
||||
-- and `:help lua-options-guide`
|
||||
vim.o.list = true
|
||||
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.o.inccommand = "split"
|
||||
|
||||
-- Show which line your cursor is on
|
||||
vim.o.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.o.scrolloff = 10
|
||||
|
||||
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||
-- See `:help 'confirm'`
|
||||
vim.o.confirm = true
|
||||
vim.o.winborder = "rounded"
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
-- See `:help hlsearch`
|
||||
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
--
|
||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
||||
|
||||
-- TIP: Disable arrow keys in normal mode
|
||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
||||
|
||||
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
||||
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
||||
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
|
||||
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
|
||||
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
-- Highlight when yanking (copying) text
|
||||
-- Try it with `yap` in normal mode
|
||||
-- See `:help vim.hl.on_yank()`
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
desc = "Highlight when yanking (copying) text",
|
||||
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
|
||||
group = vim.api.nvim_create_augroup("lux-highlight-yank", { clear = true }),
|
||||
callback = function()
|
||||
vim.hl.on_yank()
|
||||
end,
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
require("lz.n").load({
|
||||
{
|
||||
"copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
after = function()
|
||||
require("copilot").setup({
|
||||
-- Disable inline suggestions, let CodeCompanion (or blink) handle interactions
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"codecompanion.nvim",
|
||||
cmd = { "CodeCompanion", "CodeCompanionChat", "CodeCompanionActions" },
|
||||
keys = {
|
||||
{ "<leader>aa", "<cmd>CodeCompanionChat Toggle<cr>", mode = { "n", "v" }, desc = "[A]I [A]ssistant" },
|
||||
{ "<leader>ac", "<cmd>CodeCompanionActions<cr>", mode = { "n", "v" }, desc = "[A]I [C]ode Actions" },
|
||||
},
|
||||
after = function()
|
||||
require("codecompanion").setup({
|
||||
-- Set Gemini as the default strategy
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "gemini",
|
||||
},
|
||||
inline = {
|
||||
adapter = "gemini",
|
||||
},
|
||||
},
|
||||
-- Configure all available adapters
|
||||
adapters = {
|
||||
copilot = function()
|
||||
return require("codecompanion.adapters").extend("copilot", {
|
||||
schema = {
|
||||
model = {
|
||||
default = "claude-3.5-sonnet", -- Good default for Copilot chat
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
gemini = function()
|
||||
return require("codecompanion.adapters").extend("gemini", {
|
||||
env = {
|
||||
api_key = "GEMINI_API_KEY",
|
||||
},
|
||||
schema = {
|
||||
model = {
|
||||
default = "gemini-3.1-pro-preview",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
gemini_cli = function()
|
||||
return require("codecompanion.adapters").extend("gemini_cli", {
|
||||
-- Pass the model as a CLI argument
|
||||
args = {
|
||||
"--model",
|
||||
"gemini-3.1-pro-preview",
|
||||
},
|
||||
-- Set authentication to use standard Google Login
|
||||
env = {
|
||||
auth_method = "oauth-personal",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
@@ -4,6 +4,7 @@ require("lz.n").load({
|
||||
},
|
||||
{
|
||||
"luasnip",
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
before = function()
|
||||
require("lz.n").trigger_load("friendly-snippets")
|
||||
end,
|
||||
@@ -15,6 +16,7 @@ require("lz.n").load({
|
||||
},
|
||||
{
|
||||
"colorful-menu.nvim",
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
after = function()
|
||||
require("colorful-menu").setup({})
|
||||
end,
|
||||
@@ -51,8 +53,12 @@ require("lz.n").load({
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 500,
|
||||
window = {
|
||||
border = "rounded",
|
||||
},
|
||||
},
|
||||
menu = {
|
||||
border = "rounded",
|
||||
draw = {
|
||||
columns = { { "kind_icon" }, { "label", gap = 1 } },
|
||||
components = {
|
||||
@@ -96,9 +102,11 @@ require("lz.n").load({
|
||||
|
||||
signature = {
|
||||
enabled = true,
|
||||
window = {
|
||||
border = "rounded",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -3,13 +3,8 @@ require("lz.n").load({
|
||||
"mini.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
after = function()
|
||||
-- Better Around/Inside textobjects
|
||||
require("mini.ai").setup({ n_lines = 500 })
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
require("mini.surround").setup()
|
||||
|
||||
-- Auto-pairs (replaces nvim-autopairs)
|
||||
require("mini.pairs").setup()
|
||||
|
||||
local files = require("mini.files")
|
||||
@@ -27,9 +22,7 @@ require("lz.n").load({
|
||||
local hipatterns = require("mini.hipatterns")
|
||||
hipatterns.setup({
|
||||
highlighters = {
|
||||
-- Highlight hex color strings (#rrggbb) using that color
|
||||
hex_color = hipatterns.gen_highlighter.hex_color(),
|
||||
-- Highlight TODOs, FIXMEs, etc. (replaces todo-comments.nvim)
|
||||
fixme = { pattern = "%f[%w]()FIXME()%f[%W]", group = "MiniHipatternsFixme" },
|
||||
hack = { pattern = "%f[%w]()HACK()%f[%W]", group = "MiniHipatternsHack" },
|
||||
todo = { pattern = "%f[%w]()TODO()%f[%W]", group = "MiniHipatternsTodo" },
|
||||
@@ -43,7 +36,7 @@ require("lz.n").load({
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason" },
|
||||
pattern = { "help", "Trouble" },
|
||||
callback = function()
|
||||
vim.b.miniindentscope_disable = true
|
||||
end,
|
||||
@@ -62,4 +55,3 @@ require("lz.n").load({
|
||||
event = "BufEnter",
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -17,9 +17,6 @@ require("lz.n").load({
|
||||
require("conform").setup({
|
||||
notify_on_error = true,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
@@ -32,11 +29,7 @@ require("lz.n").load({
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
python = { "isort", "black" },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
python = { "ruff_fix", "ruff_format", "ruff_organize_imports" },
|
||||
},
|
||||
formatters = {
|
||||
stylua = {
|
||||
@@ -46,4 +39,4 @@ require("lz.n").load({
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
@@ -6,9 +6,7 @@ require("lz.n").load({
|
||||
-- Setup typst-preview
|
||||
require("typst-preview").setup({
|
||||
-- Optionally configure things here
|
||||
dependencies_bin = {
|
||||
-- For example, use tinymist as the LSP if that's what you are running
|
||||
},
|
||||
dependencies_bin = require("nix-info").settings.typstPreviewDependencies,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>tp", "<cmd>TypstPreviewToggle<cr>", { desc = "[T]ypst [P]review Toggle" })
|
||||
@@ -21,7 +19,20 @@ require("lz.n").load({
|
||||
after = function()
|
||||
require("lazydev").setup({
|
||||
library = {
|
||||
{ words = { "nixCats", "settings" }, path = "nix-info" },
|
||||
{ words = { "nix%-info", "settings" }, path = "nix-info" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-navic",
|
||||
after = function()
|
||||
require("nvim-navic").setup({
|
||||
highlight = true,
|
||||
separator = " > ",
|
||||
depth_limit = 5,
|
||||
lsp = {
|
||||
auto_attach = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
@@ -33,10 +44,75 @@ require("lz.n").load({
|
||||
require("lz.n").trigger_load("lazydev.nvim")
|
||||
end,
|
||||
after = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
local telescope_plugins = {
|
||||
"project.nvim",
|
||||
"telescope.nvim",
|
||||
"telescope-fzf-native.nvim",
|
||||
"telescope-ui-select.nvim",
|
||||
}
|
||||
|
||||
local telescope_picker = function(picker)
|
||||
return function()
|
||||
require("lz.n").trigger_load(telescope_plugins)
|
||||
require("telescope.builtin")[picker]()
|
||||
end
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
|
||||
|
||||
local navic_excluded_filetypes = {
|
||||
[""] = true,
|
||||
help = true,
|
||||
minifiles = true,
|
||||
TelescopePrompt = true,
|
||||
Trouble = true,
|
||||
}
|
||||
|
||||
local function navic_enabled(bufnr)
|
||||
return vim.bo[bufnr].buftype == "" and not navic_excluded_filetypes[vim.bo[bufnr].filetype]
|
||||
end
|
||||
|
||||
_G.lux_navic_location = function()
|
||||
local ok, navic = pcall(require, "nvim-navic")
|
||||
if not ok or not navic.is_available() then
|
||||
return ""
|
||||
end
|
||||
|
||||
return navic.get_location()
|
||||
end
|
||||
|
||||
local function update_winbar(winid, bufnr)
|
||||
if not vim.api.nvim_win_is_valid(winid) then
|
||||
return
|
||||
end
|
||||
|
||||
local is_float = vim.api.nvim_win_get_config(winid).relative ~= ""
|
||||
local winbar = ""
|
||||
if not is_float and vim.b[bufnr].lux_navic_attached and navic_enabled(bufnr) then
|
||||
winbar = "%{%v:lua.lux_navic_location()%}"
|
||||
end
|
||||
|
||||
vim.api.nvim_set_option_value("winbar", winbar, { win = winid })
|
||||
end
|
||||
|
||||
local function update_winbars_for_buffer(bufnr)
|
||||
for _, winid in ipairs(vim.fn.win_findbuf(bufnr)) do
|
||||
update_winbar(winid, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter", "WinEnter" }, {
|
||||
group = vim.api.nvim_create_augroup("lux-navic-winbar", { clear = true }),
|
||||
callback = function(args)
|
||||
update_winbar(vim.api.nvim_get_current_win(), args.buf)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lux-lsp-attach", { clear = true }),
|
||||
callback = function(args)
|
||||
-- Get the client and buffer from the event arguments [cite: 119]
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
local bufnr = args.buf
|
||||
|
||||
@@ -45,23 +121,30 @@ require("lz.n").load({
|
||||
vim.keymap.set(mode, keys, func, { buffer = bufnr, desc = "LSP: " .. desc })
|
||||
end
|
||||
|
||||
-- Standard LSP functions
|
||||
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" })
|
||||
map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
map("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||
|
||||
-- Telescope Mappings
|
||||
map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
||||
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||
map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
||||
map("<leader>D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
|
||||
map("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
|
||||
map("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
|
||||
map("gd", telescope_picker("lsp_definitions"), "[G]oto [D]efinition")
|
||||
map("gr", telescope_picker("lsp_references"), "[G]oto [R]eferences")
|
||||
map("gI", telescope_picker("lsp_implementations"), "[G]oto [I]mplementation")
|
||||
map("<leader>D", telescope_picker("lsp_type_definitions"), "Type [D]efinition")
|
||||
map("<leader>ds", telescope_picker("lsp_document_symbols"), "[D]ocument [S]ymbols")
|
||||
map("<leader>ws", telescope_picker("lsp_dynamic_workspace_symbols"), "[W]orkspace [S]ymbols")
|
||||
|
||||
if client and client:supports_method("textDocument/documentSymbol", bufnr) and navic_enabled(bufnr) then
|
||||
require("lz.n").trigger_load("nvim-navic")
|
||||
local ok, navic = pcall(require, "nvim-navic")
|
||||
if ok then
|
||||
navic.attach(client, bufnr)
|
||||
vim.b[bufnr].lux_navic_attached = true
|
||||
update_winbars_for_buffer(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
-- Highlight references (Document Highlight)
|
||||
if client and client:supports_method("textDocument/documentHighlight", bufnr) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
|
||||
local highlight_augroup = vim.api.nvim_create_augroup("lux-lsp-highlight", { clear = false })
|
||||
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||
buffer = bufnr,
|
||||
group = highlight_augroup,
|
||||
@@ -75,15 +158,14 @@ require("lz.n").load({
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspDetach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
|
||||
group = vim.api.nvim_create_augroup("lux-lsp-detach", { clear = true }),
|
||||
callback = function(event)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event.buf })
|
||||
vim.api.nvim_clear_autocmds({ group = "lux-lsp-highlight", buffer = event.buf })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Inlay Hints
|
||||
if client and client:supports_method("textDocument/inlayHint", bufnr) then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
map("<leader>th", function()
|
||||
@@ -93,10 +175,9 @@ require("lz.n").load({
|
||||
end,
|
||||
})
|
||||
|
||||
-- 1. Setup Diagnostics (Visuals)
|
||||
vim.diagnostic.config({
|
||||
severity_sort = true,
|
||||
-- underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
underline = true,
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
@@ -105,19 +186,13 @@ require("lz.n").load({
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
},
|
||||
},
|
||||
virtual_text = {
|
||||
virtual_text = false,
|
||||
virtual_lines = {
|
||||
current_line = true,
|
||||
},
|
||||
float = {
|
||||
border = "rounded",
|
||||
source = "if_many",
|
||||
spacing = 4,
|
||||
prefix = "●",
|
||||
format = function(diagnostic)
|
||||
local diagnostic_message = {
|
||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||
}
|
||||
return diagnostic_message[diagnostic.severity]
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -126,7 +201,7 @@ require("lz.n").load({
|
||||
Lua = {
|
||||
runtime = { version = "LuaJIT" },
|
||||
signatureHelp = { enabled = true },
|
||||
diagnostics = { globals = { "nixCats", "vim" } },
|
||||
diagnostics = { globals = { "vim" } },
|
||||
telemetry = { enabled = false },
|
||||
completion = { callSnippet = "Replace" },
|
||||
},
|
||||
@@ -136,7 +211,6 @@ require("lz.n").load({
|
||||
|
||||
local settings = require("nix-info").settings
|
||||
|
||||
-- Nix
|
||||
vim.lsp.config("nixd", {
|
||||
settings = {
|
||||
nixd = {
|
||||
@@ -151,19 +225,11 @@ require("lz.n").load({
|
||||
})
|
||||
vim.lsp.enable("nixd")
|
||||
|
||||
-- Dafny
|
||||
vim.lsp.enable("dafny")
|
||||
|
||||
-- TypeScript/JS
|
||||
vim.lsp.enable("ts_ls")
|
||||
|
||||
-- Rust
|
||||
vim.lsp.enable("rust_analyzer")
|
||||
|
||||
-- Python
|
||||
vim.lsp.enable("ty")
|
||||
vim.lsp.enable("ruff")
|
||||
|
||||
vim.lsp.enable("astro")
|
||||
|
||||
vim.lsp.config("tinymist", {
|
||||
@@ -186,6 +252,9 @@ require("lz.n").load({
|
||||
after = function()
|
||||
require("trouble").setup({
|
||||
focus = true,
|
||||
preview = {
|
||||
border = "rounded",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
@@ -1,29 +1,76 @@
|
||||
local telescope_plugins = {
|
||||
"project.nvim",
|
||||
"telescope.nvim",
|
||||
"telescope-fzf-native.nvim",
|
||||
"telescope-ui-select.nvim",
|
||||
}
|
||||
|
||||
local function load_telescope()
|
||||
require("lz.n").trigger_load(telescope_plugins)
|
||||
return require("telescope.builtin")
|
||||
end
|
||||
|
||||
local function map_picker(lhs, picker, desc, opts)
|
||||
vim.keymap.set("n", lhs, function()
|
||||
load_telescope()[picker](opts or {})
|
||||
end, { desc = desc })
|
||||
end
|
||||
|
||||
map_picker("<leader>sh", "help_tags", "[S]earch [H]elp")
|
||||
map_picker("<leader>sk", "keymaps", "[S]earch [K]eymaps")
|
||||
map_picker("<leader>sf", "find_files", "[S]earch [F]iles")
|
||||
map_picker("<leader>ss", "builtin", "[S]earch [S]elect Telescope")
|
||||
map_picker("<leader>sw", "grep_string", "[S]earch current [W]ord")
|
||||
map_picker("<leader>sg", "live_grep", "[S]earch by [G]rep")
|
||||
map_picker("<leader>sd", "diagnostics", "[S]earch [D]iagnostics")
|
||||
map_picker("<leader>sr", "resume", "[S]earch [R]esume")
|
||||
map_picker("<leader>s.", "oldfiles", '[S]earch Recent Files ("." for repeat)')
|
||||
map_picker("<leader><leader>", "buffers", "[ ] Find existing buffers")
|
||||
map_picker("<leader>sn", "find_files", "[S]earch [N]eovim files", { cwd = vim.fn.stdpath("config") })
|
||||
|
||||
vim.keymap.set("n", "<leader>sp", function()
|
||||
load_telescope()
|
||||
require("telescope").extensions.projects.projects({})
|
||||
end, { desc = "[S]earch [P]rojects" })
|
||||
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
local builtin = load_telescope()
|
||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||
|
||||
vim.keymap.set("n", "<leader>s/", function()
|
||||
load_telescope().live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end, { desc = "[S]earch [/] in Open Files" })
|
||||
|
||||
require("lz.n").load({
|
||||
{
|
||||
"project.nvim",
|
||||
event = { "VimEnter" }, -- Load early to set root correctly
|
||||
event = "VimEnter",
|
||||
after = function()
|
||||
require("project").setup({
|
||||
-- 1. Automagically change directory to project root
|
||||
manual_mode = false,
|
||||
|
||||
-- LSP detection
|
||||
lsp = { enabled = true },
|
||||
|
||||
-- Files/folders that indicate a root
|
||||
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "flake.nix" },
|
||||
|
||||
-- Show hidden files in telescope
|
||||
show_hidden = true,
|
||||
|
||||
-- When the project scope changes, change the directory
|
||||
scope_chdir = "global",
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"telescope-fzf-native.nvim",
|
||||
},
|
||||
{
|
||||
"telescope-ui-select.nvim",
|
||||
},
|
||||
{
|
||||
"telescope.nvim",
|
||||
event = "VimEnter",
|
||||
cmd = "Telescope",
|
||||
before = function()
|
||||
require("lz.n").trigger_load("project.nvim")
|
||||
end,
|
||||
@@ -33,6 +80,8 @@ require("lz.n").load({
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
path_display = { "truncate" },
|
||||
border = true,
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
prompt_position = "top",
|
||||
@@ -40,9 +89,9 @@ require("lz.n").load({
|
||||
sorting_strategy = "ascending",
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous, -- Move up with Ctrl-k
|
||||
["<C-j>"] = actions.move_selection_next, -- Move down with Ctrl-j
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, -- Send to quickfix
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -53,49 +102,10 @@ require("lz.n").load({
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable Telescope extensions if they are installed
|
||||
require("lz.n").trigger_load({ "telescope-fzf-native.nvim", "telescope-ui-select.nvim" })
|
||||
pcall(require("telescope").load_extension, "projects")
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
|
||||
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
|
||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
|
||||
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
|
||||
vim.keymap.set("n", "<leader>sp", function()
|
||||
require("telescope").extensions.projects.projects({})
|
||||
end, { desc = "[S]earch [P]rojects" })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set("n", "<leader>s/", function()
|
||||
builtin.live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end, { desc = "[S]earch [/] in Open Files" })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set("n", "<leader>sn", function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end, { desc = "[S]earch [N]eovim files" })
|
||||
end,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
require("lz.n").load({})
|
||||
@@ -19,22 +19,137 @@ require("lz.n").load({
|
||||
"lualine.nvim",
|
||||
event = "VimEnter",
|
||||
after = function()
|
||||
local filename = {
|
||||
"filename",
|
||||
path = 1,
|
||||
symbols = {
|
||||
modified = "●",
|
||||
readonly = "",
|
||||
unnamed = "[No Name]",
|
||||
},
|
||||
}
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
globalstatus = true,
|
||||
globalstatus = false,
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
theme = "kanagawa",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diagnostics" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { filename },
|
||||
|
||||
lualine_x = { "lsp_status" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { filename },
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"bufferline.nvim",
|
||||
event = "VimEnter",
|
||||
before = function()
|
||||
require("lz.n").trigger_load("mini.nvim")
|
||||
end,
|
||||
after = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
mode = "buffers",
|
||||
numbers = "none",
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_indicator = function(count, level)
|
||||
local icon = level:match("error") and " " or level:match("warning") and " " or " "
|
||||
return " " .. icon .. count
|
||||
end,
|
||||
always_show_bufferline = true,
|
||||
show_buffer_close_icons = false,
|
||||
show_close_icon = false,
|
||||
separator_style = "thin",
|
||||
sort_by = "insert_after_current",
|
||||
offsets = {
|
||||
{
|
||||
filetype = "minifiles",
|
||||
text = "Files",
|
||||
separator = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>bn", "<cmd>BufferLineCycleNext<cr>", { desc = "[B]uffer [N]ext" })
|
||||
vim.keymap.set("n", "<leader>bp", "<cmd>BufferLineCyclePrev<cr>", { desc = "[B]uffer [P]revious" })
|
||||
vim.keymap.set("n", "<leader>bb", "<cmd>BufferLinePick<cr>", { desc = "[B]uffer [B]rowse" })
|
||||
vim.keymap.set("n", "<leader>bd", "<cmd>bdelete<cr>", { desc = "[B]uffer [D]elete" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
after = function()
|
||||
require("gitsigns").setup({
|
||||
signs = {
|
||||
add = { text = "│" },
|
||||
change = { text = "│" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "┆" },
|
||||
},
|
||||
signs_staged_enable = true,
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
local map = function(mode, lhs, rhs, desc, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
opts.desc = desc
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
|
||||
map("n", "]h", function()
|
||||
if vim.wo.diff then
|
||||
return "]h"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.nav_hunk("next")
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, "Next git hunk", { expr = true })
|
||||
|
||||
map("n", "[h", function()
|
||||
if vim.wo.diff then
|
||||
return "[h"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.nav_hunk("prev")
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, "Previous git hunk", { expr = true })
|
||||
|
||||
map("n", "<leader>hp", gs.preview_hunk, "Git [H]unk [P]review")
|
||||
map("n", "<leader>hs", gs.stage_hunk, "Git [H]unk [S]tage")
|
||||
map("n", "<leader>hr", gs.reset_hunk, "Git [H]unk [R]eset")
|
||||
map("n", "<leader>hu", gs.undo_stage_hunk, "Git [H]unk [U]ndo stage")
|
||||
map("n", "<leader>hS", gs.stage_buffer, "Git [H]unk [S]tage buffer")
|
||||
map("n", "<leader>hR", gs.reset_buffer, "Git [H]unk [R]eset buffer")
|
||||
map("v", "<leader>hs", function()
|
||||
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "Git [H]unk [S]tage")
|
||||
map("v", "<leader>hr", function()
|
||||
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "Git [H]unk [R]eset")
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
@@ -62,15 +177,12 @@ require("lz.n").load({
|
||||
preset = "modern",
|
||||
delay = 200,
|
||||
icons = {
|
||||
-- set icon mappings to true if you have a Nerd Font
|
||||
mappings = true,
|
||||
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
||||
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
|
||||
keys = {},
|
||||
},
|
||||
|
||||
-- Document existing key chains
|
||||
spec = {
|
||||
{ "<leader>b", group = "[B]uffer" },
|
||||
{ "<leader>s", group = "[S]earch" },
|
||||
{ "<leader>t", group = "[T]oggle" },
|
||||
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
|
||||
@@ -78,4 +190,4 @@ require("lz.n").load({
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user