feat: nvim config

This commit is contained in:
Rasyidan Akbar F. 2025-10-28 15:59:39 +07:00
commit 03507560de
23 changed files with 685 additions and 328 deletions

View file

@ -0,0 +1,84 @@
return {
-- Auto pairs
-- Automatically inserts a matching closing character
-- when you type an opening character like `"`, `[`, or `(`.
{
"nvim-mini/mini.pairs",
event = "VeryLazy",
opts = {
modes = { insert = true, command = true, terminal = false },
-- skip autopair when next character is one of these
skip_next = [=[[%w%%%'%[%"%%.%`%$]]=],
-- skip autopair when the cursor is inside these treesitter nodes
skip_ts = { "string" },
-- skip autopair when next character is closing pair
-- and there are more closing pairs than opening pairs
skip_unbalanced = true,
-- better deal with markdown code blocks
markdown = true,
},
config = function(_, opts)
LazyVim.mini.pairs(opts)
end,
},
-- Improves comment syntax, lets Neovim handle multiple
-- types of comments for a single language, and relaxes rules
-- for uncommenting.
{
"folke/ts-comments.nvim",
event = "VeryLazy",
opts = {},
},
-- Extends the a & i text objects, this adds the ability to select
-- arguments, function calls, text within quotes and brackets
{
"nvim-mini/mini.ai",
event = "VeryLazy",
opts = function()
local ai = require("mini.ai")
return {
n_lines = 500,
custom_textobjects = {
o = ai.gen_spec.treesitter({
a = { "@block.outer", "@conditional.outer", "@loop.outer" },
i = { "@block.inner", "@conditional.inner", "@loop.inner" },
}),
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }),
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }),
t = { "<(%p%w-)%f[^<%w][^<>]->.*()</[^/]->$" },
d = { "%f[%d]%d+" },
e = { { "%u[%l%d]+%f[^%l%d]", "%f[%S][%l%d]+%f[^%l%d]" }, "^().*()$" },
g = LazyVim.mini.ai_buffer,
u = ai.gen_spec.function_call(),
U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }),
},
}
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)
end,
},
-- Configures LuaLS to support auto-completion and type checking
-- while editing your Neovim configuration.
{
"folke/lazydev.nvim",
ft = "lua",
cmd = "LazyDev",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim.uv" } },
{ path = "LazyVim", words = { "LazyVim" } },
{ path = "snacks.nvim", words = { "Snacks" } },
{ path = "lazy.nvim", words = { "LazyVim" } },
},
},
},
}

View file

@ -1,15 +1,71 @@
return {
-- gruvbox
{
"ellisonleao/gruvbox.nvim",
lazy = true,
priority = 1000,
opts = {},
},
-- tokyonight
{
"folke/tokyonight.nvim",
lazy = true,
opts = { style = "moon" },
},
-- catppuccin
{
"catppuccin/nvim",
lazy = false,
priority = 1000,
name = "catppuccin",
opts = {
terminal_colors = true,
transparent_mode = false,
lsp_styles = {
underlines = {
errors = { "undercurl" },
hints = { "undercurl" },
warnings = { "undercurl" },
information = { "undercurl" },
},
},
-- integrations = {
-- aerial = true,
-- alpha = true,
-- cmp = true,
-- dashboard = true,
-- flash = true,
-- fzf = true,
-- grug_far = true,
-- gitsigns = true,
-- headlines = true,
-- illuminate = true,
-- indent_blankline = { enabled = true },
-- leap = true,
-- lsp_trouble = true,
-- mason = true,
-- mini = true,
-- navic = { enabled = true, custom_bg = "lualine" },
-- neotest = true,
-- neotree = true,
-- noice = true,
-- notify = true,
-- snacks = true,
-- telescope = true,
-- treesitter_context = true,
-- which_key = true,
-- },
},
config = function(_, opts)
require("gruvbox").setup(opts)
vim.o.background = "dark"
vim.cmd.colorscheme("gruvbox")
end,
-- specs = {
-- {
-- "akinsho/bufferline.nvim",
-- optional = true,
-- opts = function(_, opts)
-- if (vim.g.colors_name or ""):find("catppuccin") then
-- opts.highlights = require("catppuccin.special.bufferline").get_theme()
-- end
-- end,
-- },
-- },
},
}

View file

@ -0,0 +1,44 @@
return {
-- Modern completion engine with built-in fuzzy matching
{
"saghen/blink.cmp",
dependencies = {
"rafamadriz/friendly-snippets",
},
version = "1.*",
event = "InsertEnter",
opts = {
-- Keymap preset options: 'default' | 'super-tab' | 'enter'
keymap = { preset = "default" },
appearance = {
-- Use mono nerd font variant
nerd_font_variant = "mono",
},
-- Default completion sources
sources = {
default = { "lsp", "path", "snippets", "buffer" },
},
completion = {
documentation = {
auto_show = true,
auto_show_delay_ms = 500,
},
menu = {
draw = {
columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind" } },
},
},
},
-- Fuzzy matching implementation
-- Options: "prefer_rust_with_warning" | "rust" | "lua"
fuzzy = {
implementation = "prefer_rust_with_warning",
},
},
opts_extend = { "sources.default" },
},
}

View file

@ -0,0 +1,60 @@
return {
-- Telescope - Fuzzy finder over lists
{
"nvim-telescope/telescope.nvim",
tag = "0.1.8",
dependencies = {
"nvim-lua/plenary.nvim",
},
cmd = "Telescope",
keys = {
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live Grep" },
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help Tags" },
},
opts = {
defaults = {
mappings = {
i = {
["<C-h>"] = "which_key",
},
},
},
},
},
-- Telescope FZF native - Better sorting performance
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
dependencies = { "nvim-telescope/telescope.nvim" },
config = function()
require("telescope").load_extension("fzf")
end,
},
-- Neo-tree - File explorer tree
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
},
cmd = "Neotree",
keys = {
{ "<leader>e", "<cmd>Neotree toggle<cr>", desc = "Toggle Neo-tree" },
{ "<leader>o", "<cmd>Neotree focus<cr>", desc = "Focus Neo-tree" },
},
opts = {
filesystem = {
follow_current_file = {
enabled = true,
},
use_libuv_file_watcher = true,
},
},
},
}

View file

@ -0,0 +1,48 @@
return {
{
"mfussenegger/nvim-lint",
event = { "BufReadPost", "BufNewFile", "BufWritePost" },
opts = {
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
linters_by_ft = {
-- Add linters per filetype here
-- fish = { "fish" },
-- javascript = { "eslint_d" },
-- python = { "ruff" },
},
linters = {},
},
config = function(_, opts)
local lint = require("lint")
-- Merge custom linter configs
for name, linter in pairs(opts.linters) do
if type(linter) == "table" and type(lint.linters[name]) == "table" then
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter)
else
lint.linters[name] = linter
end
end
lint.linters_by_ft = opts.linters_by_ft
-- Debounced lint function
local function debounce_lint()
local timer = vim.uv.new_timer()
return function()
timer:start(100, 0, vim.schedule_wrap(lint.try_lint))
end
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 = function()
lint_fn()
end,
})
end,
},
}

View file

@ -1,29 +0,0 @@
-- Declare language servers provided via Nix so LazyVim skips Mason installs.
return {
{
"mason-org/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = {}
end,
},
{
"neovim/nvim-lspconfig",
opts = function(_, opts)
opts.servers = opts.servers or {}
local servers = {
lua_ls = { mason = false },
nil_ls = { mason = false },
pyright = { mason = false },
tsserver = { mason = false },
rust_analyzer = { mason = false },
gopls = { mason = false },
clangd = { mason = false },
}
for server, server_opts in pairs(servers) do
local existing = opts.servers[server] or {}
opts.servers[server] = vim.tbl_deep_extend("force", existing, server_opts)
end
end,
},
}

View file

@ -1,6 +0,0 @@
-- Override mini.pick with the new repository location
return {
{
"nvim-mini/mini.pick",
},
}

View file

@ -1,6 +0,0 @@
return {
{
"sphamba/smear-cursor.nvim",
opts = {},
},
}

View file

@ -0,0 +1,42 @@
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",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"printf",
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
}

View file

@ -0,0 +1,174 @@
return {
-- Better UI for messages, cmdline and the popupmenu
{
"folke/noice.nvim",
event = "VeryLazy",
opts = {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
routes = {
{
filter = {
event = "msg_show",
any = {
{ find = "%d+L, %d+B" },
{ find = "; after #%d+" },
{ find = "; before #%d+" },
},
},
view = "mini",
},
},
presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
},
},
keys = {
{ "<leader>sn", "", desc = "+noice" },
{ "<leader>snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
{ "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
{ "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
{ "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
},
dependencies = {
"MunifTanjim/nui.nvim",
},
},
-- Statusline
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
options = {
theme = "auto",
globalstatus = true,
disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = {
{
"diagnostics",
symbols = {
error = " ",
warn = " ",
info = " ",
hint = " ",
},
},
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ "filename", path = 1, symbols = { modified = " ", readonly = "", unnamed = "" } },
},
lualine_x = {
{
"diff",
symbols = {
added = " ",
modified = " ",
removed = " ",
},
},
},
lualine_y = {
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
{ "location", padding = { left = 0, right = 1 } },
},
lualine_z = {
function()
return " " .. os.date("%R")
end,
},
},
extensions = { "lazy" },
}
end,
},
-- Bufferline
{
"akinsho/bufferline.nvim",
event = "VeryLazy",
keys = {
{ "<leader>bp", "<Cmd>BufferLineTogglePin<CR>", desc = "Toggle Pin" },
{ "<leader>bP", "<Cmd>BufferLineGroupClose ungrouped<CR>", desc = "Delete Non-Pinned Buffers" },
{ "<leader>bo", "<Cmd>BufferLineCloseOthers<CR>", desc = "Delete Other Buffers" },
{ "<leader>br", "<Cmd>BufferLineCloseRight<CR>", desc = "Delete Buffers to the Right" },
{ "<leader>bl", "<Cmd>BufferLineCloseLeft<CR>", desc = "Delete Buffers to the Left" },
{ "<S-h>", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev Buffer" },
{ "<S-l>", "<cmd>BufferLineCycleNext<cr>", desc = "Next Buffer" },
{ "[b", "<cmd>BufferLineCyclePrev<cr>", desc = "Prev Buffer" },
{ "]b", "<cmd>BufferLineCycleNext<cr>", desc = "Next Buffer" },
},
opts = {
options = {
close_command = function(n) require("mini.bufremove").delete(n, false) end,
right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end,
diagnostics = "nvim_lsp",
always_show_bufferline = false,
offsets = {
{
filetype = "neo-tree",
text = "Neo-tree",
highlight = "Directory",
text_align = "left",
},
},
},
},
dependencies = {
{
"nvim-mini/mini.bufremove",
keys = {
{ "<leader>bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" },
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
},
opts = {},
},
},
},
-- Indent guides
{
"lukas-reineke/indent-blankline.nvim",
event = { "BufReadPost", "BufNewFile" },
opts = {
indent = {
char = "",
tab_char = "",
},
scope = { show_start = false, show_end = false },
exclude = {
filetypes = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
},
},
main = "ibl",
},
-- Icons
{
"nvim-tree/nvim-web-devicons",
lazy = true,
},
}