refactor: restructure core modules into config directory for better organization

This commit is contained in:
sankalp committed 2025-10-17 15:33:11 +05:45
1 parent 16e50cdc3a
commit d3592bd80a
29 files changed
+1751 -1924

No files matched your search

+5 -6
View File
@@ -1,7 +1,6 @@
-- load config
require('core.options')
require('core.functions')
require('core.keys')
require('core.autocmd')
require('core.lsp')
require('core.lazy')
require("config.options")
require("config.keys")
require("config.autocmd")
require("config.lazy")
require("config.lsp")
+1 -3
View File
@@ -10,8 +10,7 @@
"gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"hardtime.nvim": { "branch": "main", "commit": "b4e431934af1fe224a3a801f632c008278cb7628" },
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
"lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"markview.nvim": { "branch": "main", "commit": "c93ea99d96b4bfda5b7c7d0dfca9c26edf6e78f0" },
@@ -20,7 +19,6 @@
"mason-nvim-lint": { "branch": "main", "commit": "767b8ccdddaa977bec8987fd7507b9865a279235" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"mdx.nvim": { "branch": "main", "commit": "464a74be368dce212cff02f6305845dc7f209ab3" },
"messenger.nvim": { "branch": "main", "commit": "309fec2ddd3de55eba2781b676931b37ce8190af" },
"mini.nvim": { "branch": "main", "commit": "8a7cf7eee8d89bd1b83f6d72f7f3b5598e7ae2cb" },
"neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" },
"neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" },
+187
View File
@@ -0,0 +1,187 @@
local function augroup(name)
return vim.api.nvim_create_augroup("nvim" .. name, { clear = true })
end
-- Strip trailing spaces before write
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
group = augroup("strip_space"),
pattern = { "*" },
callback = function()
vim.cmd([[ %s/\s\+$//e ]])
end,
})
-- Check if we need to reload the file when it changed
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
group = augroup("checktime"),
command = "checktime",
})
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = augroup("highlight_yank"),
callback = function()
vim.highlight.on_yank()
end,
})
-- resize splits if window got resized
vim.api.nvim_create_autocmd({ "VimResized" }, {
group = augroup("resize_splits"),
callback = function()
vim.cmd("tabdo wincmd =")
end,
})
-- go to last loc when opening a buffer
vim.api.nvim_create_autocmd("BufReadPost", {
group = augroup("last_loc"),
callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})
-- close some filetypes with <q>
vim.api.nvim_create_autocmd("FileType", {
group = augroup("close_with_q"),
pattern = {
"Jaq",
"PlenaryTestPopup",
"Avante",
"AvanteInput",
"AvanteSelectedFiles",
"fugitive",
"git",
"help",
"lir",
"lspinfo",
"man",
"netrw",
"notify",
"qf",
"spectre_panel",
"startuptime",
"tsplayground",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})
-- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = augroup("wrap_spell"),
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Auto create dir when saving a file, in case some intermediate directory does not exist
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
group = augroup("auto_create_dir"),
callback = function(event)
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})
-- Set arb filetype
vim.api.nvim_create_autocmd({ "BufEnter" }, {
group = augroup("set_file_type"),
pattern = { "*.arb" },
command = "setfiletype arb",
})
-- Disable format options
vim.api.nvim_create_autocmd("FileType", {
group = augroup("disable_formatoptions"),
pattern = "*",
callback = function()
vim.opt_local.formatoptions:remove({ "c", "r", "o" })
end,
})
local function enable_autoformat()
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
group = augroup("autoformat"),
pattern = { "*" },
callback = function()
vim.lsp.buf.format()
end,
})
end
enable_autoformat()
vim.api.nvim_create_user_command("WriteNoFormat", function()
-- Temporarily disable the autoformat autocmd
vim.api.nvim_del_augroup_by_name("keycodex_autoformat")
vim.cmd("write")
-- Re-enable the autoformat autocmd
enable_autoformat()
end, {})
-- Macro recording notifications
vim.api.nvim_create_autocmd("RecordingEnter", {
callback = function()
vim.notify("Macro recording started", vim.log.levels.INFO, {
title = "Macro",
timeout = 2000,
})
-- Print to command line for debugging
vim.cmd("echo 'Recording macro...'")
end,
})
vim.api.nvim_create_autocmd("RecordingLeave", {
callback = function()
vim.notify("Macro recording stopped", vim.log.levels.INFO, {
title = "Macro",
timeout = 2000,
})
-- Print to command line for debugging
vim.cmd("echo 'Macro recording stopped'")
end,
})
-- Function to show macro replay notification
local function show_macro_replay(count)
local message = count > 1 and string.format("Replaying macro %d times", count) or "Replaying macro"
vim.notify(message, vim.log.levels.INFO, {
title = "Macro",
timeout = 2000,
})
end
-- Function to clear all macros
local function clear_all_macros()
-- Clear all registers from a to z
for i = 97, 122 do -- ASCII values for 'a' to 'z'
vim.fn.setreg(string.char(i), "")
end
-- Clear all registers from 0 to 9
for i = 48, 57 do -- ASCII values for '0' to '9'
vim.fn.setreg(string.char(i), "")
end
vim.notify("All macros cleared", vim.log.levels.INFO, {
title = "Macro",
timeout = 2000,
})
end
-- Create keymaps for macro replay with notifications
vim.keymap.set("n", "@", function()
local count = vim.v.count1
show_macro_replay(count)
return "@"
end, { expr = true })
-- Add keybinding to clear all macros
vim.keymap.set("n", "<leader>mc", clear_all_macros, { desc = "Clear all macros" })
+66
View File
@@ -0,0 +1,66 @@
local treesitter_parsers = {
"c",
"markdown",
"python",
"java",
"cpp",
"bash",
"lua",
"make",
"json",
"jsonc",
"sql",
"yaml",
"toml",
"javascript",
"typescript",
"gitignore",
"go",
"rust",
"html",
"css",
"scss",
"markdown_inline",
}
local lsp_server = {
"ts_ls",
"html",
"cssls",
"tailwindcss",
"lua_ls",
"basedpyright",
"bashls",
"clangd",
"rust_analyzer",
}
local formatter = {
"clang_format",
"ruff",
"stylua",
"prettier",
"markdown-toc",
"markdownlint-cli2",
"biome",
}
local linter = {
"eslint_d",
"hadolint",
"write_good",
"markdownlint",
"shellcheck",
"actionlint",
"djlint",
"ruff",
"codespell",
"cspell",
}
return {
ts_parsers = treesitter_parsers,
lsp_server = lsp_server,
formatter = formatter,
linter = linter,
}
+140
View File
@@ -0,0 +1,140 @@
local function map(mode, lhs, rhs, opts)
opts = opts or {}
opts.silent = opts.silent ~= false
vim.keymap.set(mode, lhs, rhs, opts)
end
local opts = { noremap = true, silent = true }
-- Space as leader
map("n", "<Space>", "", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Modes
-- normal_mode = "n", insert_mode = "i", visual_mode = "v",
-- visual_block_mode = "x", term_mode = "t", command_mode = "c",
-- Terminal Mappings
map("t", "jk", "<C-\\><C-n>")
map("t", "kj", "<C-\\><C-n>")
map("t", "<ESC>", "<C-\\><C-n>")
-- Clear search, diff update and redraw
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" })
map({ "i", "c" }, "<C-b>", "<Left>")
map({ "i", "c" }, "<C-f>", "<Right>")
map("n", "<leader>rL", vim.lsp.buf.rename, { desc = "Rename Lsp Symbol" })
map("n", "`", "'", { noremap = true }) -- better marks
map({ "n", "v" }, "H", "^", { desc = "Move to the beginning of the line" })
map({ "n", "v" }, "L", "$", { desc = "Move to the end of the line" })
-- Visual overwrite paste
map({ "v", "x" }, "p", '"_dP', opts)
-- Do not copy on x
map({ "v", "x" }, "x", '"_x', opts)
map("n", "X", '"_D', opts)
map("n", "dd", '"_dd', opts)
map({ "v", "x" }, "X", '"_d', opts)
-- Select all
map("n", "<C-a>", "ggVG", { desc = "Select all" })
map("i", "<C-a>", "<Esc>ggVG", { desc = "Select all" })
-- Move text up and down
map({ "v", "x" }, "K", ":move '<-2<cr>gv-gv", opts)
map({ "v", "x" }, "J", ":move '>+1<cr>gv-gv", opts)
-- Line operations
map("n", "<A-k>", ":m .-2<CR>==", { desc = "Move line up" })
map("n", "<A-j>", ":m .+1<CR>==", { desc = "Move line down" })
map("i", "<A-k>", "<Esc>:m .-2<CR>==gi", { desc = "Move line up" })
map("i", "<A-j>", "<Esc>:m .+1<CR>==gi", { desc = "Move line down" })
map("v", "<A-k>", ":m '<-2<CR>gv=gv", { desc = "Move selection up" })
map("v", "<A-j>", ":m '>+1<CR>gv=gv", { desc = "Move selection down" })
-- Line manipulation
map("n", "<C-]>", ">>", { desc = "Indent line" })
map("n", "<C-[>", "<<", { desc = "Unindent line" })
map("i", "<C-]>", "<C-o>>>", { desc = "Indent line" })
map("i", "<C-[>", "<C-o><<", { desc = "Unindent line" })
-- Quick word operations
map("n", "<C-BS>", "db", { desc = "Delete word backward" })
map("i", "<C-BS>", "<C-w>", { desc = "Delete word backward" })
map("n", "<C-Del>", "dw", { desc = "Delete word forward" })
map("i", "<C-Del>", "<C-o>dw", { desc = "Delete word forward" })
map("n", "d", '"_d', { desc = "Delete without replacing clipboard" })
map("n", "x", '"_x', { desc = "Cut without replacing clipboard" })
map("n", "c", '"_c', { desc = "Change without replacing clipboard" })
map("v", "p", '"_dP', { desc = "Paste without replacing clipboard" })
--insert the following characters around the visual selection
map("v", "<leader>(", "s()<esc>Pll", { desc = "wrap selection with parens" })
map("v", "<leader>[", "s[]<esc>Pll", { desc = "wrap selection with square braces" })
map("v", "<leader>{", "s{}<esc>Pll", { desc = "wrap selection with curly braces" })
map("v", "<leader>'", "s''<esc>Pll", { desc = "wrap selection with single quotes" })
map("v", '<leader>"', 's""<esc>Pll', { desc = "wrap selection with double quotes" })
-- Insert mode cursor movement with Ctrl+hjkl
map({ "i", "c" }, "<C-h>", "<Left>", { noremap = true, silent = true })
map({ "i", "c" }, "<C-j>", "<Down>", { noremap = true, silent = true })
map({ "i", "c" }, "<C-k>", "<Up>", { noremap = true, silent = true })
map({ "i", "c" }, "<C-l>", "<Right>", { noremap = true, silent = true })
map("n", "<leader>re", ":%s/<C-R><C-W>/", { desc = "Shortcut to replace current word under cursor" })
-- toggle inlay hints
vim.keymap.set("n", "<leader>th", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end)
-- No arrow navigation
local modes = { "n", "v", "i" }
local arrows = { "<Up>", "<Down>", "<Left>", "<Right>" }
for _, mode in ipairs(modes) do
for _, key in ipairs(arrows) do
vim.api.nvim_set_keymap(mode, key, "<Nop>", opts)
end
end
-- Go to Beginning or End of line
map({ "n", "v" }, "H", "_^", { desc = "Move to the beginning of the line" })
map({ "n", "v" }, "L", "$", { desc = "Move to the end of the line" })
-- Search inside visually highlighted text.
map("x", "g/", "<esc>/\\%V", { silent = false, desc = "Search inside visual selection" })
-- Search & replace in current file/line
map("v", "<leader>rw", '"9y:%s@<c-r>9@<c-r>9@g<left><left>', { desc = "Search & replace selection", silent = false })
map("n", "<leader>rw", 'viw"9y:%s@<c-r>9@<c-r>9@g<left><left>', { desc = "Search & replace word", silent = false })
map(
"v",
"<leader>rl",
'"9y:s@<c-r>9@<c-r>9@g<left><left>',
{ desc = "Search & replace in current line", silent = false }
)
map(
"n",
"<leader>rl",
'viw"9y:s@<c-r>9@<c-r>9@g<left><left>',
{ desc = "Search & replace word in current line", silent = false }
)
-- Folds
map("n", "<leader><", function()
if not vim.opt.foldmethod then
vim.opt.foldmethod = "indent"
end
vim.cmd("normal! zM")
end, { desc = "Fold all" })
map("n", "<leader>>", function()
vim.opt.foldenable = false
vim.cmd("normal! zR")
end, { desc = "Open all folds" })
+10 -10
View File
@@ -1,15 +1,15 @@
--------------------------------------------------------------------------------
-- Bootstrap lazy plugin manager
--------------------------------------------------------------------------------
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath })
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, 'WarningMsg' },
{ '\nPress any key to exit...' },
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
@@ -18,20 +18,20 @@ end
vim.opt.rtp:prepend(lazypath)
-- lazy config
require('lazy').setup({
require("lazy").setup({
spec = {
{ import = 'plugins' },
{ import = "plugins" },
},
install = {
missing = true,
colorscheme = { 'gruvbox' },
colorscheme = { "gruvbox" },
},
change_detection = {
enable = true,
notify = false,
},
ui = {
border = 'rounded',
border = "rounded",
backdrop = 100,
},
})
+100
View File
@@ -0,0 +1,100 @@
--------------------------------------------------------------------------------
-- LSP
--------------------------------------------------------------------------------
-- ts_ls
vim.lsp.config("ts_ls", {
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
})
vim.lsp.enable("ts_ls")
vim.lsp.enable("html")
vim.lsp.enable("cssls")
vim.lsp.enable("tailwindcss")
-- rust
vim.lsp.config("rust_analyzer", {
settings = {
["rust-analyzer"] = {
diagnostics = {
enable = true,
experimental = { enable = true },
},
},
},
})
vim.lsp.enable("rust_analyzer")
-- lua
vim.lsp.config("lua_ls", {
settings = {
Lua = {
diagnostics = {
disable = {
"missing-fields",
"undefined-global",
},
},
},
},
})
vim.lsp.enable("lua_ls")
-- python
vim.lsp.config("basedpyright", {
settings = {
basedpyright = {
inlayHints = true,
analysis = {
diagnosticSeverityOverrides = {
reportUnusedImport = "none",
reportUnusedVariable = "none",
reportAttributeAccessIssue = "none",
reportUnusedClass = "none",
reportUnusedFunction = "none",
reportDuplicateImport = "none",
reportArgumentType = "error",
},
typeCheckingMode = "standard",
},
},
},
})
vim.lsp.enable("basedpyright")
-- bash
vim.lsp.config("bashls", {
settings = {
bashIde = {
shellcheckArguments = {
"--exclude=SC1090,SC1091,SC2076,SC2164",
},
},
},
})
vim.lsp.enable("bashls")
-- cpp
vim.lsp.config("clangd", {
cmd = {
"clangd",
"--fallback-style=llvm",
"--header-insertion=iwyu",
"-j=4",
},
})
vim.lsp.enable("clangd")
+67
View File
@@ -0,0 +1,67 @@
local options = {
ai = true,
clipboard = "unnamedplus", -- use system clipboard
number = true,
relativenumber = true,
undofile = true, -- save state of file on write
undodir = vim.fn.stdpath("cache") .. "/undo",
undolevels = 10000,
autoread = true, -- autoread changes from other sources
signcolumn = "yes",
cursorline = true,
cursorlineopt = "number",
wrap = false,
scrolloff = 3,
ruler = false, -- removes cursor position from lastline
pumheight = 10, -- size of completion window
showmode = false, -- do not show mode under statusline
swapfile = false, -- creates a swapfile
backup = false, -- creates a backup file
writebackup = false, -- do not edit backups
winminwidth = 5, -- Minimum window width
termguicolors = true, -- set term gui colors (most terminals support this)
showtabline = 0, -- always show tabs
showcmd = false,
mouse = "a", -- allow the mouse to be used in neovim
confirm = true, -- Confirm to save changes before exiting modified buffer
-- tabs
smarttab = true,
tabstop = 4, -- 1 tab represented as 4 spaces
expandtab = true, -- <tab> key will create " " instead of "\t"
shiftwidth = 4, -- indent change after backspace and >> <<
softtabstop = 4, -- number of spaces instead of tab
autoindent = true, -- auto indent
smartindent = true, -- make indenting smarter again
list = true,
-- listchars = { trail = "", tab = "", nbsp = "_", extends = ">", precedes = "<" }, -- highlight
showbreak = string.rep(" ", 3),
-- Search
ignorecase = true,
smartcase = true,
hlsearch = true,
wildmenu = true,
wildmode = "longest:full,full",
wildoptions = "pum",
-- Window
splitright = true,
splitbelow = true,
title = true,
}
for k, v in pairs(options) do
vim.opt[k] = v
end
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.path:append({ "**" })
vim.opt.shortmess:append({ W = true, I = true, c = true }) -- disable greeting
-- Fix markdown indentation settings
vim.g.markdown_recommended_style = 0
vim.cmd([[set fillchars+=eob:\ ]])
-187
View File
@@ -1,187 +0,0 @@
local function augroup(name)
return vim.api.nvim_create_augroup('nvim' .. name, { clear = true })
end
-- Strip trailing spaces before write
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = augroup('strip_space'),
pattern = { '*' },
callback = function()
vim.cmd([[ %s/\s\+$//e ]])
end,
})
-- Check if we need to reload the file when it changed
vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, {
group = augroup('checktime'),
command = 'checktime',
})
-- Highlight on yank
vim.api.nvim_create_autocmd('TextYankPost', {
group = augroup('highlight_yank'),
callback = function()
vim.highlight.on_yank()
end,
})
-- resize splits if window got resized
vim.api.nvim_create_autocmd({ 'VimResized' }, {
group = augroup('resize_splits'),
callback = function()
vim.cmd('tabdo wincmd =')
end,
})
-- go to last loc when opening a buffer
vim.api.nvim_create_autocmd('BufReadPost', {
group = augroup('last_loc'),
callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})
-- close some filetypes with <q>
vim.api.nvim_create_autocmd('FileType', {
group = augroup('close_with_q'),
pattern = {
'Jaq',
'PlenaryTestPopup',
'Avante',
'AvanteInput',
'AvanteSelectedFiles',
'fugitive',
'git',
'help',
'lir',
'lspinfo',
'man',
'netrw',
'notify',
'qf',
'spectre_panel',
'startuptime',
'tsplayground',
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set('n', 'q', '<cmd>close<cr>', { buffer = event.buf, silent = true })
end,
})
-- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd('FileType', {
group = augroup('wrap_spell'),
pattern = { 'gitcommit', 'markdown' },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Auto create dir when saving a file, in case some intermediate directory does not exist
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = augroup('auto_create_dir'),
callback = function(event)
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p')
end,
})
-- Set arb filetype
vim.api.nvim_create_autocmd({ 'BufEnter' }, {
group = augroup('set_file_type'),
pattern = { '*.arb' },
command = 'setfiletype arb',
})
-- Disable format options
vim.api.nvim_create_autocmd('FileType', {
group = augroup('disable_formatoptions'),
pattern = '*',
callback = function()
vim.opt_local.formatoptions:remove({ 'c', 'r', 'o' })
end,
})
local function enable_autoformat()
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = augroup('autoformat'),
pattern = { '*' },
callback = function()
vim.lsp.buf.format()
end,
})
end
enable_autoformat()
vim.api.nvim_create_user_command('WriteNoFormat', function()
-- Temporarily disable the autoformat autocmd
vim.api.nvim_del_augroup_by_name('keycodex_autoformat')
vim.cmd('write')
-- Re-enable the autoformat autocmd
enable_autoformat()
end, {})
-- Macro recording notifications
vim.api.nvim_create_autocmd('RecordingEnter', {
callback = function()
vim.notify('Macro recording started', vim.log.levels.INFO, {
title = 'Macro',
timeout = 2000,
})
-- Print to command line for debugging
vim.cmd("echo 'Recording macro...'")
end,
})
vim.api.nvim_create_autocmd('RecordingLeave', {
callback = function()
vim.notify('Macro recording stopped', vim.log.levels.INFO, {
title = 'Macro',
timeout = 2000,
})
-- Print to command line for debugging
vim.cmd("echo 'Macro recording stopped'")
end,
})
-- Function to show macro replay notification
local function show_macro_replay(count)
local message = count > 1 and string.format('Replaying macro %d times', count) or 'Replaying macro'
vim.notify(message, vim.log.levels.INFO, {
title = 'Macro',
timeout = 2000,
})
end
-- Function to clear all macros
local function clear_all_macros()
-- Clear all registers from a to z
for i = 97, 122 do -- ASCII values for 'a' to 'z'
vim.fn.setreg(string.char(i), '')
end
-- Clear all registers from 0 to 9
for i = 48, 57 do -- ASCII values for '0' to '9'
vim.fn.setreg(string.char(i), '')
end
vim.notify('All macros cleared', vim.log.levels.INFO, {
title = 'Macro',
timeout = 2000,
})
end
-- Create keymaps for macro replay with notifications
vim.keymap.set('n', '@', function()
local count = vim.v.count1
show_macro_replay(count)
return '@'
end, { expr = true })
-- Add keybinding to clear all macros
vim.keymap.set('n', '<leader>mc', clear_all_macros, { desc = 'Clear all macros' })
-68
View File
@@ -1,68 +0,0 @@
-- Reload neovim config
vim.api.nvim_create_user_command('ReloadConfig', function()
for name, _ in pairs(package.loaded) do
if name:match('^plugins') then
package.loaded[name] = nil
end
end
dofile(vim.env.MYVIMRC)
vim.notify('Nvim configuration reloaded!', vim.log.levels.INFO)
end, {})
local function copy_to_clipboard(content, message)
vim.fn.setreg('+', content)
vim.notify('Copied "' .. content .. '" to the clipboard!', vim.log.levels.INFO)
end
vim.api.nvim_create_user_command('CopyRelativePath', function()
local path = vim.fn.expand('%')
copy_to_clipboard(path, 'Copied "' .. path .. '" to the clipboard!')
end, {})
vim.api.nvim_create_user_command('CopyAbsolutePath', function()
local path = vim.fn.expand('%:p')
copy_to_clipboard(path, 'Copied "' .. path .. '" to the clipboard!')
end, {})
vim.api.nvim_create_user_command('CopyRelativePathWithLine', function()
local path = vim.fn.expand('%')
local line = vim.fn.line('.')
local result = path .. ':' .. line
copy_to_clipboard(result, 'Copied "' .. result .. '" to the clipboard!')
end, {})
vim.api.nvim_create_user_command('CopyAbsolutePathWithLine', function()
local path = vim.fn.expand('%:p')
local line = vim.fn.line('.')
local result = path .. ':' .. line
copy_to_clipboard(result, 'Copied "' .. result .. '" to the clipboard!')
end, {})
vim.api.nvim_create_user_command('CopyFileName', function()
local path = vim.fn.expand('%:t')
copy_to_clipboard(path, 'Copied "' .. path .. '" to the clipboard!')
end, {})
-- Switch to git root or file parent dir
vim.api.nvim_create_user_command('RootDir', function()
local bufname = vim.fn.expand('%:p')
if vim.fn.filereadable(bufname) == 0 then
return
end
local parent = vim.fn.fnamemodify(bufname, ':h')
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.fnameescape(parent) .. ' rev-parse --show-toplevel')
local root = ''
if #git_root > 0 and git_root[1] ~= '' then
root = git_root[1]
else
root = parent
end
if root ~= '' then
vim.cmd('lcd ' .. vim.fn.fnameescape(root))
vim.notify('Changed directory to ' .. root, vim.log.levels.INFO)
end
end, {})
-140
View File
@@ -1,140 +0,0 @@
local function map(mode, lhs, rhs, opts)
opts = opts or {}
opts.silent = opts.silent ~= false
vim.keymap.set(mode, lhs, rhs, opts)
end
local opts = { noremap = true, silent = true }
-- Space as leader
map('n', '<Space>', '', opts)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Modes
-- normal_mode = "n", insert_mode = "i", visual_mode = "v",
-- visual_block_mode = "x", term_mode = "t", command_mode = "c",
-- Terminal Mappings
map('t', 'jk', '<C-\\><C-n>')
map('t', 'kj', '<C-\\><C-n>')
map('t', '<ESC>', '<C-\\><C-n>')
-- Clear search, diff update and redraw
map({ 'i', 'n' }, '<esc>', '<cmd>noh<cr><esc>', { desc = 'Escape and clear hlsearch' })
map({ 'i', 'c' }, '<C-b>', '<Left>')
map({ 'i', 'c' }, '<C-f>', '<Right>')
map('n', '<leader>rL', vim.lsp.buf.rename, { desc = 'Rename Lsp Symbol' })
map('n', '`', "'", { noremap = true }) -- better marks
map({ 'n', 'v' }, 'H', '^', { desc = 'Move to the beginning of the line' })
map({ 'n', 'v' }, 'L', '$', { desc = 'Move to the end of the line' })
-- Visual overwrite paste
map({ 'v', 'x' }, 'p', '"_dP', opts)
-- Do not copy on x
map({ 'v', 'x' }, 'x', '"_x', opts)
map('n', 'X', '"_D', opts)
map('n', 'dd', '"_dd', opts)
map({ 'v', 'x' }, 'X', '"_d', opts)
-- Select all
map('n', '<C-a>', 'ggVG', { desc = 'Select all' })
map('i', '<C-a>', '<Esc>ggVG', { desc = 'Select all' })
-- Move text up and down
map({ 'v', 'x' }, 'K', ":move '<-2<cr>gv-gv", opts)
map({ 'v', 'x' }, 'J', ":move '>+1<cr>gv-gv", opts)
-- Line operations
map('n', '<A-k>', ':m .-2<CR>==', { desc = 'Move line up' })
map('n', '<A-j>', ':m .+1<CR>==', { desc = 'Move line down' })
map('i', '<A-k>', '<Esc>:m .-2<CR>==gi', { desc = 'Move line up' })
map('i', '<A-j>', '<Esc>:m .+1<CR>==gi', { desc = 'Move line down' })
map('v', '<A-k>', ":m '<-2<CR>gv=gv", { desc = 'Move selection up' })
map('v', '<A-j>', ":m '>+1<CR>gv=gv", { desc = 'Move selection down' })
-- Line manipulation
map('n', '<C-]>', '>>', { desc = 'Indent line' })
map('n', '<C-[>', '<<', { desc = 'Unindent line' })
map('i', '<C-]>', '<C-o>>>', { desc = 'Indent line' })
map('i', '<C-[>', '<C-o><<', { desc = 'Unindent line' })
-- Quick word operations
map('n', '<C-BS>', 'db', { desc = 'Delete word backward' })
map('i', '<C-BS>', '<C-w>', { desc = 'Delete word backward' })
map('n', '<C-Del>', 'dw', { desc = 'Delete word forward' })
map('i', '<C-Del>', '<C-o>dw', { desc = 'Delete word forward' })
map('n', 'd', '"_d', { desc = 'Delete without replacing clipboard' })
map('n', 'x', '"_x', { desc = 'Cut without replacing clipboard' })
map('n', 'c', '"_c', { desc = 'Change without replacing clipboard' })
map('v', 'p', '"_dP', { desc = 'Paste without replacing clipboard' })
--insert the following characters around the visual selection
map('v', '<leader>(', 's()<esc>Pll', { desc = 'wrap selection with parens' })
map('v', '<leader>[', 's[]<esc>Pll', { desc = 'wrap selection with square braces' })
map('v', '<leader>{', 's{}<esc>Pll', { desc = 'wrap selection with curly braces' })
map('v', "<leader>'", "s''<esc>Pll", { desc = 'wrap selection with single quotes' })
map('v', '<leader>"', 's""<esc>Pll', { desc = 'wrap selection with double quotes' })
-- Insert mode cursor movement with Ctrl+hjkl
map({ 'i', 'c' }, '<C-h>', '<Left>', { noremap = true, silent = true })
map({ 'i', 'c' }, '<C-j>', '<Down>', { noremap = true, silent = true })
map({ 'i', 'c' }, '<C-k>', '<Up>', { noremap = true, silent = true })
map({ 'i', 'c' }, '<C-l>', '<Right>', { noremap = true, silent = true })
map('n', '<leader>re', ':%s/<C-R><C-W>/', { desc = 'Shortcut to replace current word under cursor' })
-- toggle inlay hints
vim.keymap.set('n', '<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end)
-- No arrow navigation
local modes = { 'n', 'v', 'i' }
local arrows = { '<Up>', '<Down>', '<Left>', '<Right>' }
for _, mode in ipairs(modes) do
for _, key in ipairs(arrows) do
vim.api.nvim_set_keymap(mode, key, '<Nop>', opts)
end
end
-- Go to Beginning or End of line
map({ 'n', 'v' }, 'H', '_^', { desc = 'Move to the beginning of the line' })
map({ 'n', 'v' }, 'L', '$', { desc = 'Move to the end of the line' })
-- Search inside visually highlighted text.
map('x', 'g/', '<esc>/\\%V', { silent = false, desc = 'Search inside visual selection' })
-- Search & replace in current file/line
map('v', '<leader>rw', '"9y:%s@<c-r>9@<c-r>9@g<left><left>', { desc = 'Search & replace selection', silent = false })
map('n', '<leader>rw', 'viw"9y:%s@<c-r>9@<c-r>9@g<left><left>', { desc = 'Search & replace word', silent = false })
map(
'v',
'<leader>rl',
'"9y:s@<c-r>9@<c-r>9@g<left><left>',
{ desc = 'Search & replace in current line', silent = false }
)
map(
'n',
'<leader>rl',
'viw"9y:s@<c-r>9@<c-r>9@g<left><left>',
{ desc = 'Search & replace word in current line', silent = false }
)
-- Folds
map('n', '<leader><', function()
if not vim.opt.foldmethod then
vim.opt.foldmethod = 'indent'
end
vim.cmd('normal! zM')
end, { desc = 'Fold all' })
map('n', '<leader>>', function()
vim.opt.foldenable = false
vim.cmd('normal! zR')
end, { desc = 'Open all folds' })
-135
View File
@@ -1,135 +0,0 @@
--------------------------------------------------------------------------------
-- LSP
--------------------------------------------------------------------------------
-- ts_ls
vim.lsp.config('ts_ls', {
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
})
vim.lsp.enable('ts_ls')
-- rust
vim.lsp.config('rust_analyzer', {
settings = {
['rust-analyzer'] = {
diagnostics = {
enable = true,
experimental = { enable = true },
},
},
},
})
vim.lsp.enable('rust_analyzer')
-- lua
vim.lsp.config('lua_ls', {
settings = {
Lua = {
diagnostics = {
disable = {
'missing-fields',
'undefined-global',
},
},
},
},
})
vim.lsp.enable('lua_ls')
-- python
vim.lsp.config('basedpyright', {
settings = {
basedpyright = {
inlayHints = true,
disableDiagnostics = true,
disableOrganizeImports = true,
analysis = {
-- Ignore all files for analysis to exclusively use Ruff for linting
-- Enable diagnostics
-- ignore = { "*" },
diagnosticSeverityOverrides = {
reportUnusedImport = 'none',
reportUnusedVariable = 'none',
reportAttributeAccessIssue = 'none',
reportUnusedClass = 'none',
reportUnusedFunction = 'none',
reportDuplicateImport = 'none',
reportArgumentType = 'error',
},
typeCheckingMode = 'standard',
},
},
},
})
vim.lsp.enable('basedpyright')
-- vim.lsp.config('pylsp', {
-- settings = {
-- pylsp = {
-- plugins = {
-- -- use black as default formatter
-- yapf = { enabled = false },
-- autopep8 = { enabled = false },
-- black = { enabled = true },
-- pycodestyle = {
-- enabled = true,
-- ignore = { 'E203', 'E701', 'W503' },
-- maxLineLength = 88,
-- },
-- },
-- },
-- },
-- })
-- latex
vim.lsp.config('texlab', {
settings = {
texlab = {
build = {
executable = 'latexmk',
args = {
'-lualatex',
'-interaction=nonstopmode',
'-outdir=build',
},
onSave = true,
},
},
},
})
vim.lsp.enable('texlab')
-- bash
vim.lsp.config('bashls', {
settings = {
bashIde = {
shellcheckArguments = {
'--exclude=SC1090,SC1091,SC2076,SC2164',
},
},
},
})
vim.lsp.enable('bashls')
-- cpp
vim.lsp.config('clangd', {
cmd = {
'clangd',
'--fallback-style=llvm',
'--header-insertion=iwyu',
'-j=4',
},
})
vim.lsp.enable('clangd')
-67
View File
@@ -1,67 +0,0 @@
local options = {
ai = true,
clipboard = 'unnamedplus', -- use system clipboard
number = true,
relativenumber = true,
undofile = true, -- save state of file on write
undodir = vim.fn.stdpath('cache') .. '/undo',
undolevels = 10000,
autoread = true, -- autoread changes from other sources
signcolumn = 'yes',
cursorline = true,
cursorlineopt = 'number',
wrap = false,
scrolloff = 3,
ruler = false, -- removes cursor position from lastline
pumheight = 10, -- size of completion window
showmode = false, -- do not show mode under statusline
swapfile = false, -- creates a swapfile
backup = false, -- creates a backup file
writebackup = false, -- do not edit backups
winminwidth = 5, -- Minimum window width
termguicolors = true, -- set term gui colors (most terminals support this)
showtabline = 0, -- always show tabs
showcmd = false,
mouse = 'a', -- allow the mouse to be used in neovim
confirm = true, -- Confirm to save changes before exiting modified buffer
-- tabs
smarttab = true,
tabstop = 4, -- 1 tab represented as 4 spaces
expandtab = true, -- <tab> key will create " " instead of "\t"
shiftwidth = 4, -- indent change after backspace and >> <<
softtabstop = 4, -- number of spaces instead of tab
autoindent = true, -- auto indent
smartindent = true, -- make indenting smarter again
list = true,
-- listchars = { trail = "", tab = "", nbsp = "_", extends = ">", precedes = "<" }, -- highlight
showbreak = string.rep(' ', 3),
-- Search
ignorecase = true,
smartcase = true,
hlsearch = true,
wildmenu = true,
wildmode = 'longest:full,full',
wildoptions = 'pum',
-- Window
splitright = true,
splitbelow = true,
title = true,
}
for k, v in pairs(options) do
vim.opt[k] = v
end
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.path:append({ '**' })
vim.opt.shortmess:append({ W = true, I = true, c = true }) -- disable greeting
-- Fix markdown indentation settings
vim.g.markdown_recommended_style = 0
vim.cmd([[set fillchars+=eob:\ ]])
+152 -26
View File
@@ -1,52 +1,178 @@
return {
-- completion
{
"saghen/blink.cmp",
version = "*",
config = function()
require("blink.cmp").setup({
completion = {
list = {
selection = {
preselect = false,
auto_insert = true,
},
},
documentation = {
window = { border = "rounded" },
auto_show = true,
auto_show_delay_ms = 50,
},
menu = {
border = "rounded",
draw = {
components = {
kind_icon = {
text = function(ctx)
local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
return kind_icon
end,
highlight = function(ctx)
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
return hl
end,
},
kind = {
highlight = function(ctx)
local _, hl, _ = require("mini.icons").get("lsp", ctx.kind)
return hl
end,
},
},
},
},
},
signature = {
window = { border = "rounded" },
},
snippets = { preset = "luasnip" },
sources = {
default = { "lsp", "path", "snippets", "buffer" },
providers = {},
},
keymap = {
preset = "none",
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
["<Tab>"] = { "select_next", "snippet_forward", "fallback" },
["<CR>"] = { "accept", "fallback" },
["<C-space>"] = { "hide", "show" },
["<C-y>"] = { "show", "show_documentation", "hide_documentation" },
["<C-u>"] = { "scroll_documentation_up", "fallback" },
["<C-d>"] = { "scroll_documentation_down", "fallback" },
},
})
end,
},
-- snippets
{
"L3MON4D3/LuaSnip",
version = "*",
dependencies = { "rafamadriz/friendly-snippets" },
config = function()
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load({
paths = { vim.fn.stdpath("config") .. "/snippets" },
})
luasnip.filetype_extend("mdx", { "markdown" })
end,
},
-- auto pairs
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
local npairs = require('nvim-autopairs')
local Rule = require('nvim-autopairs.rule')
local conds = require('nvim-autopairs.conds')
local npairs = require("nvim-autopairs")
local Rule = require("nvim-autopairs.rule")
local conds = require("nvim-autopairs.conds")
npairs.setup()
-- Autoclosing angle-brackets.
npairs.add_rule(Rule('<', '>', {
npairs.add_rule(Rule("<", ">", {
-- Avoid conflicts with nvim-ts-autotag.
'-html',
'-javascriptreact',
'-typescriptreact',
}):with_pair(conds.before_regex('%a+:?:?$', 3)):with_move(function(opts)
return opts.char == '>'
"-html",
"-javascriptreact",
"-typescriptreact",
}):with_pair(conds.before_regex("%a+:?:?$", 3)):with_move(function(opts)
return opts.char == ">"
end))
end,
},
-- auto tag
{
'windwp/nvim-ts-autotag',
"windwp/nvim-ts-autotag",
ft = {
'html',
'xml',
'javascript',
'typescript',
'javascriptreact',
'typescriptreact',
'jsx',
'tsx',
'vue',
'svelte',
'markdown',
'htmldjango',
"html",
"xml",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"jsx",
"tsx",
"vue",
"svelte",
"markdown",
"htmldjango",
},
event = 'InsertEnter',
event = "InsertEnter",
lazy = true,
config = function()
require('nvim-ts-autotag').setup({
require("nvim-ts-autotag").setup({
enable_close = true,
enable_rename = true,
enable_close_on_slash = true,
})
end,
},
-- comment
{
"numToStr/Comment.nvim",
dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring",
},
config = function()
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
mappings = {
basic = true,
extra = true,
},
})
end,
keys = {
{ "gcc", mode = "n", desc = "Toggle comment line" },
{ "gc", mode = { "n", "o" }, desc = "Toggle comment linewise" },
{ "gc", mode = "x", desc = "Toggle comment linewise (visual)" },
{ "gbc", mode = "n", desc = "Toggle comment block" },
{ "gb", mode = { "n", "o" }, desc = "Toggle comment blockwise" },
{ "gb", mode = "x", desc = "Toggle comment blockwise (visual)" },
},
},
-- treesitter
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = require("config.extensions").ts_parsers,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
},
indent = {
enable = true,
},
})
end,
},
}
-81
View File
@@ -1,81 +0,0 @@
return {
-- snippets
{
'L3MON4D3/LuaSnip',
version = '*',
dependencies = { 'rafamadriz/friendly-snippets' },
config = function()
local luasnip = require('luasnip')
require('luasnip.loaders.from_vscode').lazy_load()
require('luasnip.loaders.from_vscode').lazy_load({
paths = { vim.fn.stdpath('config') .. '/snippets' },
})
luasnip.filetype_extend('mdx', { 'markdown' })
end,
},
-- completion
{
'saghen/blink.cmp',
version = '*',
config = function()
require('blink.cmp').setup({
completion = {
list = {
selection = {
preselect = false,
auto_insert = true,
},
},
documentation = {
window = { border = 'rounded' },
auto_show = true,
auto_show_delay_ms = 50,
},
menu = {
border = 'rounded',
draw = {
components = {
kind_icon = {
text = function(ctx)
local kind_icon, _, _ = require('mini.icons').get('lsp', ctx.kind)
return kind_icon
end,
highlight = function(ctx)
local _, hl, _ = require('mini.icons').get('lsp', ctx.kind)
return hl
end,
},
kind = {
highlight = function(ctx)
local _, hl, _ = require('mini.icons').get('lsp', ctx.kind)
return hl
end,
},
},
},
},
},
signature = {
window = { border = 'rounded' },
},
snippets = { preset = 'luasnip' },
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
providers = {},
},
keymap = {
preset = 'none',
['<S-Tab>'] = { 'select_prev', 'snippet_backward', 'fallback' },
['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
['<CR>'] = { 'accept', 'fallback' },
['<C-space>'] = { 'hide', 'show' },
['<C-y>'] = { 'show', 'show_documentation', 'hide_documentation' },
['<C-u>'] = { 'scroll_documentation_up', 'fallback' },
['<C-d>'] = { 'scroll_documentation_down', 'fallback' },
},
})
end,
},
}
+164 -40
View File
@@ -1,11 +1,75 @@
return {
-- gitignore generator
{
'zbirenbaum/neodim',
"wintermute-cell/gitignore.nvim",
cmd = { "Gitignore" },
opts = {},
},
-- git signs
{
"lewis6991/gitsigns.nvim",
events = { "BufReadPost", "BufNewFile" },
opts = {
signcolumn = true,
current_line_blame = true,
attach_to_untracked = false,
watch_gitdir = {
follow_files = true,
},
signs = {
add = { text = "" },
change = { text = "󱗜 " },
delete = { text = "󰍵 " },
topdelete = { text = "󱥨 " },
changedelete = { text = "󰾟 " },
untracked = { text = "󰰧 " },
},
},
},
-- Todo Comments
{
"folke/todo-comments.nvim",
event = "BufRead",
opts = {},
},
-- Working with file permissions
{
"lambdalisue/vim-suda",
cmd = { "SudaRead", "SudaWrite" },
},
-- Undo tree
{
"mbbill/undotree",
cmd = "UndotreeToggle",
keys = { { "<leader>u", "<cmd>UndotreeToggle<cr>", desc = "Undo Tree" } },
},
-- visual multi
{
"mg979/vim-visual-multi",
event = "VeryLazy",
init = function()
vim.g.VM_maps = {
["Find Under"] = "<M-d>",
["Find Subword Under"] = "<M-d>",
["Select All"] = "<C-M-d>",
["Add Cursor Down"] = "<C-M-j>",
["Add Cursor Up"] = "<C-M-k>",
}
end,
},
-- dimming the highlights of unused functions, variables, parameters, and more
{
"zbirenbaum/neodim",
enabled = false,
event = 'LspAttach',
event = "LspAttach",
config = function()
require('neodim').setup({
require("neodim").setup({
alpha = 0.5,
blend_color = nil,
hide = {
@@ -14,9 +78,9 @@ return {
signs = true,
},
regex = {
'[uU]nused',
'[nN]ever [rR]ead',
'[nN]ot [rR]ead',
"[uU]nused",
"[nN]ever [rR]ead",
"[nN]ot [rR]ead",
},
priority = 128,
disable = {},
@@ -24,50 +88,110 @@ return {
end,
},
-- comment
-- file operations
{
'numToStr/Comment.nvim',
dependencies = {
'JoosepAlviste/nvim-ts-context-commentstring',
"chrisgrieser/nvim-genghis",
keys = {
{
"<leader>fn",
function()
require("genghis").createNewFile()
end,
desc = "New File",
},
{
"<leader>fd",
function()
require("genghis").duplicateFile()
end,
desc = "Duplicate File",
},
{
"<leader>fr",
function()
require("genghis").renameFile()
end,
desc = "Rename File",
},
{
"<leader>fx",
function()
require("genghis").chmodx()
end,
desc = "Make Executable",
},
},
},
-- Better folding
{
"kevinhwang91/nvim-ufo",
dependencies = "kevinhwang91/promise-async",
event = "BufReadPost",
keys = {
{
"zR",
function()
require("ufo").openAllFolds()
end,
},
{
"zM",
function()
require("ufo").closeAllFolds()
end,
},
{
"zr",
function()
require("ufo").openFoldsExceptKinds()
end,
},
{
"zm",
function()
require("ufo").closeFoldsWith()
end,
},
},
config = function()
require('Comment').setup({
pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
mappings = {
basic = true,
extra = true,
},
vim.o.foldcolumn = "1"
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
require("ufo").setup({
provider_selector = function()
return { "treesitter", "indent" }
end,
})
end,
},
-- rendering for html and markdown
{
"OXY2DEV/markview.nvim",
lazy = false,
-- to load before treesitter
priority = 45,
opts = {
preview = {
enable = false,
},
},
keys = {
{ 'gcc', mode = 'n', desc = 'Toggle comment line' },
{ 'gc', mode = { 'n', 'o' }, desc = 'Toggle comment linewise' },
{ 'gc', mode = 'x', desc = 'Toggle comment linewise (visual)' },
{ 'gbc', mode = 'n', desc = 'Toggle comment block' },
{ 'gb', mode = { 'n', 'o' }, desc = 'Toggle comment blockwise' },
{ 'gb', mode = 'x', desc = 'Toggle comment blockwise (visual)' },
{ "<leader>cv", "<Cmd>Markview toggle<CR>", desc = "Toggle markdown preview", mode = "n" },
},
},
-- Todo Comments
-- markdown preview
{
'folke/todo-comments.nvim',
event = 'BufRead',
opts = {},
},
-- visual multi
{
'mg979/vim-visual-multi',
event = 'VeryLazy',
"iamcco/markdown-preview.nvim",
build = "cd app && yarn install",
init = function()
vim.g.VM_maps = {
['Find Under'] = '<M-d>',
['Find Subword Under'] = '<M-d>',
['Select All'] = '<C-M-d>',
['Add Cursor Down'] = '<C-M-j>',
['Add Cursor Up'] = '<C-M-k>',
}
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = "markdown",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview" },
},
}
-72
View File
@@ -1,72 +0,0 @@
return {
'stevearc/conform.nvim',
dependencies = { 'zapling/mason-conform.nvim' },
event = 'BufWritePre',
cmd = 'ConformInfo',
keys = { '<leader>tf' },
config = function()
require('conform').setup({
formatters = {
['markdown-toc'] = {
condition = function(_, ctx)
for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do
if line:find('<!%-%-% toc %-%->') then
return true
end
end
end,
},
['markdownlint-cli2'] = {
condition = function(_, ctx)
local diag = vim.tbl_filter(function(d)
return d.source == 'markdownlint'
end, vim.diagnostic.get(ctx.buf))
return #diag > 0
end,
},
},
formatters_by_ft = {
['lua'] = { 'stylua' },
['c'] = { 'clang_format' },
['cpp'] = { 'clang_format' },
['h'] = { 'clang_format' },
['python'] = { 'ruff_fix', 'ruff_format', 'ruff_organize_imports' },
['javascript'] = { 'biome' },
['typescript'] = { 'biome' },
['typescriptreact'] = { 'biome' },
['markdown'] = { 'prettier', 'markdownlint-cli2', 'markdown-toc' },
['markdown.mdx'] = { 'prettier', 'markdownlint-cli2', 'markdown-toc' },
['mdx'] = { 'prettier' },
['_'] = { 'trim_whitespace' },
},
options = {
stop_after_first = true,
},
format_after_save = function(bufnr)
if not vim.b[bufnr].conform_disable then
return {
lsp_format = 'fallback',
}
end
end,
})
vim.keymap.set('n', '<leader>tf', function()
vim.b.conform_disable = not vim.b.conform_disable
local status = vim.b.conform_disable and 'disabled' or 'enabled'
vim.notify('Autoformat ' .. status, vim.log.levels.INFO)
end, { desc = 'Toggle autoformat' })
require('mason-conform').setup({
ensure_installed = {
'clang_format',
'ruff',
'stylua',
'prettier',
'markdown-toc',
'markdownlint-cli2',
'biome',
},
automatic_installation = true,
})
end,
}
+64
View File
@@ -0,0 +1,64 @@
return {
"stevearc/conform.nvim",
dependencies = { "zapling/mason-conform.nvim" },
event = "BufWritePre",
cmd = "ConformInfo",
keys = { "<leader>tf" },
config = function()
require("conform").setup({
formatters = {
["markdown-toc"] = {
condition = function(_, ctx)
for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do
if line:find("<!%-%-% toc %-%->") then
return true
end
end
end,
},
["markdownlint-cli2"] = {
condition = function(_, ctx)
local diag = vim.tbl_filter(function(d)
return d.source == "markdownlint"
end, vim.diagnostic.get(ctx.buf))
return #diag > 0
end,
},
},
formatters_by_ft = {
["lua"] = { "stylua" },
["c"] = { "clang_format" },
["cpp"] = { "clang_format" },
["h"] = { "clang_format" },
["python"] = { "ruff_fix", "ruff_format", "ruff_organize_imports" },
["javascript"] = { "biome" },
["typescript"] = { "biome" },
["typescriptreact"] = { "biome" },
["markdown"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
["markdown.mdx"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
["mdx"] = { "prettier" },
["_"] = { "trim_whitespace" },
},
options = {
stop_after_first = true,
},
format_after_save = function(bufnr)
if not vim.b[bufnr].conform_disable then
return {
lsp_format = "fallback",
}
end
end,
})
vim.keymap.set("n", "<leader>tf", function()
vim.b.conform_disable = not vim.b.conform_disable
local status = vim.b.conform_disable and "disabled" or "enabled"
vim.notify("Autoformat " .. status, vim.log.levels.INFO)
end, { desc = "Toggle autoformat" })
require("mason-conform").setup({
ensure_installed = require("config.extensions").formatter,
automatic_installation = true,
})
end,
}
-102
View File
@@ -1,102 +0,0 @@
return {
{
'wintermute-cell/gitignore.nvim',
opts = {},
},
-- FLOATING COMMIT WINDOW
{
'lsig/messenger.nvim',
enabled = false,
opts = {
border = 'rounded',
},
keys = {
{
'<leader>gc',
'<Cmd>MessengerShow<CR>',
desc = 'show commit in floating window',
mode = 'n',
noremap = true,
silent = true,
},
},
},
-- git signs
{
'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup({
signs = {
add = { text = '' },
change = { text = '󱗜 ' },
delete = { text = '󰍵 ' },
topdelete = { text = '󱥨 ' },
changedelete = { text = '󰾟 ' },
untracked = { text = '󰰧 ' },
},
signs_staged = {
add = { text = '' },
change = { text = '󱗜 ' },
delete = { text = '󰍵 ' },
topdelete = { text = '󱥨 ' },
changedelete = { text = '󰾟 ' },
untracked = { text = '󰰧 ' },
},
signs_staged_enable = true,
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true,
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
use_focus = true,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1,
},
})
end,
},
-- lazygit integration
{
'kdheepak/lazygit.nvim',
lazy = true,
enabled = true,
cmd = {
'LazyGit',
'LazyGitConfig',
'LazyGitCurrentFile',
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
keys = {
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
},
config = function()
vim.g.lazygit_floating_window_winblend = 0
vim.g.lazygit_floating_window_scaling_factor = 0.9
vim.g.lazygit_floating_window_border_chars = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }
end,
},
}
-45
View File
@@ -1,45 +0,0 @@
return {
'mfussenegger/nvim-lint',
dependencies = { 'rshkarin/mason-nvim-lint' },
event = { 'BufReadPost', 'BufNewFile' },
keys = {
{
'<leader>cL',
mode = { 'n' },
function()
require('lint').try_lint()
end,
desc = 'Trigger linting for current file',
},
},
config = function()
require('lint').linters_by_ft = {
['*'] = { 'codespell' },
['javascript'] = { 'eslint_d', 'cspell' },
['typescript'] = { 'eslint_d', 'cspell' },
['javascriptreact'] = { 'eslint_d', 'cspell' },
['typescriptreact'] = { 'eslint_d', 'cspell' },
['dockerfile'] = { 'hadolint' },
['markdown'] = { 'write_good', 'markdownlint' },
['text'] = { 'write_good' },
['sh'] = { 'shellcheck' },
['yaml'] = { 'actionlint' },
['python'] = { 'ruff' },
}
require('mason-nvim-lint').setup({
ensure_installed = {
'eslint_d',
'hadolint',
'write_good',
'markdownlint',
'shellcheck',
'actionlint',
'djlint',
'ruff',
'codespell',
'cspell',
},
automatic_installation = false,
})
end,
}
+34
View File
@@ -0,0 +1,34 @@
return {
"mfussenegger/nvim-lint",
dependencies = { "rshkarin/mason-nvim-lint" },
event = { "BufReadPost", "BufNewFile" },
keys = {
{
"<leader>cL",
mode = { "n" },
function()
require("lint").try_lint()
end,
desc = "Trigger linting for current file",
},
},
config = function()
require("lint").linters_by_ft = {
["*"] = { "codespell" },
["javascript"] = { "eslint_d", "cspell" },
["typescript"] = { "eslint_d", "cspell" },
["javascriptreact"] = { "eslint_d", "cspell" },
["typescriptreact"] = { "eslint_d", "cspell" },
["dockerfile"] = { "hadolint" },
["markdown"] = { "write_good", "markdownlint" },
["text"] = { "write_good" },
["sh"] = { "shellcheck" },
["yaml"] = { "actionlint" },
["python"] = { "ruff" },
}
require("mason-nvim-lint").setup({
ensure_installed = require("config.extensions").linter,
automatic_installation = false,
})
end,
}
+36 -46
View File
@@ -1,67 +1,57 @@
return {
-- default lsp configs
{
'neovim/nvim-lspconfig',
"neovim/nvim-lspconfig",
config = function() end,
},
-- lsp installer
{
'williamboman/mason.nvim',
"williamboman/mason.nvim",
dependencies = {
'williamboman/mason-lspconfig.nvim',
"williamboman/mason-lspconfig.nvim",
},
cmd = 'Mason',
cmd = "Mason",
config = function()
-- mason
require('mason').setup({
require("mason").setup({
ui = {
icons = {
package_installed = '✓',
package_pending = '➜',
package_uninstalled = '✗',
package_installed = "✓",
package_pending = "➜",
package_uninstalled = "✗",
},
border = 'rounded',
border = "rounded",
backdrop = 100,
},
})
require('mason-lspconfig').setup({
-- list of servers for mason to install
ensure_installed = {
'ts_ls',
'html',
'cssls',
'tailwindcss',
'lua_ls',
'basedpyright',
'bashls',
'clangd',
-- "pylsp",
'rust_analyzer',
},
require("mason-lspconfig").setup({
ensure_installed = require("config.extensions").lsp_server,
automatic_installation = false, -- Don't auto-install or auto-configure
})
end,
},
-- improve neovim lsp experience
{
'nvimdev/lspsaga.nvim',
event = 'LspAttach',
"nvimdev/lspsaga.nvim",
event = "LspAttach",
config = function()
require('lspsaga').setup({
require("lspsaga").setup({
ui = {
theme = 'round',
border = 'rounded',
theme = "round",
border = "rounded",
devicon = true,
title = true,
winblend = 1,
expand = '',
collapse = '',
preview = '',
code_action = '󰠠 ',
diagnostic = '',
incoming = '',
outgoing = '',
hover = '',
expand = "",
collapse = "",
preview = "",
code_action = "󰠠 ",
diagnostic = "",
incoming = "",
outgoing = "",
hover = "",
},
})
end,
@@ -69,42 +59,42 @@ return {
-- inline diagnostic
{
'rachartier/tiny-inline-diagnostic.nvim',
event = 'VeryLazy',
"rachartier/tiny-inline-diagnostic.nvim",
event = "VeryLazy",
priority = 1000,
config = function()
require('tiny-inline-diagnostic').setup()
require("tiny-inline-diagnostic").setup()
vim.diagnostic.config({ virtual_text = false }) -- Disable default virtual text
end,
},
-- code action
{
'rachartier/tiny-code-action.nvim',
"rachartier/tiny-code-action.nvim",
dependencies = {
{
'folke/snacks.nvim',
"folke/snacks.nvim",
opts = {
terminal = {},
},
},
},
event = 'LspAttach',
event = "LspAttach",
config = function()
local codeaction = require('tiny-code-action')
local codeaction = require("tiny-code-action")
codeaction.setup({
picker = {
'buffer',
"buffer",
opts = {
auto_preview = true,
hotkeys = true,
hotkeys_mode = 'sequential',
hotkeys_mode = "sequential",
},
},
})
vim.keymap.set('n', '<leader>.', codeaction.code_action)
vim.keymap.set("n", "<leader>.", codeaction.code_action)
end,
},
}
+72 -54
View File
@@ -1,62 +1,80 @@
return {
'echasnovski/mini.nvim',
"echasnovski/mini.nvim",
config = function()
require('mini.ai').setup() -- Extend and create a/i textobjects
require('mini.pairs').setup() -- Autopairs
require('mini.icons').setup() -- Icons
require('mini.bracketed').setup() -- Go forward/backward with square brackets
require('mini.tabline').setup() -- Tabline
require('mini.files').setup() -- Files
require("mini.ai").setup() -- Extend and create a/i textobjects
require("mini.pairs").setup() -- Autopairs
require("mini.icons").setup() -- Icons
require("mini.bracketed").setup() -- Go forward/backward with square brackets
require("mini.tabline").setup() -- Tabline
require('mini.misc').setup({
-- File explorer
require("mini.files").setup({
mappings = {
close = "q",
go_in = "L",
go_in_plus = "l",
go_out = "h",
go_out_plus = "H",
mark_goto = "'",
mark_set = "m",
reset = "<BS>",
reveal_cwd = "@",
show_help = "g?",
synchronize = "<CR>",
trim_left = "<",
trim_right = ">",
},
})
require("mini.misc").setup({
-- restore cursor position on file reopen
require('mini.misc').setup_restore_cursor(),
require("mini.misc").setup_restore_cursor(),
-- automated change of current directory
require('mini.misc').setup_auto_root(),
require("mini.misc").setup_auto_root(),
})
-- splitjoin
require('mini.splitjoin').setup({
require("mini.splitjoin").setup({
mappings = {
toggle = '<leader>tj',
split = '',
join = '',
toggle = "<leader>tj",
split = "",
join = "",
},
})
-- surround action
require('mini.surround').setup({
require("mini.surround").setup({
mappings = {
add = 'msa',
delete = 'msd',
find = 'msf',
find_left = 'msF',
highlight = 'msh',
replace = 'msr',
update_n_lines = 'msn',
add = "msa",
delete = "msd",
find = "msf",
find_left = "msF",
highlight = "msh",
replace = "msr",
update_n_lines = "msn",
suffix_last = 'l',
suffix_next = 'n',
suffix_last = "l",
suffix_next = "n",
},
})
-- indents
require('mini.indentscope').setup({
draw = { animation = require('mini.indentscope').gen_animation.linear({ ease = 'out', duration = 15 }) },
options = { border = 'top', try_as_border = true, indent_at_cursor = false },
require("mini.indentscope").setup({
draw = { animation = require("mini.indentscope").gen_animation.linear({ ease = "out", duration = 15 }) },
options = { border = "top", try_as_border = true, indent_at_cursor = false },
})
vim.api.nvim_create_autocmd('BufEnter', {
pattern = '*',
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*",
callback = function(args)
if vim.bo[args.buf].buftype ~= '' then
if vim.bo[args.buf].buftype ~= "" then
vim.b[args.buf].miniindentscope_disable = true
end
end,
})
-- statusline
require('mini.statusline').setup({
require("mini.statusline").setup({
use_icons = true,
content = {
active = function()
@@ -70,51 +88,51 @@ return {
local function section_filetype(args)
if
MiniStatusline.is_truncated(args.trunc_width)
or vim.bo.filetype == ''
or vim.bo.buftype ~= ''
or vim.bo.filetype == ""
or vim.bo.buftype ~= ""
then
return ''
return ""
end
local ok, icons = pcall(require, 'mini.icons')
local icon = ok and select(1, icons.get('filetype', vim.bo.filetype)) or ''
return string.format('%s %s│', icon, vim.bo.filetype)
local ok, icons = pcall(require, "mini.icons")
local icon = ok and select(1, icons.get("filetype", vim.bo.filetype)) or ""
return string.format("%s %s│", icon, vim.bo.filetype)
end
local function section_lsp_clients(args)
if MiniStatusline.is_truncated(args.trunc_width) then
return ''
return ""
end
local clients = vim.lsp.get_clients({ bufnr = 0 })
if not clients or #clients == 0 then
return ''
return ""
end
local names = vim.tbl_map(function(c)
return c.name
end, clients)
return string.format(' %s', table.concat(names, ', '))
return string.format(" %s", table.concat(names, ", "))
end
local function section_searchcount(args)
if vim.v.hlsearch == 0 then
return ''
return ""
end
local ok, s = pcall(vim.fn.searchcount, { recompute = true })
if not ok or s.current == nil or s.total == 0 then
return ''
return ""
end
local icon = MiniStatusline.is_truncated(args.trunc_width) and '' or ' '
local icon = MiniStatusline.is_truncated(args.trunc_width) and "" or " "
if s.incomplete == 1 then
return icon .. '?/?│'
return icon .. "?/?│"
end
local fmt = '>%d'
local fmt = ">%d"
local cur = s.current > s.maxcount and fmt:format(s.maxcount) or s.current
local tot = s.total > s.maxcount and fmt:format(s.maxcount) or s.total
return ('%s%s/%s│'):format(icon, cur, tot)
return ("%s%s/%s│"):format(icon, cur, tot)
end
local function section_location(args)
return MiniStatusline.is_truncated(args.trunc_width) and '%-2l│%-2v'
or '󰉸 %-2l│󱥖 %-2v'
return MiniStatusline.is_truncated(args.trunc_width) and "%-2l│%-2v"
or "󰉸 %-2l│󱥖 %-2v"
end
local filetype = section_filetype({ trunc_width = 70 })
@@ -124,18 +142,18 @@ return {
return MiniStatusline.combine_groups({
{ hl = mode_hl, strings = { mode:upper() } },
{ hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } },
'%<',
{ hl = 'MiniStatuslineFilename', strings = { filename } },
'%=',
{ hl = 'MiniStatuslineDevinfo', strings = { lsp_clients } },
{ hl = "MiniStatuslineDevinfo", strings = { git, diff, diagnostics, lsp } },
"%<",
{ hl = "MiniStatuslineFilename", strings = { filename } },
"%=",
{ hl = "MiniStatuslineDevinfo", strings = { lsp_clients } },
{ hl = mode_hl, strings = { filetype, searchcount, loc } },
})
end,
inactive = function()
return MiniStatusline.combine_groups({
{ hl = 'MiniStatuslineInactive', strings = { vim.fn.expand('%:t') } },
{ hl = "MiniStatuslineInactive", strings = { vim.fn.expand("%:t") } },
})
end,
},
-362
View File
@@ -1,362 +0,0 @@
return {
'folke/snacks.nvim',
priority = 1000,
lazy = false,
-- opts = {
-- bigfile = { enabled = true },
-- dashboard = { enabled = true },
-- explorer = { enabled = true },
-- indent = { enabled = true },
-- input = { enabled = true },
-- notifier = {
-- enabled = true,
-- timeout = 3000,
-- },
-- picker = { enabled = true },
-- quickfile = { enabled = true },
-- scope = { enabled = true },
-- scroll = { enabled = true },
-- statuscolumn = { enabled = true },
-- words = { enabled = true },
-- styles = {
-- notification = {
-- -- wo = { wrap = true } -- Wrap notifications
-- },
-- },
-- },
config = function()
local function files_layout(preview_width, height, width)
preview_width = preview_width or 0.6
height = height or 0.8
width = width or 0.9
return {
layout = {
box = 'horizontal',
width = width,
min_width = 120,
height = height,
{
box = 'vertical',
border = 'rounded',
title = '{title} {live} {flags}',
{ win = 'input', height = 1, border = 'bottom' },
{ win = 'list', border = 'none' },
},
{ win = 'preview', title = '{preview}', border = 'rounded', width = preview_width },
},
}
end
local function palette_layout(height, width)
height = height or 0.4
width = width or 0.6
return {
preview = false,
layout = {
backdrop = false,
row = 1,
width = width,
min_width = 80,
height = height,
border = 'rounded',
box = 'vertical',
{
win = 'input',
height = 1,
border = 'rounded',
title = '{title} {live} {flags}',
title_pos = 'center',
},
{ win = 'list', border = 'hpad' },
{ win = 'preview', title = '{preview}', border = 'rounded' },
},
}
end
local Snacks = require('snacks')
Snacks.setup({
animate = {
enabled = true,
duration = 20, -- ms per step
easing = 'linear',
fps = 60,
},
bigfile = {
enabled = true,
notify = true,
size = 1000 * 1024, -- 1 MB instead of 100 KB
},
bufdelete = { enabled = true },
dashboard = {
enabled = true,
sections = {
{ section = 'header' },
{
icon = '',
title = 'Keymaps',
section = 'keys',
indent = 2,
padding = 1,
},
{
icon = '',
title = 'Recent Files',
section = 'recent_files',
indent = 2,
padding = 1,
},
{
icon = '',
title = 'Projects',
section = 'projects',
indent = 2,
padding = 1,
},
{ section = 'startup' },
},
},
debug = { enabled = true },
dim = {
enabled = true,
scope = {
min_size = 5,
max_size = 20,
siblings = true,
},
},
explorer = { enabled = false },
git = { enabled = true },
gitbrowse = { enabled = true },
image = { enabled = true },
indent = {
enabled = true,
priority = 1,
char = '▍',
only_scope = false,
only_current = false,
hl = {
'SnacksIndent1',
'SnacksIndent2',
'SnacksIndent3',
'SnacksIndent4',
'SnacksIndent5',
'SnacksIndent6',
'SnacksIndent7',
'SnacksIndent8',
},
},
input = {
enabled = true,
icon = '',
icon_hl = 'SnacksInputIcon',
icon_pos = 'left',
prompt_pos = 'title',
win = { style = 'input' },
expand = true,
},
layout = { enabled = true },
lazygit = { enabled = true },
notifier = {
enabled = true,
timeout = 2000,
width = { min = 40, max = 0.4 },
height = { min = 1, max = 0.6 },
margin = { top = 0, right = 1, bottom = 0 },
padding = true,
sort = { 'level', 'added' },
level = vim.log.levels.TRACE,
icons = {
debug = '',
error = '',
info = '',
trace = '',
warn = '',
},
style = 'compact',
top_down = true,
date_format = '%R',
more_format = ' ↓ %d lines ',
refresh = 50,
},
notify = { enabled = true },
picker = {
enabled = true,
icon = '',
icon_hl = 'SnacksPickerIcon',
icon_pos = 'left',
prompt_pos = 'title',
win = { style = 'picker' },
expand = true,
matchers = {
frecency = true,
cwd_bonus = false,
},
sources = {
-- layout options: dropdown, horizontal, vertical, vscode, ivy, ivy_split, telescope, top, left, right, bottom, sidebar
buffers = { layout = files_layout() },
commands = { layout = palette_layout() },
command_history = { layout = palette_layout() },
files = {
hidden = true,
layout = files_layout(),
},
icons = {
icon_sources = { 'nerd_fonts', 'emoji' },
layout = palette_layout(),
},
git_files = { layout = files_layout() },
git_branches = { layout = { preset = 'vertical' } },
git_status = { layout = files_layout() },
help = { layout = { preset = 'ivy_split' } },
man = { layout = { preset = 'ivy_split' } },
notifications = { layout = palette_layout() },
projects = { layout = files_layout(0.8) },
recent = { layout = files_layout() },
search_history = { layout = palette_layout() },
smart = { layout = files_layout() },
undo = { layout = { preset = 'ivy' } },
zoxide = { layout = files_layout(0.7) },
},
},
profiler = { enabled = true },
quickfile = { enabled = true },
rename = { enabled = true },
scope = {
enabled = true,
keys = {
textobject = {
ii = {
min_size = 2, -- minimum size of the scope
edge = false, -- inner scope
cursor = false,
treesitter = { blocks = { enabled = false } },
desc = 'inner scope',
},
ai = {
cursor = false,
min_size = 2, -- minimum size of the scope
treesitter = { blocks = { enabled = false } },
desc = 'full scope',
},
},
jump = {
['[a'] = {
min_size = 1, -- allow single line scopes
bottom = false,
cursor = false,
edge = true,
treesitter = { blocks = { enabled = false } },
desc = 'jump to top edge of scope',
},
[']a'] = {
min_size = 1, -- allow single line scopes
bottom = true,
cursor = false,
edge = true,
treesitter = { blocks = { enabled = false } },
desc = 'jump to bottom edge of scope',
},
},
},
},
scratch = {
enabled = true,
name = 'SCRATCH',
ft = function()
if vim.bo.buftype == '' and vim.bo.filetype ~= '' then
return vim.bo.filetype
end
return 'markdown'
end,
icon = nil,
root = vim.fn.stdpath('data') .. '/scratch',
autowrite = true,
filekey = {
cwd = true,
branch = true,
count = true,
},
win = {
width = 120,
height = 40,
bo = { buftype = '', buflisted = false, bufhidden = 'hide', swapfile = false },
minimal = false,
noautocmd = false,
zindex = 20,
wo = { winhighlight = 'NormalFloat:Normal' },
border = 'rounded',
title_pos = 'center',
footer_pos = 'center',
keys = {
['execute'] = {
'<cr>',
function(_)
vim.cmd('%SnipRun')
end,
desc = 'Execute buffer',
mode = { 'n', 'x' },
},
},
},
win_by_ft = {
lua = {
keys = {
['source'] = {
'<leader>cr',
function(self)
local name = 'scratch.'
.. vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self.buf), ':e')
Snacks.debug.run({ buf = self.buf, name = name })
end,
desc = 'Source buffer',
mode = { 'n', 'x' },
},
},
},
},
},
scroll = { enabled = false },
statuscolumn = {
enabled = false, -- Change this to false
left = { 'mark', 'sign' },
right = { 'fold', 'git' },
folds = {
open = false,
git_hl = false,
},
git = {
patterns = { 'GitSign', 'MiniDiffSign' },
},
refresh = 50,
},
terminal = { enabled = false },
toggle = { enabled = false },
win = { enabled = true },
words = { enabled = false },
zen = {
enabled = true,
toggles = {
dim = true,
git_signs = false,
mini_diff_signs = false,
-- diagnostics = false,
-- inlay_hints = false,
},
show = {
statusline = false,
tabline = false,
},
win = { style = 'zen' },
zoom = {
toggles = {},
show = { statusline = true, tabline = true },
win = {
backdrop = false,
width = 0,
},
},
},
})
end,
}
+340
View File
@@ -0,0 +1,340 @@
return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
config = function()
local function files_layout(preview_width, height, width)
preview_width = preview_width or 0.6
height = height or 0.8
width = width or 0.9
return {
layout = {
box = "horizontal",
width = width,
min_width = 120,
height = height,
{
box = "vertical",
border = "rounded",
title = "{title} {live} {flags}",
{ win = "input", height = 1, border = "bottom" },
{ win = "list", border = "none" },
},
{ win = "preview", title = "{preview}", border = "rounded", width = preview_width },
},
}
end
local function palette_layout(height, width)
height = height or 0.4
width = width or 0.6
return {
preview = false,
layout = {
backdrop = false,
row = 1,
width = width,
min_width = 80,
height = height,
border = "rounded",
box = "vertical",
{
win = "input",
height = 1,
border = "rounded",
title = "{title} {live} {flags}",
title_pos = "center",
},
{ win = "list", border = "hpad" },
{ win = "preview", title = "{preview}", border = "rounded" },
},
}
end
local Snacks = require("snacks")
Snacks.setup({
animate = {
enabled = true,
duration = 20, -- ms per step
easing = "linear",
fps = 60,
},
bigfile = {
enabled = true,
notify = true,
size = 1000 * 1024, -- 1 MB instead of 100 KB
},
bufdelete = { enabled = true },
dashboard = {
enabled = true,
sections = {
{ section = "header" },
{
icon = "",
title = "Keymaps",
section = "keys",
indent = 2,
padding = 1,
},
{
icon = "",
title = "Recent Files",
section = "recent_files",
indent = 2,
padding = 1,
},
{
icon = "",
title = "Projects",
section = "projects",
indent = 2,
padding = 1,
},
{ section = "startup" },
},
},
debug = { enabled = true },
dim = {
enabled = true,
scope = {
min_size = 5,
max_size = 20,
siblings = true,
},
},
explorer = { enabled = false },
git = { enabled = true },
gitbrowse = { enabled = true },
image = { enabled = true },
indent = {
enabled = true,
priority = 1,
char = "▍",
only_scope = false,
only_current = false,
hl = {
"SnacksIndent1",
"SnacksIndent2",
"SnacksIndent3",
"SnacksIndent4",
"SnacksIndent5",
"SnacksIndent6",
"SnacksIndent7",
"SnacksIndent8",
},
},
input = {
enabled = true,
icon = "",
icon_hl = "SnacksInputIcon",
icon_pos = "left",
prompt_pos = "title",
win = { style = "input" },
expand = true,
},
layout = { enabled = true },
lazygit = { enabled = true },
notifier = {
enabled = true,
timeout = 2000,
width = { min = 40, max = 0.4 },
height = { min = 1, max = 0.6 },
margin = { top = 0, right = 1, bottom = 0 },
padding = true,
sort = { "level", "added" },
level = vim.log.levels.TRACE,
icons = {
debug = "",
error = "",
info = "",
trace = "",
warn = "",
},
style = "compact",
top_down = true,
date_format = "%R",
more_format = " ↓ %d lines ",
refresh = 50,
},
notify = { enabled = true },
picker = {
enabled = true,
icon = "",
icon_hl = "SnacksPickerIcon",
icon_pos = "left",
prompt_pos = "title",
win = { style = "picker" },
expand = true,
matchers = {
frecency = true,
cwd_bonus = false,
},
sources = {
-- layout options: dropdown, horizontal, vertical, vscode, ivy, ivy_split, telescope, top, left, right, bottom, sidebar
buffers = { layout = files_layout() },
commands = { layout = palette_layout() },
command_history = { layout = palette_layout() },
files = {
hidden = true,
layout = files_layout(),
},
icons = {
icon_sources = { "nerd_fonts", "emoji" },
layout = palette_layout(),
},
git_files = { layout = files_layout() },
git_branches = { layout = { preset = "vertical" } },
git_status = { layout = files_layout() },
help = { layout = { preset = "ivy_split" } },
man = { layout = { preset = "ivy_split" } },
notifications = { layout = palette_layout() },
projects = { layout = files_layout(0.8) },
recent = { layout = files_layout() },
search_history = { layout = palette_layout() },
smart = { layout = files_layout() },
undo = { layout = { preset = "ivy" } },
zoxide = { layout = files_layout(0.7) },
},
},
profiler = { enabled = true },
quickfile = { enabled = true },
rename = { enabled = true },
scope = {
enabled = true,
keys = {
textobject = {
ii = {
min_size = 2, -- minimum size of the scope
edge = false, -- inner scope
cursor = false,
treesitter = { blocks = { enabled = false } },
desc = "inner scope",
},
ai = {
cursor = false,
min_size = 2, -- minimum size of the scope
treesitter = { blocks = { enabled = false } },
desc = "full scope",
},
},
jump = {
["[a"] = {
min_size = 1, -- allow single line scopes
bottom = false,
cursor = false,
edge = true,
treesitter = { blocks = { enabled = false } },
desc = "jump to top edge of scope",
},
["]a"] = {
min_size = 1, -- allow single line scopes
bottom = true,
cursor = false,
edge = true,
treesitter = { blocks = { enabled = false } },
desc = "jump to bottom edge of scope",
},
},
},
},
scratch = {
enabled = true,
name = "SCRATCH",
ft = function()
if vim.bo.buftype == "" and vim.bo.filetype ~= "" then
return vim.bo.filetype
end
return "markdown"
end,
icon = nil,
root = vim.fn.stdpath("data") .. "/scratch",
autowrite = true,
filekey = {
cwd = true,
branch = true,
count = true,
},
win = {
width = 120,
height = 40,
bo = { buftype = "", buflisted = false, bufhidden = "hide", swapfile = false },
minimal = false,
noautocmd = false,
zindex = 20,
wo = { winhighlight = "NormalFloat:Normal" },
border = "rounded",
title_pos = "center",
footer_pos = "center",
keys = {
["execute"] = {
"<cr>",
function(_)
vim.cmd("%SnipRun")
end,
desc = "Execute buffer",
mode = { "n", "x" },
},
},
},
win_by_ft = {
lua = {
keys = {
["source"] = {
"<leader>cr",
function(self)
local name = "scratch."
.. vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self.buf), ":e")
Snacks.debug.run({ buf = self.buf, name = name })
end,
desc = "Source buffer",
mode = { "n", "x" },
},
},
},
},
},
scroll = { enabled = false },
statuscolumn = {
enabled = false, -- Change this to false
left = { "mark", "sign" },
right = { "fold", "git" },
folds = {
open = false,
git_hl = false,
},
git = {
patterns = { "GitSign", "MiniDiffSign" },
},
refresh = 50,
},
terminal = { enabled = false },
toggle = { enabled = false },
win = { enabled = true },
words = { enabled = false },
zen = {
enabled = true,
toggles = {
dim = true,
git_signs = false,
mini_diff_signs = false,
-- diagnostics = false,
-- inlay_hints = false,
},
show = {
statusline = false,
tabline = false,
},
win = { style = "zen" },
zoom = {
toggles = {},
show = { statusline = true, tabline = true },
win = {
backdrop = false,
width = 0,
},
},
},
})
end,
}
-45
View File
@@ -1,45 +0,0 @@
return {
-- treesitter
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
event = { 'BufReadPost', 'BufNewFile' },
config = function()
require('nvim-treesitter').setup({
ensure_installed = {
'c',
'markdown',
'python',
'java',
'cpp',
'bash',
'lua',
'make',
'latex',
'json',
'jsonc',
'sql',
'yaml',
'toml',
'javascript',
'typescript',
'gitignore',
'go',
'rust',
'html',
'css',
'scss',
'markdown_inline',
},
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
},
indent = {
enable = true,
},
})
end,
},
}
-81
View File
@@ -1,81 +0,0 @@
return {
-- rendering for html, latex, md
{
'OXY2DEV/markview.nvim',
lazy = false,
-- to load before treesitter
priority = 45,
opts = {
preview = {
enable = false,
},
},
keys = {
{ '<leader>cv', '<Cmd>Markview toggle<CR>', desc = 'Toggle markdown preview', mode = 'n' },
},
},
-- markdown preview
{
'iamcco/markdown-preview.nvim',
build = 'cd app && yarn install',
init = function()
vim.g.mkdp_filetypes = { 'markdown' }
end,
ft = 'markdown',
cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview' },
},
-- Better folding
{
'kevinhwang91/nvim-ufo',
dependencies = 'kevinhwang91/promise-async',
event = 'BufReadPost',
keys = {
{
'zR',
function()
require('ufo').openAllFolds()
end,
},
{
'zM',
function()
require('ufo').closeAllFolds()
end,
},
{
'zr',
function()
require('ufo').openFoldsExceptKinds()
end,
},
{
'zm',
function()
require('ufo').closeFoldsWith()
end,
},
},
config = function()
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
require('ufo').setup({
provider_selector = function()
return { 'treesitter', 'indent' }
end,
})
end,
},
-- Undo tree
{
'mbbill/undotree',
cmd = 'UndotreeToggle',
keys = { { '<leader>u', '<cmd>UndotreeToggle<cr>', desc = 'Undo Tree' } },
},
}
Executable → Regular
+42 -83
View File
@@ -1,14 +1,14 @@
return {
{
'danymat/neogen',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
"danymat/neogen",
dependencies = { "nvim-treesitter/nvim-treesitter" },
opts = {
snippet_engine = 'luasnip',
snippet_engine = "luasnip",
languages = {
python = {
template = {
annotation_convention = 'google_docstrings',
annotation_convention = "google_docstrings",
},
},
},
@@ -16,27 +16,27 @@ return {
},
{
'davidmh/mdx.nvim',
"davidmh/mdx.nvim",
config = true,
dependencies = { 'nvim-treesitter/nvim-treesitter' },
dependencies = { "nvim-treesitter/nvim-treesitter" },
},
-- better escape
{
'max397574/better-escape.nvim',
"max397574/better-escape.nvim",
config = function()
require('better_escape').setup({
require("better_escape").setup({
mappings = {
-- i for insert, other modes are the first letter too
i = {
-- map kj to exit insert mode
k = {
j = '<Esc>',
j = "<Esc>",
},
-- map jk and jj to exit insert mode
j = {
k = '<Esc>',
j = '<Esc>',
k = "<Esc>",
j = "<Esc>",
},
-- disable jj
j = {
@@ -50,43 +50,43 @@ return {
-- Navigator
{
'numToStr/Navigator.nvim',
event = 'VeryLazy',
"numToStr/Navigator.nvim",
event = "VeryLazy",
config = function()
require('Navigator').setup({
auto_save = 'current',
require("Navigator").setup({
auto_save = "current",
disable_on_zoom = false,
mux = 'auto',
mux = "auto",
})
end,
},
-- float terminal
{
'akinsho/toggleterm.nvim',
cmd = { 'ToggleTerm' },
version = '*',
"akinsho/toggleterm.nvim",
cmd = { "ToggleTerm" },
version = "*",
config = function()
require('toggleterm').setup({
require("toggleterm").setup({
size = 10,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = '2',
shading_factor = "2",
start_in_insert = true,
insert_mappings = true,
terminal_mappings = true,
persist_size = true,
direction = 'float', -- 'vertical' | 'horizontal' | 'tab' | 'float'
direction = "float", -- 'vertical' | 'horizontal' | 'tab' | 'float'
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = 'curved', -- 'single', 'double', 'shadow', etc.
winblend = 0, -- Set to 0 for full transparency
border = "curved", -- 'single', 'double', 'shadow', etc.
winblend = 0, -- Set to 0 for full transparency
highlights = {
border = 'Normal',
background = 'Normal',
border = "Normal",
background = "Normal",
},
},
})
@@ -95,7 +95,7 @@ return {
-- smooth scrolling
{
'karb94/neoscroll.nvim',
"karb94/neoscroll.nvim",
opts = {},
},
@@ -107,75 +107,34 @@ return {
-- uv
{
'benomahony/uv.nvim',
ft = 'python',
event = 'BufReadPre',
"benomahony/uv.nvim",
ft = "python",
event = "BufReadPre",
opts = {
picker_integration = true,
keymaps = {
prefix = '<leader>u', -- Main prefix for uv commands
commands = true, -- Show uv commands menu (<leader>x)
run_file = true, -- Run current file (<leader>xr)
prefix = "<leader>u", -- Main prefix for uv commands
commands = true, -- Show uv commands menu (<leader>x)
run_file = true, -- Run current file (<leader>xr)
run_selection = true, -- Run selected code (<leader>xs)
run_function = true, -- Run function (<leader>xf)
venv = true, -- Environment management (<leader>xe)
init = true, -- Initialize uv project (<leader>xi)
add = true, -- Add a package (<leader>xa)
remove = true, -- Remove a package (<leader>xd)
sync = true, -- Sync packages (<leader>xc)
sync_all = true, -- Sync all packages, extras and groups (<leader>xC)
run_function = true, -- Run function (<leader>xf)
venv = true, -- Environment management (<leader>xe)
init = true, -- Initialize uv project (<leader>xi)
add = true, -- Add a package (<leader>xa)
remove = true, -- Remove a package (<leader>xd)
sync = true, -- Sync packages (<leader>xc)
sync_all = true, -- Sync all packages, extras and groups (<leader>xC)
},
},
},
-- wakatime
{ 'wakatime/vim-wakatime', event = 'VimEnter', lazy = false },
{ "wakatime/vim-wakatime", event = "VimEnter", lazy = false },
-- workflow
{
'm4xshen/hardtime.nvim',
"m4xshen/hardtime.nvim",
lazy = false,
opts = {},
},
-- file operations
{
'chrisgrieser/nvim-genghis',
keys = {
{
'<leader>fn',
function()
require('genghis').createNewFile()
end,
desc = 'New File',
},
{
'<leader>fd',
function()
require('genghis').duplicateFile()
end,
desc = 'Duplicate File',
},
{
'<leader>fr',
function()
require('genghis').renameFile()
end,
desc = 'Rename File',
},
{
'<leader>fx',
function()
require('genghis').chmodx()
end,
desc = 'Make Executable',
},
},
},
-- Working with file permissions
{
'lambdalisue/vim-suda',
cmd = { 'SudaRead', 'SudaWrite' },
},
}
+271 -271
View File
@@ -1,305 +1,305 @@
return {
'folke/which-key.nvim',
event = 'VeryLazy',
config = function()
local wk = require('which-key')
wk.setup({
preset = 'helix',
plugins = {
marks = true,
registers = true,
spelling = {
enabled = true,
suggestions = 30,
},
},
presets = {
operators = true,
motions = true,
text_objects = true,
windows = true,
nav = true,
z = true,
g = true,
},
icons = {
breadcrumb = '',
separator = '',
group = '',
keys = {
Space = '',
},
rules = false, -- enable auto icon rules
},
show_help = false,
show_keys = true,
triggers = {
{ '<auto>', mode = 'nvisoct' },
{ '<leader>', mode = { 'n', 'v' } },
},
})
"folke/which-key.nvim",
event = "VeryLazy",
config = function()
local wk = require("which-key")
wk.setup({
preset = "helix",
plugins = {
marks = true,
registers = true,
spelling = {
enabled = true,
suggestions = 30,
},
},
presets = {
operators = true,
motions = true,
text_objects = true,
windows = true,
nav = true,
z = true,
g = true,
},
icons = {
breadcrumb = "",
separator = "",
group = "",
keys = {
Space = "",
},
rules = false, -- enable auto icon rules
},
show_help = false,
show_keys = true,
triggers = {
{ "<auto>", mode = "nvisoct" },
{ "<leader>", mode = { "n", "v" } },
},
})
local normal_mappings = {
mode = 'n',
{ '<leader>x', ':x<cr>', desc = ' Save and Quit' },
local normal_mappings = {
mode = "n",
{ "<leader>x", ":x<cr>", desc = " Save and Quit" },
-- { "<leader>a", group = " AI" },
-- { "<leader>a", group = " AI" },
{ '<leader>b', group = ' Buffer' },
{ "<leader>b", group = " Buffer" },
{ '<leader>c', group = ' Code' },
{ '<leader>cF', ':retab<cr>', desc = 'Fix Tabs' },
{ '<leader>cd', ':RootDir<cr>', desc = 'Root Directory' },
{ '<leader>cf', ':lua vim.lsp.buf.format({async = true})<cr>', desc = 'Format File' },
{ '<leader>cg', ':Neogen<cr>', desc = 'Generate Docstring' },
{ '<leader>cl', '::g/^\\s*$/d<cr>', desc = 'Clean Empty Lines' },
{ '<leader>cm', ':MarkdownPreviewToggle<cr>', desc = 'Markdown Preview' },
{ '<leader>cq', ':lua Snacks.picker.qflist()<cr>', desc = 'Quickfix List' },
{ "<leader>c", group = " Code" },
{ "<leader>cF", ":retab<cr>", desc = "Fix Tabs" },
{ "<leader>cd", ":RootDir<cr>", desc = "Root Directory" },
{ "<leader>cf", ":lua vim.lsp.buf.format({async = true})<cr>", desc = "Format File" },
{ "<leader>cg", ":Neogen<cr>", desc = "Generate Docstring" },
{ "<leader>cl", "::g/^\\s*$/d<cr>", desc = "Clean Empty Lines" },
{ "<leader>cm", ":MarkdownPreviewToggle<cr>", desc = "Markdown Preview" },
{ "<leader>cq", ":lua Snacks.picker.qflist()<cr>", desc = "Quickfix List" },
{ '<leader>e', group = ' Edit' },
{ '<leader>ea', ':b#<cr>', desc = 'Alternate File' },
{ '<leader>eC', group = 'Edit Configs' },
{
'<leader>ee',
function()
local minifiles = require('mini.files')
minifiles.open(vim.api.nvim_buf_get_name(0), true)
minifiles.reveal_cwd()
end,
desc = 'Explore Tree',
},
{ '<leader>eE', ':lua Snacks.explorer()<cr>', desc = 'File Explorer' },
{ '<leader>ef', 'gf', desc = 'File Under Cursor' },
{ '<leader>em', ':e README.md<cr>', desc = 'Readme' },
{ '<leader>en', ':enew<cr>', desc = 'New File' },
{ '<leader>er', ":lua require('snacks').rename.rename_file()<cr>", desc = 'Rename Current File' },
{ "<leader>e", group = " Edit" },
{ "<leader>ea", ":b#<cr>", desc = "Alternate File" },
{ "<leader>eC", group = "Edit Configs" },
{
"<leader>ee",
function()
local minifiles = require("mini.files")
minifiles.open(vim.api.nvim_buf_get_name(0), true)
minifiles.reveal_cwd()
end,
desc = "Explore Tree",
},
{ "<leader>eE", ":lua Snacks.explorer()<cr>", desc = "File Explorer" },
{ "<leader>ef", "gf", desc = "File Under Cursor" },
{ "<leader>em", ":e README.md<cr>", desc = "Readme" },
{ "<leader>en", ":enew<cr>", desc = "New File" },
{ "<leader>er", ":lua require('snacks').rename.rename_file()<cr>", desc = "Rename Current File" },
{ '<leader>f', group = ' Find' },
{ '<leader>fx', ':%bd|e#|bd#<cr>', desc = 'Close except current' },
{ '<leader>ff', ':lua Snacks.picker.files()<cr>', desc = 'Find Files' },
{ '<leader>fg', ':lua Snacks.picker.grep()<cr>', desc = 'Live Grep' },
{ '<leader>fp', ':lua Snacks.picker.projects()<cr>', desc = 'Projects' },
{
'<leader>ct',
function()
local curr_path = vim.fn.expand('%:p')
Snacks.picker.todo_comments({
transform = function(item)
local item_path = vim.fn.fnamemodify(item.cwd .. '/' .. item.file, ':p')
return item_path == curr_path
end,
})
end,
desc = 'Search Todos in Current File',
},
{ '<leader>fT', ':lua Snacks.picker.todo_comments()<cr>', desc = 'Search Todos' },
{ '<leader>fu', ':lua Snacks.picker.undo()<cr>', desc = 'Undotree' },
{ "<leader>f", group = " Find" },
{ "<leader>fx", ":%bd|e#|bd#<cr>", desc = "Close except current" },
{ "<leader>ff", ":lua Snacks.picker.files()<cr>", desc = "Find Files" },
{ "<leader>fg", ":lua Snacks.picker.grep()<cr>", desc = "Live Grep" },
{ "<leader>fp", ":lua Snacks.picker.projects()<cr>", desc = "Projects" },
{
"<leader>ct",
function()
local curr_path = vim.fn.expand("%:p")
Snacks.picker.todo_comments({
transform = function(item)
local item_path = vim.fn.fnamemodify(item.cwd .. "/" .. item.file, ":p")
return item_path == curr_path
end,
})
end,
desc = "Search Todos in Current File",
},
{ "<leader>fT", ":lua Snacks.picker.todo_comments()<cr>", desc = "Search Todos" },
{ "<leader>fu", ":lua Snacks.picker.undo()<cr>", desc = "Undotree" },
{ '<leader>g', group = ' Git' },
{ '<leader>gA', ':Gitsigns stage_buffer<cr>', desc = 'Stage Buffer' },
{ '<leader>gR', ':Gitsigns reset_buffer<cr>', desc = 'Reset Buffer' },
{ '<leader>ga', ':Gitsigns stage_hunk<cr>', desc = 'Stage Hunk' },
{ '<leader>gb', ":lua require('gitsigns').blame_line({full = true})<cr>", desc = 'Blame' },
{ '<leader>gB', ":lua require('snacks').git.blame_line()<cr>", desc = 'Detailed Blame' },
{ '<leader>gc', ':Gitignore<cr>', desc = 'Generate .gitignore' },
{ '<leader>gd', ':Gitsigns diffthis HEAD<cr>', desc = 'Git Diff' },
{ '<leader>gF', ':Git<cr>', desc = 'Fugitive Panel' },
{ '<leader>gi', ':Gitsigns preview_hunk<cr>', desc = 'Hunk Info' },
{ '<leader>gj', ':Gitsigns next_hunk<cr>', desc = 'Next Hunk' },
{ '<leader>gk', ':Gitsigns prev_hunk<cr>', desc = 'Prev Hunk' },
{ '<leader>gl', ':lua Snacks.picker.git_log()<cr>', desc = 'Checkout commit' },
{ '<leader>gr', ':Gitsigns reset_hunk<cr>', desc = 'Reset Hunk' },
{ '<leader>gs', ':lua Snacks.picker.git_status()<cr>', desc = 'Open changed file' },
{ '<leader>gu', ':Gitsigns undo_stage_hunk<cr>', desc = 'Undo Stage Hunk' },
{ '<leader>gv', ':Gitsigns select_hunk<cr>', desc = 'Select Hunk' },
{ '<leader>gw', ':lua require("snacks").gitbrowse()<cr>', desc = 'Git Browse' },
{ '<leader>gp', ':lua Snacks.picker.git_branches()<cr>', desc = 'Pick and Switch Git Branches' },
{ "<leader>g", group = " Git" },
{ "<leader>gA", ":Gitsigns stage_buffer<cr>", desc = "Stage Buffer" },
{ "<leader>gR", ":Gitsigns reset_buffer<cr>", desc = "Reset Buffer" },
{ "<leader>ga", ":Gitsigns stage_hunk<cr>", desc = "Stage Hunk" },
{ "<leader>gb", ":lua require('gitsigns').blame_line({full = true})<cr>", desc = "Blame" },
{ "<leader>gB", ":lua require('snacks').git.blame_line()<cr>", desc = "Detailed Blame" },
{ "<leader>gc", ":Gitignore<cr>", desc = "Generate .gitignore" },
{ "<leader>gd", ":Gitsigns diffthis HEAD<cr>", desc = "Git Diff" },
{ "<leader>gF", ":Git<cr>", desc = "Fugitive Panel" },
{ "<leader>gi", ":Gitsigns preview_hunk<cr>", desc = "Hunk Info" },
{ "<leader>gj", ":Gitsigns next_hunk<cr>", desc = "Next Hunk" },
{ "<leader>gk", ":Gitsigns prev_hunk<cr>", desc = "Prev Hunk" },
{ "<leader>gl", ":lua Snacks.picker.git_log()<cr>", desc = "Checkout commit" },
{ "<leader>gr", ":Gitsigns reset_hunk<cr>", desc = "Reset Hunk" },
{ "<leader>gs", ":lua Snacks.picker.git_status()<cr>", desc = "Open changed file" },
{ "<leader>gu", ":Gitsigns undo_stage_hunk<cr>", desc = "Undo Stage Hunk" },
{ "<leader>gv", ":Gitsigns select_hunk<cr>", desc = "Select Hunk" },
{ "<leader>gw", ':lua require("snacks").gitbrowse()<cr>', desc = "Git Browse" },
{ "<leader>gp", ":lua Snacks.picker.git_branches()<cr>", desc = "Pick and Switch Git Branches" },
{ '<leader>gt', group = 'Toggle' },
{ '<leader>gtb', ':Gitsigns toggle_current_line_blame<cr>', desc = 'Blame' },
{ '<leader>gtd', ':Gitsigns toggle_deleted<cr>', desc = 'Deleted' },
{ '<leader>gtl', ':Gitsigns toggle_linehl<cr>', desc = 'Line HL' },
{ '<leader>gtn', ':Gitsigns toggle_numhl<cr>', desc = 'Number HL' },
{ '<leader>gts', ':Gitsigns toggle_signs<cr>', desc = 'Signs' },
{ '<leader>gtw', ':Gitsigns toggle_word_diff<cr>', desc = 'Word Diff' },
{ "<leader>gt", group = "Toggle" },
{ "<leader>gtb", ":Gitsigns toggle_current_line_blame<cr>", desc = "Blame" },
{ "<leader>gtd", ":Gitsigns toggle_deleted<cr>", desc = "Deleted" },
{ "<leader>gtl", ":Gitsigns toggle_linehl<cr>", desc = "Line HL" },
{ "<leader>gtn", ":Gitsigns toggle_numhl<cr>", desc = "Number HL" },
{ "<leader>gts", ":Gitsigns toggle_signs<cr>", desc = "Signs" },
{ "<leader>gtw", ":Gitsigns toggle_word_diff<cr>", desc = "Word Diff" },
{ '<leader>i', group = ' Insert' },
{ '<leader>id', ":put =strftime('## %a, %d %b, %Y, %r')<cr>", desc = 'Date' },
{ '<leader>if', ":put =expand('%:t')<cr>", desc = 'File Name' },
{ '<leader>ip', ':put %<cr>', desc = 'Relative Path' },
{ '<leader>iP', ':put %:p<cr>', desc = 'Absolute Path' },
{ '<leader>it', ":put =strftime('## %r')<cr>", desc = 'Time' },
{ "<leader>i", group = " Insert" },
{ "<leader>id", ":put =strftime('## %a, %d %b, %Y, %r')<cr>", desc = "Date" },
{ "<leader>if", ":put =expand('%:t')<cr>", desc = "File Name" },
{ "<leader>ip", ":put %<cr>", desc = "Relative Path" },
{ "<leader>iP", ":put %:p<cr>", desc = "Absolute Path" },
{ "<leader>it", ":put =strftime('## %r')<cr>", desc = "Time" },
{ '<leader>l', group = ' LSP' },
{ '<leader>la', ':Lspsaga code_action<cr>', desc = 'Code Action' },
{ '<leader>ld', ':Lspsaga goto_definition<cr>', desc = 'Goto Definition' },
{ '<leader>lf', ':Lspsaga finder<cr>', desc = 'Finder' },
{ '<leader>lh', ':Lspsaga hover_doc<cr>', desc = 'Hover' },
{ '<leader>lI', ':LspInfo<cr>', desc = 'LSP Info' },
{ '<leader>lj', ':Lspsaga diagnostic_jump_next<cr>', desc = 'Next Diagnostic' },
{ '<leader>lk', ':Lspsaga diagnostic_jump_prev<cr>', desc = 'Prev Diagnostic' },
{ '<leader>lo', ':Lspsaga outline<cr>', desc = 'Outline' },
{ '<leader>lp', ':Lspsaga peek_definition<cr>', desc = 'Peek Definition' },
{ '<leader>lq', ':LspStop<cr>', desc = 'Stop LSP' },
{ '<leader>lQ', ':LspRestart<cr>', desc = 'Restart LSP' },
{ '<leader>lr', ':Lspsaga rename<cr>', desc = 'Rename' },
{ '<leader>lR', ':Lspsaga project_replace<cr>', desc = 'Replace' },
{ '<leader>lt', ':Lspsaga goto_type_definition<cr>', desc = 'Goto Type Definition' },
{ '<leader>lT', ':Lspsaga peek_type_definition<cr>', desc = 'Peek Type Definition' },
{ "<leader>l", group = " LSP" },
{ "<leader>la", ":Lspsaga code_action<cr>", desc = "Code Action" },
{ "<leader>ld", ":Lspsaga goto_definition<cr>", desc = "Goto Definition" },
{ "<leader>lf", ":Lspsaga finder<cr>", desc = "Finder" },
{ "<leader>lh", ":Lspsaga hover_doc<cr>", desc = "Hover" },
{ "<leader>lI", ":LspInfo<cr>", desc = "LSP Info" },
{ "<leader>lj", ":Lspsaga diagnostic_jump_next<cr>", desc = "Next Diagnostic" },
{ "<leader>lk", ":Lspsaga diagnostic_jump_prev<cr>", desc = "Prev Diagnostic" },
{ "<leader>lo", ":Lspsaga outline<cr>", desc = "Outline" },
{ "<leader>lp", ":Lspsaga peek_definition<cr>", desc = "Peek Definition" },
{ "<leader>lq", ":LspStop<cr>", desc = "Stop LSP" },
{ "<leader>lQ", ":LspRestart<cr>", desc = "Restart LSP" },
{ "<leader>lr", ":Lspsaga rename<cr>", desc = "Rename" },
{ "<leader>lR", ":Lspsaga project_replace<cr>", desc = "Replace" },
{ "<leader>lt", ":Lspsaga goto_type_definition<cr>", desc = "Goto Type Definition" },
{ "<leader>lT", ":Lspsaga peek_type_definition<cr>", desc = "Peek Type Definition" },
{ '<leader>o', group = ' Options' },
{ '<leader>oi', 'vim.show_pos', desc = 'Inspect Position' },
{ '<leader>oN', ':lua Snacks.notifier.show_history()<cr>', desc = 'Notification History' },
{ '<leader>or', ':set relativenumber!<cr>', desc = 'Relative Numbers' },
{ "<leader>o", group = " Options" },
{ "<leader>oi", "vim.show_pos", desc = "Inspect Position" },
{ "<leader>oN", ":lua Snacks.notifier.show_history()<cr>", desc = "Notification History" },
{ "<leader>or", ":set relativenumber!<cr>", desc = "Relative Numbers" },
{ '<leader>p', group = ' Packages' },
{ '<leader>pc', ':Lazy check<cr>', desc = 'Check' },
{ '<leader>pd', ':Lazy debug<cr>', desc = 'Debug' },
{ '<leader>pe', ':lua require("snacks").profiler.scratch()<cr>', desc = 'Profiler Scratch' },
{ '<leader>pf', ':lua require("snacks").profiler.pick()<cr>', desc = 'Profiler Pick' },
{ '<leader>pi', ':Lazy install<cr>', desc = 'Install' },
{ '<leader>pl', ':Lazy log<cr>', desc = 'Log' },
{ '<leader>pm', ':Mason<cr>', desc = 'Mason' },
{ '<leader>pp', ':Lazy<cr>', desc = 'Plugins' },
{ '<leader>pP', ':Lazy profile<cr>', desc = 'Profile' },
{ '<leader>pr', ':Lazy restore<cr>', desc = 'Restore' },
{ '<leader>ps', ':Lazy sync<cr>', desc = 'Sync' },
{ '<leader>pt', ':lua require("snacks").profiler.toggle()<cr>', desc = 'Profiler Toggle' },
{ '<leader>pu', ':Lazy update<cr>', desc = 'Update' },
{ '<leader>px', ':Lazy clean<cr>', desc = 'Clean' },
{ "<leader>p", group = " Packages" },
{ "<leader>pc", ":Lazy check<cr>", desc = "Check" },
{ "<leader>pd", ":Lazy debug<cr>", desc = "Debug" },
{ "<leader>pe", ':lua require("snacks").profiler.scratch()<cr>', desc = "Profiler Scratch" },
{ "<leader>pf", ':lua require("snacks").profiler.pick()<cr>', desc = "Profiler Pick" },
{ "<leader>pi", ":Lazy install<cr>", desc = "Install" },
{ "<leader>pl", ":Lazy log<cr>", desc = "Log" },
{ "<leader>pm", ":Mason<cr>", desc = "Mason" },
{ "<leader>pp", ":Lazy<cr>", desc = "Plugins" },
{ "<leader>pP", ":Lazy profile<cr>", desc = "Profile" },
{ "<leader>pr", ":Lazy restore<cr>", desc = "Restore" },
{ "<leader>ps", ":Lazy sync<cr>", desc = "Sync" },
{ "<leader>pt", ':lua require("snacks").profiler.toggle()<cr>', desc = "Profiler Toggle" },
{ "<leader>pu", ":Lazy update<cr>", desc = "Update" },
{ "<leader>px", ":Lazy clean<cr>", desc = "Clean" },
{ '<leader>q', group = ' Quit' },
{ '<leader>qa', ':qall<cr>', desc = 'Quit All' },
{ '<leader>qb', ':bw<cr>', desc = 'Close Buffer' },
{ '<leader>qd', ':lua require("snacks").bufdelete()<cr>', desc = 'Delete Buffer' },
{ '<leader>qf', ':qall!<cr>', desc = 'Force Quit' },
{ '<leader>qo', ':%bdelete|b#|bdelete#<cr>', desc = 'Close Others' },
{ '<leader>qq', ':q<cr>', desc = 'Quit' },
{ '<leader>qs', '<C-w>c', desc = 'Close Split' },
{ '<leader>qw', ':wq<cr>', desc = 'Write and Quit' },
{ "<leader>q", group = " Quit" },
{ "<leader>qa", ":qall<cr>", desc = "Quit All" },
{ "<leader>qb", ":bw<cr>", desc = "Close Buffer" },
{ "<leader>qd", ':lua require("snacks").bufdelete()<cr>', desc = "Delete Buffer" },
{ "<leader>qf", ":qall!<cr>", desc = "Force Quit" },
{ "<leader>qo", ":%bdelete|b#|bdelete#<cr>", desc = "Close Others" },
{ "<leader>qq", ":q<cr>", desc = "Quit" },
{ "<leader>qs", "<C-w>c", desc = "Close Split" },
{ "<leader>qw", ":wq<cr>", desc = "Write and Quit" },
{ '<leader>r', group = ' Refactor' },
{ '<leader>rd', '', desc = 'Go To Definition' }, -- treesitter navigation
{ '<leader>rD', '', desc = 'List Definition' },
{ '<leader>rh', '', desc = 'List Definition Head' },
{ '<leader>rj', '', desc = 'Next Usage' },
{ '<leader>rk', '', desc = 'Previous Usage' },
{ '<leader>rn', '', desc = 'Swap Next' },
{ '<leader>rp', '', desc = 'Swap Previous' },
{ '<leader>rr', '', desc = 'Smart Rename' },
{ '<leader>rs', ':%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>', desc = 'Replace Word Buffer' },
{ "<leader>r", group = " Refactor" },
{ "<leader>rd", "", desc = "Go To Definition" }, -- treesitter navigation
{ "<leader>rD", "", desc = "List Definition" },
{ "<leader>rh", "", desc = "List Definition Head" },
{ "<leader>rj", "", desc = "Next Usage" },
{ "<leader>rk", "", desc = "Previous Usage" },
{ "<leader>rn", "", desc = "Swap Next" },
{ "<leader>rp", "", desc = "Swap Previous" },
{ "<leader>rr", "", desc = "Smart Rename" },
{ "<leader>rs", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>", desc = "Replace Word Buffer" },
{ '<leader>s', group = ' Split' },
{ '<leader>s+', ':resize +10<cr>', desc = 'Increase window height' },
{ '<leader>s-', ':vertical resize -20<cr>', desc = 'Decrease window width' },
{ '<leader>s/', '<C-w>s', desc = 'Split Below' },
{ '<leader>s=', ':vertical resize +20<cr>', desc = 'Increase window width' },
{ '<leader>sH', ':vertical resize -10<cr>', desc = 'Decrease window width' },
{ '<leader>sJ', ':resize -5<cr>', desc = 'Decrease window height' },
{ '<leader>sK', ':resize +5<cr>', desc = 'Increase window height' },
{ '<leader>sL', ':vertical resize +10<cr>', desc = 'Increase window width' },
{ '<leader>s\\', '<C-w>v', desc = 'Split Right' },
{ '<leader>s_', ':resize -10<cr>', desc = 'Decrease window height' },
{ '<leader>s`', '<C-w>p', desc = 'Previous Window' },
{ '<leader>sa', ':split<cr>', desc = 'Horizontal Split' },
{ '<leader>sc', ':tabclose<cr>', desc = 'Close Tab' },
{ '<leader>sf', ':tabfirst<cr>', desc = 'First Tab' },
{ '<leader>sh', '<C-w>h', desc = 'Move Left' },
{ '<leader>sj', '<C-w>j', desc = 'Move Down' },
{ '<leader>sk', '<C-w>k', desc = 'Move Up' },
{ '<leader>sl', '<C-w>l', desc = 'Move Right' },
{ '<leader>sp', ':NavigatorPrevious<cr>', desc = 'Previous Pane' },
{ '<leader>sq', '<C-w>c', desc = 'Close Split' },
{ '<leader>ss', ':vsplit<cr>', desc = 'Vertical Split' },
{ "<leader>s", group = " Split" },
{ "<leader>s+", ":resize +10<cr>", desc = "Increase window height" },
{ "<leader>s-", ":vertical resize -20<cr>", desc = "Decrease window width" },
{ "<leader>s/", "<C-w>s", desc = "Split Below" },
{ "<leader>s=", ":vertical resize +20<cr>", desc = "Increase window width" },
{ "<leader>sH", ":vertical resize -10<cr>", desc = "Decrease window width" },
{ "<leader>sJ", ":resize -5<cr>", desc = "Decrease window height" },
{ "<leader>sK", ":resize +5<cr>", desc = "Increase window height" },
{ "<leader>sL", ":vertical resize +10<cr>", desc = "Increase window width" },
{ "<leader>s\\", "<C-w>v", desc = "Split Right" },
{ "<leader>s_", ":resize -10<cr>", desc = "Decrease window height" },
{ "<leader>s`", "<C-w>p", desc = "Previous Window" },
{ "<leader>sa", ":split<cr>", desc = "Horizontal Split" },
{ "<leader>sc", ":tabclose<cr>", desc = "Close Tab" },
{ "<leader>sf", ":tabfirst<cr>", desc = "First Tab" },
{ "<leader>sh", "<C-w>h", desc = "Move Left" },
{ "<leader>sj", "<C-w>j", desc = "Move Down" },
{ "<leader>sk", "<C-w>k", desc = "Move Up" },
{ "<leader>sl", "<C-w>l", desc = "Move Right" },
{ "<leader>sp", ":NavigatorPrevious<cr>", desc = "Previous Pane" },
{ "<leader>sq", "<C-w>c", desc = "Close Split" },
{ "<leader>ss", ":vsplit<cr>", desc = "Vertical Split" },
{ '<leader>t', group = ' Terminal' },
{ '<leader>t1', '<cmd>1ToggleTerm<cr>', desc = 'Toggle Terminal' },
{ '<leader>t2', '<cmd>2ToggleTerm<cr>', desc = 'Toggle Terminal' },
{ '<leader>tc', '<Cmd>close<CR>', desc = 'Hide Terminal' },
{ "<leader>t", group = " Terminal" },
{ "<leader>t1", "<cmd>1ToggleTerm<cr>", desc = "Toggle Terminal" },
{ "<leader>t2", "<cmd>2ToggleTerm<cr>", desc = "Toggle Terminal" },
{ "<leader>tc", "<Cmd>close<CR>", desc = "Hide Terminal" },
{ '<leader>th', group = 'Inlay Hints' },
{ "<leader>th", group = "Inlay Hints" },
{ '<leader>w', group = ' Writing' },
{ '<leader>wc', ':set spell!<cr>', desc = 'Spellcheck' },
{ '<leader>wd', ':lua require("snacks").dim.enable()<cr>', desc = 'Dim On' },
{ '<leader>wD', ':lua require("snacks").dim.disable()<cr>', desc = 'Dim Off' },
{ '<leader>wf', ":lua require'utils'.sudo_write()<cr>", desc = 'Force Write' },
{ '<leader>wj', ']s', desc = 'Next Misspell' },
{ '<leader>wk', '[s', desc = 'Prev Misspell' },
{ '<leader>wn', ':WriteNoFormat<cr>', desc = 'Write Without Formatting' },
{ '<leader>wq', ':wq<cr>', desc = 'Write and Quit' },
{ '<leader>ww', ':w<cr>', desc = 'Write' },
{ '<leader>wz', ':lua require("snacks").zen.zen()<cr>', desc = 'Zen' },
{ '<leader>wZ', ':lua require("snacks").zen.zoom()<cr>', desc = 'Zoom' },
{ "<leader>w", group = " Writing" },
{ "<leader>wc", ":set spell!<cr>", desc = "Spellcheck" },
{ "<leader>wd", ':lua require("snacks").dim.enable()<cr>', desc = "Dim On" },
{ "<leader>wD", ':lua require("snacks").dim.disable()<cr>', desc = "Dim Off" },
{ "<leader>wf", ":lua require'utils'.sudo_write()<cr>", desc = "Force Write" },
{ "<leader>wj", "]s", desc = "Next Misspell" },
{ "<leader>wk", "[s", desc = "Prev Misspell" },
{ "<leader>wn", ":WriteNoFormat<cr>", desc = "Write Without Formatting" },
{ "<leader>wq", ":wq<cr>", desc = "Write and Quit" },
{ "<leader>ww", ":w<cr>", desc = "Write" },
{ "<leader>wz", ':lua require("snacks").zen.zen()<cr>', desc = "Zen" },
{ "<leader>wZ", ':lua require("snacks").zen.zoom()<cr>', desc = "Zoom" },
{ '<leader>y', group = ' Yank' },
{ '<leader>yL', ':CopyAbsolutePathWithLine<cr>', desc = 'Absolute Path with Line' },
{ '<leader>yP', ':CopyAbsolutePath<cr>', desc = 'Absolute Path' },
{ '<leader>ya', ':%y+<cr>', desc = 'Copy Whole File' },
{ '<leader>yf', ':CopyFileName<cr>', desc = 'File Name' },
{ '<leader>yg', ':lua require"gitlinker".get_buf_range_url()<cr>', desc = 'Copy Git URL' },
{ '<leader>yl', ':CopyRelativePathWithLine<cr>', desc = 'Relative Path with Line' },
{ '<leader>yp', ':CopyRelativePath<cr>', desc = 'Relative Path' },
}
{ "<leader>y", group = " Yank" },
{ "<leader>yL", ":CopyAbsolutePathWithLine<cr>", desc = "Absolute Path with Line" },
{ "<leader>yP", ":CopyAbsolutePath<cr>", desc = "Absolute Path" },
{ "<leader>ya", ":%y+<cr>", desc = "Copy Whole File" },
{ "<leader>yf", ":CopyFileName<cr>", desc = "File Name" },
{ "<leader>yg", ':lua require"gitlinker".get_buf_range_url()<cr>', desc = "Copy Git URL" },
{ "<leader>yl", ":CopyRelativePathWithLine<cr>", desc = "Relative Path with Line" },
{ "<leader>yp", ":CopyRelativePath<cr>", desc = "Relative Path" },
}
local visual_mappings = {
mode = 'v',
-- { "<leader>a", group = " AI" },
local visual_mappings = {
mode = "v",
-- { "<leader>a", group = " AI" },
{ '<leader>c', group = ' Code' },
{ '<leader>cS', ':sort!<cr>', desc = 'Sort Desc' },
{ '<leader>ci', ':sort i<cr>', desc = 'Sort Case Insensitive' },
{ '<leader>cs', ':sort<cr>', desc = 'Sort Asc' },
{ '<leader>cu', ':!uniq<cr>', desc = 'Unique' },
{ '<leader>cx', ':lua<cr>', desc = 'Execute Lua' },
{ "<leader>c", group = " Code" },
{ "<leader>cS", ":sort!<cr>", desc = "Sort Desc" },
{ "<leader>ci", ":sort i<cr>", desc = "Sort Case Insensitive" },
{ "<leader>cs", ":sort<cr>", desc = "Sort Asc" },
{ "<leader>cu", ":!uniq<cr>", desc = "Unique" },
{ "<leader>cx", ":lua<cr>", desc = "Execute Lua" },
{ '<leader>g', group = ' Git' },
{ '<leader>ga', ":'<,'>Gitsigns stage_hunk<cr>", desc = 'Stage Hunk' },
{ '<leader>gr', ":'<,'>Gitsigns reset_hunk<cr>", desc = 'Reset Hunk' },
{ '<leader>gu', ":'<,'>Gitsigns undo_stage_hunk<cr>", desc = 'Undo Stage Hunk' },
{ "<leader>g", group = " Git" },
{ "<leader>ga", ":'<,'>Gitsigns stage_hunk<cr>", desc = "Stage Hunk" },
{ "<leader>gr", ":'<,'>Gitsigns reset_hunk<cr>", desc = "Reset Hunk" },
{ "<leader>gu", ":'<,'>Gitsigns undo_stage_hunk<cr>", desc = "Undo Stage Hunk" },
{ '<leader>l', group = ' LSP' },
{ '<leader>la', ':<C-U>Lspsaga range_code_action<cr>', desc = 'Code Action' },
{ "<leader>l", group = " LSP" },
{ "<leader>la", ":<C-U>Lspsaga range_code_action<cr>", desc = "Code Action" },
{ '<leader>y', group = ' Yank' },
{ '<leader>yg', ':lua require"gitlinker".get_buf_range_url("v")<cr>', desc = 'Copy Git URL' },
}
{ "<leader>y", group = " Yank" },
{ "<leader>yg", ':lua require"gitlinker".get_buf_range_url("v")<cr>', desc = "Copy Git URL" },
}
local no_leader_mappings = {
mode = 'n',
{ '<C-Down>', ':resize -10<cr>', desc = 'Decrease window height' },
{ '<C-Left>', ':vertical resize -10<cr>', desc = 'Decrease window width' },
{ '<C-Right>', ':vertical resize +10<cr>', desc = 'Increase window width' },
{ '<C-Up>', ':resize +10<cr>', desc = 'Increase window height' },
local no_leader_mappings = {
mode = "n",
{ "<C-Down>", ":resize -10<cr>", desc = "Decrease window height" },
{ "<C-Left>", ":vertical resize -10<cr>", desc = "Decrease window width" },
{ "<C-Right>", ":vertical resize +10<cr>", desc = "Increase window width" },
{ "<C-Up>", ":resize +10<cr>", desc = "Increase window height" },
{ '<C-h>', ':NavigatorLeft<cr>', desc = 'Move Left' },
{ '<C-j>', ':NavigatorDown<cr>', desc = 'Move Down' },
{ '<C-k>', ':NavigatorUp<cr>', desc = 'Move Up' },
{ '<C-l>', ':NavigatorRight<cr>', desc = 'Move Right' },
{ '<C-\\>', ':NavigatorPrevious<cr>', desc = 'Previous Pane' },
{ "<C-h>", ":NavigatorLeft<cr>", desc = "Move Left" },
{ "<C-j>", ":NavigatorDown<cr>", desc = "Move Down" },
{ "<C-k>", ":NavigatorUp<cr>", desc = "Move Up" },
{ "<C-l>", ":NavigatorRight<cr>", desc = "Move Right" },
{ "<C-\\>", ":NavigatorPrevious<cr>", desc = "Previous Pane" },
-- { '<S-h>', ':bprevious<cr>', desc = 'Previous Buffer' },
-- { '<S-l>', ':bnext<cr>', desc = 'Next Buffer' },
{ '<Tab>', ':bnext<cr>', desc = 'Next Buffer' },
{ '<S-Tab>', ':bprevious<cr>', desc = 'Previous Buffer' },
-- { '<S-h>', ':bprevious<cr>', desc = 'Previous Buffer' },
-- { '<S-l>', ':bnext<cr>', desc = 'Next Buffer' },
{ "<Tab>", ":bnext<cr>", desc = "Next Buffer" },
{ "<S-Tab>", ":bprevious<cr>", desc = "Previous Buffer" },
{ 'K', ':Lspsaga hover_doc<cr>', desc = 'LSP Hover' },
{ 'Q', ':qall!<cr>', desc = 'Force Quit!' },
{ 'U', ':redo<cr>', desc = 'Redo' },
{ "K", ":Lspsaga hover_doc<cr>", desc = "LSP Hover" },
{ "Q", ":qall!<cr>", desc = "Force Quit!" },
{ "U", ":redo<cr>", desc = "Redo" },
{ '[', group = ' Previous' },
{ '[g', ':Gitsigns prev_hunk<cr>', desc = 'Git Hunk' },
{ '[o', group = 'Textobjects' },
{ "[", group = " Previous" },
{ "[g", ":Gitsigns prev_hunk<cr>", desc = "Git Hunk" },
{ "[o", group = "Textobjects" },
{ ']', group = ' Next' },
{ ']g', ':Gitsigns next_hunk<cr>', desc = 'Git Hunk' },
{ ']o', group = 'Textobjects' },
{ "]", group = " Next" },
{ "]g", ":Gitsigns next_hunk<cr>", desc = "Git Hunk" },
{ "]o", group = "Textobjects" },
{ 'gd', ':Lspsaga goto_definition<cr>', desc = 'Goto Definition' },
}
{ "gd", ":Lspsaga goto_definition<cr>", desc = "Goto Definition" },
}
wk.add(normal_mappings)
wk.add(visual_mappings)
wk.add(no_leader_mappings)
end,
wk.add(normal_mappings)
wk.add(visual_mappings)
wk.add(no_leader_mappings)
end,
}