feat: nvim new configs

This commit is contained in:
Rasyidan Akbar F. 2025-10-28 20:32:32 +07:00
commit 553ef00fa9
17 changed files with 447 additions and 96 deletions

View file

@ -58,11 +58,7 @@ return {
end,
config = function(_, opts)
require("mini.ai").setup(opts)
LazyVim.on_load("which-key.nvim", function()
vim.schedule(function()
LazyVim.mini.ai_whichkey(opts)
end)
end)
-- mini.clue handles text object hints automatically
end,
},

View file

@ -2,9 +2,13 @@ return {
-- gruvbox
{
"ellisonleao/gruvbox.nvim",
lazy = true,
lazy = false,
priority = 1000,
opts = {},
config = function()
require("gruvbox").setup({})
vim.cmd.colorscheme("gruvbox")
end,
},
-- tokyonight
@ -17,7 +21,7 @@ return {
-- catppuccin
{
"catppuccin/nvim",
lazy = false,
lazy = true,
priority = 1000,
name = "catppuccin",
opts = {

View file

@ -1,5 +1,6 @@
return {
-- Modern completion engine with built-in fuzzy matching
-- Note: Installed via Nix with pre-built Rust backend (see neovim.nix)
{
"saghen/blink.cmp",
dependencies = {
@ -7,6 +8,7 @@ return {
},
version = "1.*",
event = "InsertEnter",
build = nil, -- Disable build since Nix provides pre-compiled version
opts = {
-- Keymap preset options: 'default' | 'super-tab' | 'enter'
keymap = { preset = "default" },
@ -34,9 +36,11 @@ return {
},
-- Fuzzy matching implementation
-- Options: "prefer_rust_with_warning" | "rust" | "lua"
-- Using "rust" since Nix provides pre-built native module
fuzzy = {
implementation = "prefer_rust_with_warning",
use_typo_resistance = true,
use_frecency = true,
use_proximity = true,
},
},
opts_extend = { "sources.default" },

View file

@ -15,19 +15,15 @@ return {
},
opts = {
defaults = {
mappings = {
i = {
["<C-h>"] = "which_key",
},
},
-- Removed which_key mapping - mini.clue handles keybind hints globally
},
},
},
-- Telescope FZF native - Better sorting performance
-- Note: Installed via Nix (see neovim.nix) to avoid build issues
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
dependencies = { "nvim-telescope/telescope.nvim" },
config = function()
require("telescope").load_extension("fzf")

View 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" },
},
},
},
},
}

View file

@ -5,10 +5,13 @@ return {
opts = {
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
linters_by_ft = {
-- Add linters per filetype here
-- fish = { "fish" },
-- javascript = { "eslint_d" },
-- python = { "ruff" },
javascript = { "eslint" },
typescript = { "eslint" },
javascriptreact = { "eslint" },
typescriptreact = { "eslint" },
python = { "ruff" },
sh = { "shellcheck" },
bash = { "shellcheck" },
},
linters = {},
},
@ -26,21 +29,28 @@ return {
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 timer = vim.uv.new_timer()
return function()
timer:start(100, 0, vim.schedule_wrap(lint.try_lint))
end
-- Stop existing timer before starting new one to prevent EALREADY error
timer:stop()
timer:start(100, 0, vim.schedule_wrap(lint.try_lint))
end
local lint_fn = debounce_lint()
-- Create autocommand for linting
vim.api.nvim_create_autocmd(opts.events, {
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()
lint_fn()
if timer and not timer:is_closing() then
timer:stop()
timer:close()
end
end,
})
end,

View file

@ -1,42 +1,51 @@
return {
{
"nvim-treesitter/nvim-treesitter",
version = false,
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
opts = {
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
"bash",
"c",
"cpp",
"css",
"diff",
"dockerfile",
"git_config",
"git_rebase",
"gitcommit",
"gitignore",
"go",
"gomod",
"gosum",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"latex",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"nix",
"norg",
"printf",
"python",
"query",
"regex",
"rust",
"scss",
"svelte",
"toml",
"tsx",
"typescript",
"typst",
"vim",
"vimdoc",
"vue",
"xml",
"yaml",
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
}

View 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,
},
}