feat: nvim new configs
This commit is contained in:
parent
03507560de
commit
553ef00fa9
17 changed files with 447 additions and 96 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -10,3 +10,6 @@
|
||||||
# Nix build results
|
# Nix build results
|
||||||
result
|
result
|
||||||
result-*
|
result-*
|
||||||
|
|
||||||
|
# Neovim
|
||||||
|
modules/home/rsydn/programs/nvim/lazy-lock.json
|
||||||
|
|
|
||||||
|
|
@ -35,15 +35,65 @@ let
|
||||||
echo "Restart Claude Code and Codex to apply changes."
|
echo "Restart Claude Code and Codex to apply changes."
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Helper that builds the wrapped Neovim from the flake and runs it with repo-scoped XDG dirs
|
||||||
|
previewNvim = pkgs.writeShellScriptBin "preview-nvim" ''
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
root="''${DOTFILES_ROOT:-$PWD}"
|
||||||
|
cache_base="$root/.cache"
|
||||||
|
nvim_cache="$cache_base/nvim-preview"
|
||||||
|
xdg_state="$cache_base/xdg-state"
|
||||||
|
xdg_data="$cache_base/xdg-data"
|
||||||
|
xdg_config="$root/modules/home/rsydn/programs"
|
||||||
|
|
||||||
|
mkdir -p "$nvim_cache" "$xdg_state" "$xdg_data"
|
||||||
|
|
||||||
|
attr="''${NVIM_ATTR:-}"
|
||||||
|
if [ "$#" -gt 0 ]; then
|
||||||
|
attr="$1"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$attr" ]; then
|
||||||
|
case "$(uname -s)" in
|
||||||
|
Darwin)
|
||||||
|
attr=".#darwinConfigurations.macbook-pro.config.home-manager.users.rasyidanakbar.programs.neovim.finalPackage"
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
attr=".#nixosConfigurations.dev-vm.config.home-manager.users.rasyidanakbar.programs.neovim.finalPackage"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "error: unsupported system; pass flake attribute as first argument or set NVIM_ATTR" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
out_link="$nvim_cache/result"
|
||||||
|
|
||||||
|
echo "Building Neovim package: $attr"
|
||||||
|
XDG_CACHE_HOME="$nvim_cache" nix build "$attr" --out-link "$out_link"
|
||||||
|
|
||||||
|
echo "Launching Neovim..."
|
||||||
|
XDG_CACHE_HOME="$nvim_cache" \
|
||||||
|
XDG_STATE_HOME="$xdg_state" \
|
||||||
|
XDG_DATA_HOME="$xdg_data" \
|
||||||
|
XDG_CONFIG_HOME="$xdg_config" \
|
||||||
|
NVIM_APPNAME="nvim" \
|
||||||
|
"$out_link/bin/nvim" "$@"
|
||||||
|
'';
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in pkgs.mkShell {
|
||||||
name = "default";
|
name = "default";
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
git
|
git
|
||||||
|
nix
|
||||||
nixfmt-classic
|
nixfmt-classic
|
||||||
uv
|
uv
|
||||||
python3
|
python3
|
||||||
mcpNixosWrapper
|
mcpNixosWrapper
|
||||||
installMcpConfigs
|
installMcpConfigs
|
||||||
|
previewNvim
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export DOTFILES_ROOT="$PWD"
|
export DOTFILES_ROOT="$PWD"
|
||||||
|
|
@ -63,5 +113,8 @@ in pkgs.mkShell {
|
||||||
echo ""
|
echo ""
|
||||||
echo "To install MCP configs for Claude Code and Codex, run:"
|
echo "To install MCP configs for Claude Code and Codex, run:"
|
||||||
echo " install-mcp-configs"
|
echo " install-mcp-configs"
|
||||||
|
echo ""
|
||||||
|
echo "To preview the Neovim config without switching, run:"
|
||||||
|
echo " preview-nvim [flakeAttr] [-- extra args]"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ in {
|
||||||
};
|
};
|
||||||
brews = mkOption {
|
brews = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ "curl" "yt-dlp" "ruff" "libmagic" "ghostscript" "infisical" ];
|
default = [ "curl" "yt-dlp" "ruff" "libmagic" "infisical" ];
|
||||||
description = "Homebrew formulae to install.";
|
description = "Homebrew formulae to install.";
|
||||||
};
|
};
|
||||||
casks = mkOption {
|
casks = mkOption {
|
||||||
|
|
@ -24,6 +24,7 @@ in {
|
||||||
default = [
|
default = [
|
||||||
"bitwarden"
|
"bitwarden"
|
||||||
"brave-browser"
|
"brave-browser"
|
||||||
|
"firefox"
|
||||||
"pgadmin4"
|
"pgadmin4"
|
||||||
"docker-desktop"
|
"docker-desktop"
|
||||||
"spotify"
|
"spotify"
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,48 @@
|
||||||
withPython3 = true;
|
withPython3 = true;
|
||||||
withRuby = true;
|
withRuby = true;
|
||||||
|
|
||||||
|
plugins = with pkgs.vimPlugins; [
|
||||||
|
# Native extensions that need building
|
||||||
|
telescope-fzf-native-nvim
|
||||||
|
blink-cmp # Pre-built with Rust backend for fast fuzzy matching
|
||||||
|
];
|
||||||
|
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
|
# LSP Servers
|
||||||
|
lua-language-server
|
||||||
|
nil # Nix LSP
|
||||||
|
pyright
|
||||||
|
nodePackages.typescript-language-server
|
||||||
|
rust-analyzer
|
||||||
|
gopls
|
||||||
|
clang-tools # provides clangd
|
||||||
|
|
||||||
# Formatters
|
# Formatters
|
||||||
stylua
|
stylua # Lua
|
||||||
nixfmt
|
nixfmt-classic # Nix (matches your fmt command)
|
||||||
|
ruff # Python (formatter + linter)
|
||||||
|
prettierd # JS/TS/JSON/YAML/Markdown
|
||||||
|
rustfmt # Rust
|
||||||
|
gofumpt # Go (stricter than gofmt)
|
||||||
|
shfmt # Shell scripts
|
||||||
|
|
||||||
|
# Linters
|
||||||
|
nodePackages.eslint # JavaScript/TypeScript
|
||||||
|
shellcheck # Shell scripts
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
ripgrep
|
ripgrep
|
||||||
fd
|
fd
|
||||||
git
|
git
|
||||||
ast-grep
|
ast-grep
|
||||||
|
|
||||||
|
# Additional tools for LazyVim features
|
||||||
|
tree-sitter # Required for treesitter parser compilation
|
||||||
|
imagemagick # Image conversion for snacks.nvim
|
||||||
|
ghostscript # PDF rendering support
|
||||||
|
tectonic # LaTeX math rendering
|
||||||
|
luarocks # Lua package manager for plugins
|
||||||
|
nodePackages.mermaid-cli # Mermaid diagram rendering
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,8 @@
|
||||||
require("config.options")
|
require("config.options")
|
||||||
require("config.keymaps")
|
require("config.keymaps")
|
||||||
require("config.autocmds")
|
require("config.autocmds")
|
||||||
|
|
||||||
|
-- Load LazyVim utilities before lazy plugin manager
|
||||||
|
require("config.lazyvim")
|
||||||
|
|
||||||
require("config.lazy")
|
require("config.lazy")
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,21 @@ vim.g.mapleader = " "
|
||||||
vim.g.maplocalleader = "\\"
|
vim.g.maplocalleader = "\\"
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
spec = {
|
spec = {
|
||||||
|
{
|
||||||
|
"LazyVim/LazyVim",
|
||||||
|
import = "lazyvim.plugins",
|
||||||
|
},
|
||||||
|
|
||||||
{ import = "plugins" },
|
{ import = "plugins" },
|
||||||
{ import = "config.lazyvim" },
|
{ import = "config.lazyvim" },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
lazy = false,
|
||||||
|
version = false,
|
||||||
|
},
|
||||||
|
|
||||||
install = { colorscheme = { "gruvbox", "habamax" } },
|
install = { colorscheme = { "gruvbox", "habamax" } },
|
||||||
|
|
||||||
checker = { enabled = false },
|
checker = { enabled = false },
|
||||||
|
|
|
||||||
53
modules/home/rsydn/programs/nvim/lua/config/lazyvim/init.lua
Normal file
53
modules/home/rsydn/programs/nvim/lua/config/lazyvim/init.lua
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
-- LazyVim utilities module
|
||||||
|
-- Provides helper functions for plugin configuration
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
-- Mini module utilities
|
||||||
|
M.mini = {}
|
||||||
|
|
||||||
|
-- Setup mini.pairs with given options
|
||||||
|
function M.mini.pairs(opts)
|
||||||
|
require("mini.pairs").setup(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Text object for entire buffer
|
||||||
|
M.mini.ai_buffer = function(ai)
|
||||||
|
local n_lines = vim.fn.line("$")
|
||||||
|
local start_line, end_line = 1, n_lines
|
||||||
|
if n_lines == 0 then
|
||||||
|
return { from = { line = 0, col = 0 } }
|
||||||
|
end
|
||||||
|
local start_col, end_col = 1, math.max(vim.fn.getline(end_line):len(), 1)
|
||||||
|
return {
|
||||||
|
from = { line = start_line, col = start_col },
|
||||||
|
to = { line = end_line, col = end_col },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Text object hints are now handled by mini.clue
|
||||||
|
|
||||||
|
-- Run callback when plugin is loaded
|
||||||
|
function M.on_load(name, fn)
|
||||||
|
local Config = require("lazy.core.config")
|
||||||
|
if Config.plugins[name] and Config.plugins[name]._.loaded then
|
||||||
|
vim.schedule(function()
|
||||||
|
fn(name)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "LazyLoad",
|
||||||
|
callback = function(event)
|
||||||
|
if event.data == name then
|
||||||
|
fn(name)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Make LazyVim global
|
||||||
|
_G.LazyVim = M
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -1,70 +1,106 @@
|
||||||
-- Enable language servers defined in nvim-lspconfig using the Nvim 0.11 API.
|
-- LSP configuration using Nix-managed servers
|
||||||
return {
|
return {
|
||||||
{
|
-- Disable Mason plugins (we use Nix-managed servers instead)
|
||||||
"mason-org/mason.nvim",
|
{ "mason-org/mason.nvim", enabled = false },
|
||||||
opts = function(_, opts)
|
{ "mason-org/mason-lspconfig.nvim", enabled = false },
|
||||||
opts.ensure_installed = opts.ensure_installed or {}
|
{ "jay-babu/mason-null-ls.nvim", enabled = false },
|
||||||
local ensure = {
|
{ "jay-babu/mason-nvim-dap.nvim", enabled = false },
|
||||||
"clangd",
|
|
||||||
"gopls",
|
|
||||||
"lua-language-server",
|
|
||||||
"nil",
|
|
||||||
"pyright",
|
|
||||||
"rust-analyzer",
|
|
||||||
"typescript-language-server",
|
|
||||||
}
|
|
||||||
for _, tool in ipairs(ensure) do
|
|
||||||
if not vim.tbl_contains(opts.ensure_installed, tool) then
|
|
||||||
table.insert(opts.ensure_installed, tool)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
opts = function(_, opts)
|
dependencies = {
|
||||||
opts.servers = vim.tbl_deep_extend(
|
"saghen/blink.cmp", -- For LSP capabilities
|
||||||
"force",
|
},
|
||||||
{
|
config = function()
|
||||||
lua_ls = {},
|
-- Get blink.cmp capabilities
|
||||||
nil_ls = {},
|
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||||
pyright = {},
|
|
||||||
ts_ls = {},
|
-- Common LSP attach keybindings
|
||||||
rust_analyzer = {},
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
gopls = {},
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||||
clangd = {},
|
callback = function(ev)
|
||||||
|
local opts = { buffer = ev.buf }
|
||||||
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||||
|
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||||
|
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||||
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||||
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
|
||||||
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||||
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Configure each LSP server
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
-- Lua
|
||||||
|
lspconfig.lua_ls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = { version = "LuaJIT" },
|
||||||
|
diagnostics = { globals = { "vim" } },
|
||||||
|
workspace = {
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
checkThirdParty = false,
|
||||||
|
},
|
||||||
|
telemetry = { enable = false },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
opts.servers or {}
|
})
|
||||||
)
|
|
||||||
end,
|
|
||||||
config = function(_, opts)
|
|
||||||
if vim.fn.has("nvim-0.11") == 0 then
|
|
||||||
vim.notify("nvim-lspconfig requires Neovim 0.11+ for vim.lsp.config", vim.log.levels.ERROR)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for name, server_opts in pairs(opts.servers or {}) do
|
-- Nix
|
||||||
if server_opts ~= false then
|
lspconfig.nil_ls.setup({
|
||||||
local config = type(server_opts) == "table" and vim.deepcopy(server_opts) or {}
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
["nil"] = {
|
||||||
|
formatting = { command = { "nixfmt" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
if config.enabled ~= false then
|
-- Python
|
||||||
config.enabled = nil
|
lspconfig.pyright.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
typeCheckingMode = "basic",
|
||||||
|
autoSearchPaths = true,
|
||||||
|
useLibraryCodeForTypes = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- Integrate blink.cmp capabilities with LSP
|
-- TypeScript/JavaScript
|
||||||
local has_blink, blink = pcall(require, "blink.cmp")
|
lspconfig.ts_ls.setup({
|
||||||
if has_blink then
|
capabilities = capabilities,
|
||||||
config.capabilities = blink.get_lsp_capabilities(config.capabilities)
|
})
|
||||||
end
|
|
||||||
|
|
||||||
if next(config) ~= nil then
|
-- Rust
|
||||||
vim.lsp.config(name, config)
|
lspconfig.rust_analyzer.setup({
|
||||||
end
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
checkOnSave = { command = "clippy" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
vim.lsp.enable(name)
|
-- Go
|
||||||
end
|
lspconfig.gopls.setup({
|
||||||
end
|
capabilities = capabilities,
|
||||||
end
|
})
|
||||||
|
|
||||||
|
-- C/C++
|
||||||
|
lspconfig.clangd.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,11 +58,7 @@ return {
|
||||||
end,
|
end,
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("mini.ai").setup(opts)
|
require("mini.ai").setup(opts)
|
||||||
LazyVim.on_load("which-key.nvim", function()
|
-- mini.clue handles text object hints automatically
|
||||||
vim.schedule(function()
|
|
||||||
LazyVim.mini.ai_whichkey(opts)
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,13 @@ return {
|
||||||
-- gruvbox
|
-- gruvbox
|
||||||
{
|
{
|
||||||
"ellisonleao/gruvbox.nvim",
|
"ellisonleao/gruvbox.nvim",
|
||||||
lazy = true,
|
lazy = false,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
opts = {},
|
opts = {},
|
||||||
|
config = function()
|
||||||
|
require("gruvbox").setup({})
|
||||||
|
vim.cmd.colorscheme("gruvbox")
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- tokyonight
|
-- tokyonight
|
||||||
|
|
@ -17,7 +21,7 @@ return {
|
||||||
-- catppuccin
|
-- catppuccin
|
||||||
{
|
{
|
||||||
"catppuccin/nvim",
|
"catppuccin/nvim",
|
||||||
lazy = false,
|
lazy = true,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
name = "catppuccin",
|
name = "catppuccin",
|
||||||
opts = {
|
opts = {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
return {
|
return {
|
||||||
-- Modern completion engine with built-in fuzzy matching
|
-- Modern completion engine with built-in fuzzy matching
|
||||||
|
-- Note: Installed via Nix with pre-built Rust backend (see neovim.nix)
|
||||||
{
|
{
|
||||||
"saghen/blink.cmp",
|
"saghen/blink.cmp",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
|
@ -7,6 +8,7 @@ return {
|
||||||
},
|
},
|
||||||
version = "1.*",
|
version = "1.*",
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
|
build = nil, -- Disable build since Nix provides pre-compiled version
|
||||||
opts = {
|
opts = {
|
||||||
-- Keymap preset options: 'default' | 'super-tab' | 'enter'
|
-- Keymap preset options: 'default' | 'super-tab' | 'enter'
|
||||||
keymap = { preset = "default" },
|
keymap = { preset = "default" },
|
||||||
|
|
@ -34,9 +36,11 @@ return {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Fuzzy matching implementation
|
-- Fuzzy matching implementation
|
||||||
-- Options: "prefer_rust_with_warning" | "rust" | "lua"
|
-- Using "rust" since Nix provides pre-built native module
|
||||||
fuzzy = {
|
fuzzy = {
|
||||||
implementation = "prefer_rust_with_warning",
|
use_typo_resistance = true,
|
||||||
|
use_frecency = true,
|
||||||
|
use_proximity = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opts_extend = { "sources.default" },
|
opts_extend = { "sources.default" },
|
||||||
|
|
|
||||||
|
|
@ -15,19 +15,15 @@ return {
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
defaults = {
|
defaults = {
|
||||||
mappings = {
|
-- Removed which_key mapping - mini.clue handles keybind hints globally
|
||||||
i = {
|
|
||||||
["<C-h>"] = "which_key",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Telescope FZF native - Better sorting performance
|
-- Telescope FZF native - Better sorting performance
|
||||||
|
-- Note: Installed via Nix (see neovim.nix) to avoid build issues
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
build = "make",
|
|
||||||
dependencies = { "nvim-telescope/telescope.nvim" },
|
dependencies = { "nvim-telescope/telescope.nvim" },
|
||||||
config = function()
|
config = function()
|
||||||
require("telescope").load_extension("fzf")
|
require("telescope").load_extension("fzf")
|
||||||
|
|
|
||||||
59
modules/home/rsydn/programs/nvim/lua/plugins/formatting.lua
Normal file
59
modules/home/rsydn/programs/nvim/lua/plugins/formatting.lua
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
event = { "BufWritePre" },
|
||||||
|
cmd = { "ConformInfo" },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>cf",
|
||||||
|
function()
|
||||||
|
require("conform").format({ async = true, lsp_fallback = true })
|
||||||
|
end,
|
||||||
|
mode = { "n", "v" },
|
||||||
|
desc = "Format buffer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua" },
|
||||||
|
nix = { "nixfmt" },
|
||||||
|
python = { "ruff_format", "ruff_organize_imports" },
|
||||||
|
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
typescript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
javascriptreact = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
typescriptreact = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
json = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
jsonc = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
yaml = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
markdown = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
html = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
css = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
scss = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
rust = { "rustfmt" },
|
||||||
|
go = { "gofumpt" },
|
||||||
|
sh = { "shfmt" },
|
||||||
|
bash = { "shfmt" },
|
||||||
|
zsh = { "shfmt" },
|
||||||
|
},
|
||||||
|
-- Format on save
|
||||||
|
format_on_save = {
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_fallback = true,
|
||||||
|
},
|
||||||
|
-- Customize formatters
|
||||||
|
formatters = {
|
||||||
|
shfmt = {
|
||||||
|
prepend_args = { "-i", "2" }, -- 2 space indent
|
||||||
|
},
|
||||||
|
ruff_format = {
|
||||||
|
command = "ruff",
|
||||||
|
args = { "format", "--stdin-filename", "$FILENAME" },
|
||||||
|
},
|
||||||
|
ruff_organize_imports = {
|
||||||
|
command = "ruff",
|
||||||
|
args = { "check", "--select", "I", "--fix", "--stdin-filename", "$FILENAME" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -5,10 +5,13 @@ return {
|
||||||
opts = {
|
opts = {
|
||||||
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
|
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
|
||||||
linters_by_ft = {
|
linters_by_ft = {
|
||||||
-- Add linters per filetype here
|
javascript = { "eslint" },
|
||||||
-- fish = { "fish" },
|
typescript = { "eslint" },
|
||||||
-- javascript = { "eslint_d" },
|
javascriptreact = { "eslint" },
|
||||||
-- python = { "ruff" },
|
typescriptreact = { "eslint" },
|
||||||
|
python = { "ruff" },
|
||||||
|
sh = { "shellcheck" },
|
||||||
|
bash = { "shellcheck" },
|
||||||
},
|
},
|
||||||
linters = {},
|
linters = {},
|
||||||
},
|
},
|
||||||
|
|
@ -26,21 +29,28 @@ return {
|
||||||
|
|
||||||
lint.linters_by_ft = opts.linters_by_ft
|
lint.linters_by_ft = opts.linters_by_ft
|
||||||
|
|
||||||
-- Debounced lint function
|
-- Debounced lint function with proper timer management
|
||||||
|
local timer = vim.uv.new_timer()
|
||||||
local function debounce_lint()
|
local function debounce_lint()
|
||||||
local timer = vim.uv.new_timer()
|
-- Stop existing timer before starting new one to prevent EALREADY error
|
||||||
return function()
|
timer:stop()
|
||||||
timer:start(100, 0, vim.schedule_wrap(lint.try_lint))
|
timer:start(100, 0, vim.schedule_wrap(lint.try_lint))
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local lint_fn = debounce_lint()
|
|
||||||
|
|
||||||
-- Create autocommand for linting
|
-- Create autocommand for linting
|
||||||
vim.api.nvim_create_autocmd(opts.events, {
|
vim.api.nvim_create_autocmd(opts.events, {
|
||||||
group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }),
|
group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }),
|
||||||
|
callback = debounce_lint,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Clean up timer on exit
|
||||||
|
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||||
|
group = vim.api.nvim_create_augroup("nvim-lint-cleanup", { clear = true }),
|
||||||
callback = function()
|
callback = function()
|
||||||
lint_fn()
|
if timer and not timer:is_closing() then
|
||||||
|
timer:stop()
|
||||||
|
timer:close()
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,51 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
version = false,
|
|
||||||
build = ":TSUpdate",
|
|
||||||
event = { "BufReadPost", "BufNewFile" },
|
|
||||||
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
|
|
||||||
opts = {
|
opts = {
|
||||||
highlight = { enable = true },
|
|
||||||
indent = { enable = true },
|
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"bash",
|
"bash",
|
||||||
"c",
|
"c",
|
||||||
|
"cpp",
|
||||||
|
"css",
|
||||||
"diff",
|
"diff",
|
||||||
|
"dockerfile",
|
||||||
|
"git_config",
|
||||||
|
"git_rebase",
|
||||||
|
"gitcommit",
|
||||||
|
"gitignore",
|
||||||
|
"go",
|
||||||
|
"gomod",
|
||||||
|
"gosum",
|
||||||
"html",
|
"html",
|
||||||
"javascript",
|
"javascript",
|
||||||
"jsdoc",
|
"jsdoc",
|
||||||
"json",
|
"json",
|
||||||
"jsonc",
|
"jsonc",
|
||||||
|
"latex",
|
||||||
"lua",
|
"lua",
|
||||||
"luadoc",
|
"luadoc",
|
||||||
"luap",
|
"luap",
|
||||||
"markdown",
|
"markdown",
|
||||||
"markdown_inline",
|
"markdown_inline",
|
||||||
|
"nix",
|
||||||
|
"norg",
|
||||||
"printf",
|
"printf",
|
||||||
"python",
|
"python",
|
||||||
"query",
|
"query",
|
||||||
"regex",
|
"regex",
|
||||||
|
"rust",
|
||||||
|
"scss",
|
||||||
|
"svelte",
|
||||||
"toml",
|
"toml",
|
||||||
"tsx",
|
"tsx",
|
||||||
"typescript",
|
"typescript",
|
||||||
|
"typst",
|
||||||
"vim",
|
"vim",
|
||||||
"vimdoc",
|
"vimdoc",
|
||||||
|
"vue",
|
||||||
"xml",
|
"xml",
|
||||||
"yaml",
|
"yaml",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
|
||||||
require("nvim-treesitter.configs").setup(opts)
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
78
modules/home/rsydn/programs/nvim/lua/plugins/which-key.lua
Normal file
78
modules/home/rsydn/programs/nvim/lua/plugins/which-key.lua
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
return {
|
||||||
|
-- Disable which-key (we use mini.clue instead)
|
||||||
|
{ "folke/which-key.nvim", enabled = false },
|
||||||
|
|
||||||
|
-- mini.clue - Lightweight keybind hints
|
||||||
|
{
|
||||||
|
"nvim-mini/mini.clue",
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
local miniclue = require("mini.clue")
|
||||||
|
miniclue.setup({
|
||||||
|
triggers = {
|
||||||
|
-- Leader triggers
|
||||||
|
{ mode = "n", keys = "<Leader>" },
|
||||||
|
{ mode = "x", keys = "<Leader>" },
|
||||||
|
|
||||||
|
-- Built-in completion
|
||||||
|
{ mode = "i", keys = "<C-x>" },
|
||||||
|
|
||||||
|
-- `g` key
|
||||||
|
{ mode = "n", keys = "g" },
|
||||||
|
{ mode = "x", keys = "g" },
|
||||||
|
|
||||||
|
-- Marks
|
||||||
|
{ mode = "n", keys = "'" },
|
||||||
|
{ mode = "n", keys = "`" },
|
||||||
|
{ mode = "x", keys = "'" },
|
||||||
|
{ mode = "x", keys = "`" },
|
||||||
|
|
||||||
|
-- Registers
|
||||||
|
{ mode = "n", keys = '"' },
|
||||||
|
{ mode = "x", keys = '"' },
|
||||||
|
{ mode = "i", keys = "<C-r>" },
|
||||||
|
{ mode = "c", keys = "<C-r>" },
|
||||||
|
|
||||||
|
-- Window commands
|
||||||
|
{ mode = "n", keys = "<C-w>" },
|
||||||
|
|
||||||
|
-- `z` key
|
||||||
|
{ mode = "n", keys = "z" },
|
||||||
|
{ mode = "x", keys = "z" },
|
||||||
|
|
||||||
|
-- Bracketed commands
|
||||||
|
{ mode = "n", keys = "[" },
|
||||||
|
{ mode = "n", keys = "]" },
|
||||||
|
},
|
||||||
|
|
||||||
|
clues = {
|
||||||
|
-- Enhance this by adding descriptions for <Leader> mapping groups
|
||||||
|
miniclue.gen_clues.builtin_completion(),
|
||||||
|
miniclue.gen_clues.g(),
|
||||||
|
miniclue.gen_clues.marks(),
|
||||||
|
miniclue.gen_clues.registers(),
|
||||||
|
miniclue.gen_clues.windows(),
|
||||||
|
miniclue.gen_clues.z(),
|
||||||
|
|
||||||
|
-- Custom leader key descriptions
|
||||||
|
{ mode = "n", keys = "<Leader>b", desc = "+buffer" },
|
||||||
|
{ mode = "n", keys = "<Leader>c", desc = "+code" },
|
||||||
|
{ mode = "n", keys = "<Leader>d", desc = "+diagnostics" },
|
||||||
|
{ mode = "n", keys = "<Leader>e", desc = "+explorer" },
|
||||||
|
{ mode = "n", keys = "<Leader>f", desc = "+find" },
|
||||||
|
{ mode = "n", keys = "<Leader>o", desc = "+open" },
|
||||||
|
{ mode = "n", keys = "<Leader>r", desc = "+rename" },
|
||||||
|
{ mode = "n", keys = "<Leader>s", desc = "+search" },
|
||||||
|
},
|
||||||
|
|
||||||
|
window = {
|
||||||
|
delay = 300, -- Show hints after 300ms
|
||||||
|
config = {
|
||||||
|
width = "auto",
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,10 @@
|
||||||
'';
|
'';
|
||||||
}];
|
}];
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
# Terminal configuration for proper colors and features
|
||||||
|
set-option -g default-terminal "screen-256color"
|
||||||
|
set-option -ga terminal-overrides ",*256col*:Tc"
|
||||||
|
set-option -g focus-events on
|
||||||
set -s extended-keys on
|
set -s extended-keys on
|
||||||
set -as terminal-features 'xterm-ghostty:extkeys'
|
set -as terminal-features 'xterm-ghostty:extkeys'
|
||||||
set-option -g status-style "bg=#282a36 fg=#f8f8f2"
|
set-option -g status-style "bg=#282a36 fg=#f8f8f2"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue