migrate to new builtin plugin manager with new folder structure

This commit is contained in:
sankalp committed 2026-05-07 20:41:03 +05:45
1 parent b532749302
commit 42483b98f5
39 files changed
+2139 -2485

No files matched your search

+5 -6
View File
@@ -1,6 +1,5 @@
-- load config
require('config.options')
require('config.keys')
require('config.autocmd')
require('config.lazy')
require('config.lsp')
require("pack_helper")
require("keys")
require("options")
require("autocmd")
require('lsp')
-48
View File
@@ -1,48 +0,0 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "642b0c595e11608b4c18219e93b88d7637af27bc" },
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
"bento.nvim": { "branch": "main", "commit": "aee8a542bc1839ff1764992ef2aa41c981d0bba4" },
"better-escape.nvim": { "branch": "master", "commit": "3f4bc0b326606264ff75967f59091b5ddada0554" },
"blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" },
"codesnap.nvim": { "branch": "main", "commit": "0a0941340376439a25d6cd8a4d1d2b372edbfdbd" },
"conform.nvim": { "branch": "master", "commit": "dca1a190aa85f9065979ef35802fb77131911106" },
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"gitignore.nvim": { "branch": "master", "commit": "0344f643768c4d64af4add8c1bdddf6f7d4c9010" },
"gitsigns.nvim": { "branch": "main", "commit": "6d808f99bd63303646794406e270bd553ad7792e" },
"gruvbox.nvim": { "branch": "main", "commit": "154eb5ff5b96d0641307113fa385eaf0d36d9796" },
"hardtime.nvim": { "branch": "main", "commit": "b4e431934af1fe224a3a801f632c008278cb7628" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazygit.nvim": { "branch": "main", "commit": "a04ad0dbc725134edbee3a5eea29290976695357" },
"lspsaga.nvim": { "branch": "main", "commit": "c532fb86c3d211c5829ad58d2a0783012739bb65" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"markview.nvim": { "branch": "main", "commit": "86cf4bcede58e88497f7e5214efb281d4a6f633d" },
"mason-conform.nvim": { "branch": "main", "commit": "48da2ebd5efbaf8a99566eadc3ece82d523f03c5" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0c2823e0418f3d9230ff8b201c976e84de1cb401" },
"mason-nvim-lint": { "branch": "main", "commit": "cafbc5d82d8eb4af0daf0057332a325ddf2f436b" },
"mason.nvim": { "branch": "main", "commit": "12ddd182d9efbdc848b540f16484a583d52da0fb" },
"mdx.nvim": { "branch": "main", "commit": "6c3dc7c4a4b58b5d86404c21a9b4655282ca08c5" },
"mini.nvim": { "branch": "main", "commit": "be81509b7160aa02264a59789164a2e1c4a6750a" },
"neogen": { "branch": "main", "commit": "23e7e9f883d01289ebd90e98025acc860ea26366" },
"neoscroll.nvim": { "branch": "master", "commit": "c8d29979cb0cb3a2437a8e0ae683fd82f340d3b8" },
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
"nvim-genghis": { "branch": "main", "commit": "12d62b0aaeb0bf6e52f2335d532813a8b8105baa" },
"nvim-lint": { "branch": "master", "commit": "eab58b48eb11d7745c11c505e0f3057165902461" },
"nvim-lspconfig": { "branch": "master", "commit": "8fde495949782bb61c2605174e231d145a048d8c" },
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
"nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "6141a40173c6efa98242dc951ed4b6f892c97027" },
"nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"smartcolumn.nvim": { "branch": "main", "commit": "b9cdbdf42f7ac5a659204cd5926017c7ff724a19" },
"snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" },
"tiny-code-action.nvim": { "branch": "main", "commit": "0d040ed81f7953118b81cd12681fcdfcac069803" },
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "147af4e49f51dd48f41972de26552872b8ba7b25" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
"vim-suda": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" },
"vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" },
"vim-wakatime": { "branch": "master", "commit": "8217dfb5a5a3ad3a509365d8a39d7daca12b1745" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" },
"windsurf.vim": { "branch": "main", "commit": "3c0a4f8a7be75113a6e19be13b7cc37210d6e26a" }
}
+194
View File
@@ -0,0 +1,194 @@
local function augroup(name)
return vim.api.nvim_create_augroup("nvim_" .. name, { clear = true })
end
-- -----------------------------------------------------------------------------
-- General UI & Behavior
-- -----------------------------------------------------------------------------
-- Secure .env Masking (Conceal method)
local function toggle_env_mask()
local buf = vim.api.nvim_get_current_buf()
if vim.wo.conceallevel > 0 then
vim.wo.conceallevel = 0
vim.notify("Env masking disabled", vim.log.levels.INFO, { title = "Security" })
else
vim.wo.conceallevel = 2
vim.wo.concealcursor = "n" -- Show when editing (insert mode)
vim.notify("Env masking enabled", vim.log.levels.INFO, { title = "Security" })
end
end
-- Auto-mask .env files on load
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
group = augroup("env_masking"),
pattern = { ".env", ".env.*", "*.env" },
callback = function()
vim.opt_local.conceallevel = 2
vim.opt_local.concealcursor = "n"
-- Match everything after '=' (only if not empty) and conceal it with '*'
vim.fn.matchadd("Conceal", [[=\zs.\+]], 10, -1, { conceal = "*" })
end,
})
vim.keymap.set("n", "<leader>ot", toggle_env_mask, { desc = "Toggle .env masking" })
-- Strip trailing spaces before write
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup("strip_space"),
pattern = "*",
callback = function()
local save = vim.fn.winsaveview()
vim.cmd([[keeppatterns %s/\s\+$//e]])
vim.fn.winrestview(save)
end,
})
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = augroup("highlight_yank"),
callback = function()
vim.highlight.on_yank({ timeout = 200 })
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 location 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 specific filetypes with <q>
vim.api.nvim_create_autocmd("FileType", {
group = augroup("close_with_q"),
pattern = {
"help", "lspinfo", "man", "notify", "qf", "query", "spectre_panel",
"startuptime", "tsplayground", "neotest-output", "checkhealth",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})
-- Auto-create directories on save
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup("auto_create_dir"),
callback = function(event)
if event.match:match("^%w%w+://") then
return
end
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})
-- -----------------------------------------------------------------------------
-- LSP Related
-- -----------------------------------------------------------------------------
-- Document Highlight on CursorHold
vim.api.nvim_create_autocmd("LspAttach", {
group = augroup("lsp_attach_autocmds"),
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.supports_method("textDocument/documentHighlight") then
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
buffer = args.buf,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
buffer = args.buf,
callback = vim.lsp.buf.clear_references,
})
end
end,
})
-- -----------------------------------------------------------------------------
-- Filetype Specific
-- -----------------------------------------------------------------------------
-- Wrap and spellcheck in text filetypes
vim.api.nvim_create_autocmd("FileType", {
group = augroup("wrap_spell"),
pattern = { "gitcommit", "markdown", "text" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Disable auto-commenting on new lines
vim.api.nvim_create_autocmd("FileType", {
group = augroup("no_auto_comment"),
callback = function()
vim.opt_local.formatoptions:remove({ "c", "r", "o" })
end,
})
-- Manual Treesitter Installation command
vim.api.nvim_create_user_command("TSInstallAll", function()
local parsers = require("extensions").ts_parsers
vim.notify("Installing all configured Tree-sitter parsers...", vim.log.levels.INFO, { title = "Tree-sitter" })
require("nvim-treesitter.install").install(parsers)
end, { desc = "Install all configured Tree-sitter parsers" })
-- -----------------------------------------------------------------------------
-- Macro Notifications
-- -----------------------------------------------------------------------------
vim.api.nvim_create_autocmd("RecordingEnter", {
callback = function()
vim.notify("Recording macro...", vim.log.levels.INFO, { title = "Macro", timeout = 1000 })
end,
})
vim.api.nvim_create_autocmd("RecordingLeave", {
callback = function()
local reg = vim.v.recording
vim.notify("Stopped recording @" .. reg, vim.log.levels.INFO, { title = "Macro", timeout = 1000 })
end,
})
-- -----------------------------------------------------------------------------
-- Auto-Save (3s Debounce)
-- -----------------------------------------------------------------------------
local save_timer = nil
vim.api.nvim_create_autocmd({ "TextChanged", "InsertLeave", "BufLeave", "FocusLost" }, {
group = augroup("autosave"),
callback = function(args)
if not vim.bo[args.buf].modified or vim.bo[args.buf].buftype ~= "" then
return
end
if save_timer then
save_timer:stop()
end
local delay = (args.event == "BufLeave" or args.event == "FocusLost") and 0 or 3000
save_timer = vim.defer_fn(function()
if vim.api.nvim_buf_is_valid(args.buf) and vim.bo[args.buf].modified then
vim.api.nvim_buf_call(args.buf, function()
vim.cmd("silent! write")
end)
end
end, delay)
end,
})
-325
View File
@@ -1,325 +0,0 @@
local function augroup(name)
return vim.api.nvim_create_augroup('nvim' .. name, { clear = true })
end
-- hide sensetive data in .env
-- local group = vim.api.nvim_create_augroup('EnvMask', { clear = true })
-- local hidden = {}
--
-- local function mask_line(line)
-- if line:match('^%s*#') or line:match('^%s*$') then
-- return line
-- end
--
-- local key, value = line:match('^([%w_]+)%s*=%s*(.*)')
-- if not key or not value then
-- return line
-- end
--
-- return key .. '=' .. string.rep('*', #value)
-- end
--
-- local function hide(buf)
-- if hidden[buf] then
-- return
-- end
--
-- local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false)
-- hidden[buf] = lines
--
-- local masked = {}
-- for i, line in ipairs(lines) do
-- masked[i] = mask_line(line)
-- end
--
-- vim.api.nvim_buf_set_lines(buf, 0, -1, false, masked)
-- end
--
-- local function show(buf)
-- if not hidden[buf] then
-- return
-- end
-- vim.api.nvim_buf_set_lines(buf, 0, -1, false, hidden[buf])
-- hidden[buf] = nil
-- end
--
-- vim.api.nvim_create_autocmd('BufReadPost', {
-- group = group,
-- pattern = { '.env', '.env.*', '*.env' },
-- callback = function(args)
-- vim.cmd('silent! noautocmd redraw')
-- hide(args.buf)
-- end,
-- })
--
-- vim.keymap.set('n', '<leader>ot', function()
-- local buf = vim.api.nvim_get_current_buf()
-- if hidden[buf] then
-- show(buf)
-- else
-- hide(buf)
-- end
-- end, { desc = 'Toggle env masking' })
-- 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({ timeout = 200, visual = true })
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,
-- })
-- restore cursor to file position in previous editing session
-- vim.api.nvim_create_autocmd('BufReadPost', {
-- callback = function(args)
-- local mark = vim.api.nvim_buf_get_mark(args.buf, '"')
-- local line_count = vim.api.nvim_buf_line_count(args.buf)
-- if mark[1] > 0 and mark[1] <= line_count then
-- vim.api.nvim_win_set_cursor(0, mark)
-- -- defer centering slightly so it's applied after render
-- vim.schedule(function()
-- vim.cmd('normal! zz')
-- end)
-- end
-- end,
-- })
-- open help in vertical split
vim.api.nvim_create_autocmd('FileType', {
pattern = 'help',
command = 'wincmd L',
})
-- no auto continue comments on new line
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('no_auto_comment', {}),
callback = function()
vim.opt_local.formatoptions:remove({ 'c', 'r', 'o' })
end,
})
-- show cursorline only in active window enable
vim.api.nvim_create_autocmd({ 'WinEnter', 'BufEnter' }, {
group = vim.api.nvim_create_augroup('active_cursorline', { clear = true }),
callback = function()
vim.opt_local.cursorline = true
end,
})
-- show cursorline only in active window disable
vim.api.nvim_create_autocmd({ 'WinLeave', 'BufLeave' }, {
group = 'active_cursorline',
callback = function()
vim.opt_local.cursorline = false
end,
})
-- ide like highlight when stopping cursor
vim.api.nvim_create_autocmd('CursorMoved', {
group = vim.api.nvim_create_augroup('LspReferenceHighlight', { clear = true }),
desc = 'Highlight references under cursor',
callback = function()
-- Only run if the cursor is not in insert mode
if vim.fn.mode() ~= 'i' then
local clients = vim.lsp.get_clients({ bufnr = 0 })
local supports_highlight = false
for _, client in ipairs(clients) do
if client.server_capabilities.documentHighlightProvider then
supports_highlight = true
break -- Found a supporting client, no need to check others
end
end
-- 3. Proceed only if an LSP is active AND supports the feature
if supports_highlight then
vim.lsp.buf.clear_references()
vim.lsp.buf.document_highlight()
end
end
end,
})
-- ide like highlight when stopping cursor
vim.api.nvim_create_autocmd('CursorMovedI', {
group = 'LspReferenceHighlight',
desc = 'Clear highlights when entering insert mode',
callback = function()
vim.lsp.buf.clear_references()
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>oc', clear_all_macros, { desc = 'Clear all macros' })
-66
View File
@@ -1,66 +0,0 @@
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,
}
-143
View File
@@ -1,143 +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
-- Select all
map('n', '<leader>a', 'ggVG', { desc = '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' })
-48
View File
@@ -1,48 +0,0 @@
--------------------------------------------------------------------------------
-- Bootstrap lazy plugin manager
--------------------------------------------------------------------------------
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 })
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...' },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- lazy config
require('lazy').setup({
spec = {
{ import = 'plugins' },
},
install = {
missing = true,
colorscheme = { 'gruvbox' },
},
change_detection = {
enable = true,
notify = false,
},
ui = {
border = 'rounded',
backdrop = 100,
},
rtp = {
-- disable some rtp plugins
disabled_plugins = {
'gzip',
'tarPlugin',
'tohtml',
'tutor',
'netrwPlugin',
'zipPlugin',
},
},
})
-100
View File
@@ -1,100 +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")
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
@@ -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:\ ]])
+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,
}
+143
View File
@@ -0,0 +1,143 @@
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
-- Select all
map("n", "<leader>a", "ggVG", { desc = "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" })
+113
View File
@@ -0,0 +1,113 @@
--------------------------------------------------------------------------------
-- LSP
--------------------------------------------------------------------------------
vim.api.nvim_create_autocmd("User", {
pattern = "PackerComplete", -- Fallback or custom event if needed, but let's use a more standard one
callback = function()
-- This is where we would put it if we had a specific event.
-- Since we're using VimEnter, let's use that instead.
end,
})
-- Let's use a simple function and schedule it to run after plugins
vim.schedule(function()
vim.lsp.config("*", {
capabilities = require("blink.cmp").get_lsp_capabilities(),
})
-- 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")
end)
+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 = { tab = "» ", trail = "·", nbsp = "␣" },
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:\ ]])
+71
View File
@@ -0,0 +1,71 @@
local M = {}
-- Define sources outside the function to avoid re-allocation
local SOURCES = {
gl = "https://gitlab.com/",
cb = "https://codeberg.org/",
gh = "https://github.com/",
}
--- Resolves a shorthand URL or full URL to its canonical form.
local function resolve_url(url)
if not url or url:match("^https?://") then
return url
end
-- Extract prefix if present (e.g., 'gl:user/repo')
local prefix, rest = url:match("^(%w+):(.+)$")
if prefix and SOURCES[prefix] then
return SOURCES[prefix] .. rest
end
-- Default to GitHub if no prefix or unknown prefix
return SOURCES.gh .. url
end
--- Normalizes a plugin specification.
local function normalize_spec(spec)
if type(spec) == "string" then
return resolve_url(spec)
elseif type(spec) == "table" and spec.src then
spec.src = resolve_url(spec.src)
return spec
end
return spec
end
--- Global helper to add plugins to the package manager.
--- Supports shorthand for GitHub (default), GitLab (gl:), and Codeberg (cb:).
---
--- Examples:
--- add("user/repo") --> https://github.com/user/repo
--- add("gl:user/repo") --> https://gitlab.com/user/repo
--- add("cb:user/repo") --> https://codeberg.org/user/repo
--- add({ "user/repo", version = "main" })
--- add({ "user/repo", "gl:other/repo" })
---
_G.add = function(specs)
-- Normalize input to a table if a single spec is provided
local list = type(specs) == "table" and (specs.src or not specs[1]) and { specs } or specs
if type(list) ~= "table" then
list = { specs }
end
local resolved = {}
for _, spec in ipairs(list) do
local normalized = normalize_spec(spec)
if normalized then
table.insert(resolved, normalized)
end
end
if #resolved > 0 then
-- Wrap in pcall to handle potential vim.pack errors gracefully
local ok, err = pcall(vim.pack.add, resolved)
if not ok then
vim.notify("vim.pack.add failed: " .. tostring(err), vim.log.levels.ERROR, { title = "Pack Helper" })
end
end
end
return M
-14
View File
@@ -1,14 +0,0 @@
return {
{
'Exafunction/windsurf.vim',
event = 'VeryLazy',
config = function()
vim.keymap.set('i', '<A-f>', function()
return vim.fn['codeium#Accept']()
end, { expr = true, silent = true })
vim.keymap.set('i', '<A-x>', function()
return vim.fn['codeium#Clear']()
end, { expr = true, silent = true })
end,
},
}
-126
View File
@@ -1,126 +0,0 @@
return {
-- completion
{
'saghen/blink.cmp',
version = '*',
config = function()
require('blink.cmp').setup({
fuzzy = { implementation = 'prefer_rust' },
snippets = { preset = 'luasnip' },
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
providers = {},
},
completion = {
ghost_text = { enabled = true },
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' },
},
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,
},
-- 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)' },
},
},
-- annotation generator
{
'danymat/neogen',
opts = {
snippet_engine = 'luasnip',
languages = {
python = {
template = {
annotation_convention = 'google_docstrings',
},
},
},
},
},
}
-39
View File
@@ -1,39 +0,0 @@
return {
"ellisonleao/gruvbox.nvim",
priority = 1000,
config = function()
local palette = require("gruvbox").palette
require("gruvbox").setup({
bold = false,
italic = {
strings = false,
emphasis = false,
comments = false,
folds = false,
},
contrast = "hard",
transparent_mode = true,
overrides = {
-- builtin
SignColumn = { bg = "None" },
CursorLineNr = { bg = "None" },
Whitespace = { fg = palette.dark0 },
EndOfBuffer = { fg = palette.dark0_hard },
Visual = { fg = "None", bg = palette.dark1 },
Label = { link = "GruvboxPurple" },
-- blink.cmp
BlinkCmpMenu = { link = "Normal" },
BlinkCmpMenuBorder = { link = "BlinkCmpMenu" },
BlinkCmpMenuSelection = { fg = "None", bg = palette.dark1 },
BlinkCmpLabelMatch = { fg = palette.bright_green },
BlinkCmpScrollBarGutter = { bg = palette.dark2 },
BlinkCmpScrollBarThumb = { bg = palette.light1 },
-- indent guides
MiniIndentscopeSymbol = { fg = palette.dark1 },
},
})
vim.cmd.colorscheme("gruvbox")
end,
}
-100
View File
@@ -1,100 +0,0 @@
return {
-- Todo Comments
{
'folke/todo-comments.nvim',
event = 'BufRead',
opts = {},
},
-- Working with file permissions
{
'lambdalisue/vim-suda',
cmd = { 'SudaRead', 'SudaWrite' },
},
-- 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',
config = function()
require('neodim').setup({
alpha = 0.5,
blend_color = nil,
hide = {
underline = true,
virtual_text = true,
signs = true,
},
regex = {
'[uU]nused',
'[nN]ever [rR]ead',
'[nN]ot [rR]ead',
},
priority = 128,
disable = {},
})
end,
},
-- 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>fz',
function()
require('genghis').chmodx()
end,
desc = 'Make Executable',
},
},
},
-- markdown preview
{
'iamcco/markdown-preview.nvim',
cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' },
ft = { 'markdown' },
build = function()
vim.fn['mkdp#util#install']()
end,
},
}
-64
View File
@@ -1,64 +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 = require("config.extensions").formatter,
automatic_installation = true,
})
end,
}
-61
View File
@@ -1,61 +0,0 @@
return {
-- gitignore generator
{
'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,
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
watch_gitdir = {
follow_files = true,
},
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,
},
signs = {
add = { text = '' },
change = { text = '󱗜 ' },
delete = { text = '󰍵 ' },
topdelete = { text = '󱥨 ' },
changedelete = { text = '󰾟 ' },
untracked = { text = '󰰧 ' },
},
},
},
-- 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,
},
}
-34
View File
@@ -1,34 +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 = require("config.extensions").linter,
automatic_installation = false,
})
end,
}
-109
View File
@@ -1,109 +0,0 @@
return {
-- default lsp configs
{
'neovim/nvim-lspconfig',
config = function() end,
},
-- lsp installer
{
'williamboman/mason.nvim',
dependencies = {
'williamboman/mason-lspconfig.nvim',
},
cmd = 'Mason',
config = function()
-- mason
require('mason').setup({
ui = {
icons = {
package_installed = '✓',
package_pending = '➜',
package_uninstalled = '✗',
},
border = 'rounded',
backdrop = 100,
},
})
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',
config = function()
require('lspsaga').setup({
ui = {
theme = 'round',
border = 'rounded',
devicon = true,
title = true,
winblend = 1,
expand = '',
collapse = '',
preview = '',
code_action = '󰠠 ',
diagnostic = '',
incoming = '',
outgoing = '',
hover = '',
},
})
end,
},
-- inline diagnostic
{
'rachartier/tiny-inline-diagnostic.nvim',
event = 'VeryLazy',
priority = 1000,
config = function()
require('tiny-inline-diagnostic').setup({
options = {
show_source = true,
multiple_diag_under_cursor = true,
-- break_line = {
-- enabled = true,
-- after = 60,
-- }
},
})
vim.diagnostic.config({ virtual_text = false }) -- Disable default virtual text
end,
},
-- code action
{
'rachartier/tiny-code-action.nvim',
dependencies = {
{
'folke/snacks.nvim',
opts = {
terminal = {},
},
},
},
event = 'LspAttach',
config = function()
local codeaction = require('tiny-code-action')
codeaction.setup({
picker = {
'buffer',
opts = {
auto_preview = true,
hotkeys = true,
hotkeys_mode = 'sequential',
},
},
})
vim.keymap.set('n', '<leader>.', codeaction.code_action)
end,
},
}
-161
View File
@@ -1,161 +0,0 @@
return {
'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
-- 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(),
-- automated change of current directory
require('mini.misc').setup_auto_root(),
})
-- splitjoin
require('mini.splitjoin').setup({
mappings = {
toggle = '<leader>tj',
split = '',
join = '',
},
})
-- surround action
require('mini.surround').setup({
mappings = {
add = 'msa',
delete = 'msd',
find = 'msf',
find_left = 'msF',
highlight = 'msh',
replace = 'msr',
update_n_lines = 'msn',
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 },
})
vim.api.nvim_create_autocmd('BufEnter', {
pattern = '*',
callback = function(args)
if vim.bo[args.buf].buftype ~= '' then
vim.b[args.buf].miniindentscope_disable = true
end
end,
})
-- statusline
require('mini.statusline').setup({
use_icons = true,
content = {
active = function()
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
local git = MiniStatusline.section_git({ trunc_width = 40 })
local diff = MiniStatusline.section_diff({ trunc_width = 80 })
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 60 })
local lsp = MiniStatusline.section_lsp({ trunc_width = 40 })
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
local function section_filetype(args)
if
MiniStatusline.is_truncated(args.trunc_width)
or vim.bo.filetype == ''
or vim.bo.buftype ~= ''
then
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)
end
local function section_lsp_clients(args)
if MiniStatusline.is_truncated(args.trunc_width) then
return ''
end
local clients = vim.lsp.get_clients({ bufnr = 0 })
if not clients or #clients == 0 then
return ''
end
local names = vim.tbl_map(function(c)
return c.name
end, clients)
return string.format(' %s', table.concat(names, ', '))
end
local function section_searchcount(args)
if vim.v.hlsearch == 0 then
return ''
end
local ok, s = pcall(vim.fn.searchcount, { recompute = true })
if not ok or s.current == nil or s.total == 0 then
return ''
end
local icon = MiniStatusline.is_truncated(args.trunc_width) and '' or ' '
if s.incomplete == 1 then
return icon .. '?/?│'
end
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)
end
local function section_location(args)
return MiniStatusline.is_truncated(args.trunc_width) and '%-2l│%-2v'
or '󰉸 %-2l│󱥖 %-2v'
end
local filetype = section_filetype({ trunc_width = 70 })
local searchcount = section_searchcount({ trunc_width = 80 })
local loc = section_location({ trunc_width = 120 })
local lsp_clients = section_lsp_clients({ trunc_width = 60 })
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 = mode_hl, strings = { filetype, searchcount, loc } },
})
end,
inactive = function()
return MiniStatusline.combine_groups({
{ hl = 'MiniStatuslineInactive', strings = { vim.fn.expand('%:t') } },
})
end,
},
})
end,
}
-367
View File
@@ -1,367 +0,0 @@
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 = {
preset = {
header = [[
░█░█░█▀▀░█░█░█▀▀░█▀█░█▀▄░█▀▀░█░█
░█▀▄░█▀▀░░█░░█░░░█░█░█░█░█▀▀░▄▀▄
░▀░▀░▀▀▀░░▀░░▀▀▀░▀▀▀░▀▀░░▀▀▀░▀░▀
]],
},
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) },
},
layout = 'custom',
layouts = {
custom = {
layout = {
box = 'vertical',
backdrop = false,
row = -1,
width = 0,
height = 0.4,
border = 'top',
title = ' {title} {live} {flags}',
title_pos = 'left',
{
box = 'horizontal',
{ win = 'list', border = 'rounded' },
{ win = 'preview', title = '{preview}', width = 0.6, border = 'left' },
},
{ win = 'input', height = 1, border = 'top' },
},
},
},
},
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,
}
-78
View File
@@ -1,78 +0,0 @@
return {
-- treesitter
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
event = { 'BufReadPost', 'BufNewFile' },
config = function()
require('nvim-treesitter').setup({
ensure_installed = require('config.extensions').ts_parsers,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
},
indent = {
enable = true,
},
})
end,
},
-- auto pairs
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = function()
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('<', '>', {
-- Avoid conflicts with nvim-ts-autotag.
'-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',
ft = {
'html',
'xml',
'javascript',
'typescript',
'javascriptreact',
'typescriptreact',
'jsx',
'tsx',
'vue',
'svelte',
'markdown',
'htmldjango',
},
event = 'InsertEnter',
lazy = true,
opts = {
-- Defaults
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = false, -- Auto close on trailing </
},
},
-- syntax highlight for mdx
{
'davidmh/mdx.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
},
}
-114
View File
@@ -1,114 +0,0 @@
return {
-- rendering for html and markdown
{
'OXY2DEV/markview.nvim',
lazy = false,
-- to load before treesitter
priority = 45,
config = function()
require('markview').setup({
preview = {
icon_provider = 'mini',
enable = false,
},
})
end,
keys = {
{ '<leader>cv', '<Cmd>Markview toggle<CR>', desc = 'Toggle markdown preview', mode = 'n' },
},
},
-- 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,
},
-- smooth scrolling
{
'karb94/neoscroll.nvim',
opts = {},
},
-- Smart column (colorcolumn only when needed)
{
'm4xshen/smartcolumn.nvim',
event = { 'BufReadPost', 'BufNewFile' },
opts = {
colorcolumn = '120',
disabled_filetypes = {
'help',
'text',
'markdown',
'dashboard',
'snacks_dashboard',
'lazy',
'mason',
'oil',
},
},
},
-- Screenshot Tool
{
'mistricky/codesnap.nvim',
build = 'make',
cmd = {
'CodeSnap',
'CodeSnapSave',
'CodeSnapHighlight',
'CodeSnapSaveHighlight',
'CodeSnapASCII',
},
opts = {
bg_theme = 'dusk',
code_font_family = 'JetBrainsMono Nerd Font',
save_path = os.getenv('XDG_SCREENSHOTS_DIR') or (os.getenv('HOME') .. '/Pictures'),
watermark = 'SANKALP',
watermark_font_family = 'Anurati',
has_breadcrumbs = true,
breadcrumbs_separator = '/',
has_line_number = true,
},
},
}
-108
View File
@@ -1,108 +0,0 @@
return {
-- better escape
{
'max397574/better-escape.nvim',
config = function()
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>',
},
-- map jk and jj to exit insert mode
j = {
k = '<Esc>',
j = '<Esc>',
},
-- disable jj
j = {
j = false,
},
},
},
})
end,
},
-- float terminal
{
'akinsho/toggleterm.nvim',
cmd = { 'ToggleTerm' },
version = '*',
config = function()
require('toggleterm').setup({
size = 10,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = '2',
start_in_insert = true,
insert_mappings = true,
terminal_mappings = true,
persist_size = true,
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
highlights = {
border = 'Normal',
background = 'Normal',
},
},
})
end,
},
-- discord presence
-- {
-- "vyfor/cord.nvim",
-- event = "VeryLazy",
-- },
-- wakatime
{ 'wakatime/vim-wakatime', event = 'VimEnter', lazy = false },
-- workflow
{
'm4xshen/hardtime.nvim',
lazy = false,
opts = {},
},
-- buffer manager
{
'serhez/bento.nvim',
opts = {},
-- config = function()
-- require('bento').setup({
-- ordering_metric = 'edit',
-- ui = {
-- mode = 'floating',
-- floating = {
-- position = 'middle-right',
-- minimal_menu = 'full',
-- },
-- },
-- })
-- end,
},
-- navigator
{
'numToStr/Navigator.nvim',
event = 'VeryLazy',
config = function()
require('Navigator').setup({
auto_save = 'current',
disable_on_zoom = false,
mux = 'auto',
})
end,
},
}
-307
View File
@@ -1,307 +0,0 @@
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' } },
},
})
local normal_mappings = {
mode = 'n',
{ '<leader>x', ':x<cr>', desc = ' Save and Quit' },
-- { "<leader>a", group = " AI" },
{ '<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>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>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>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>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>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>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>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>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>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" },
{ '<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>l', group = ' LSP' },
{ '<leader>la', ':<C-U>Lspsaga range_code_action<cr>', desc = 'Code Action' },
{ '<leader>o', group = ' Options' },
{ '<leader>oc', ':CodeSnap<cr>', desc = 'CodeSnap into clipboard' },
{ '<leader>oC', ':CodeSnapSave<cr>', desc = 'CodeSnap in ~/Pictures' },
{ '<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' },
{ '<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' },
{ '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 = ' Next' },
{ ']g', ':Gitsigns next_hunk<cr>', desc = 'Git Hunk' },
{ ']o', group = 'Textobjects' },
{ 'gd', ':Lspsaga goto_definition<cr>', desc = 'Goto Definition' },
}
wk.add(normal_mappings)
wk.add(visual_mappings)
wk.add(no_leader_mappings)
end,
}
+184
View File
@@ -0,0 +1,184 @@
{
"plugins": {
"Comment.nvim": {
"rev": "e30b7f2008e52442154b66f7c519bfd2f1e32acb",
"src": "https://github.com/numToStr/Comment.nvim"
},
"Lspsaga.nvim": {
"rev": "e6c04f88836d79f2fd7e46fd170e7ee986c789d4",
"src": "https://github.com/nvimdev/Lspsaga.nvim"
},
"LuaSnip": {
"rev": "a62e1083a3cfe8b6b206e7d3d33a51091df25357",
"src": "https://github.com/L3MON4D3/LuaSnip"
},
"Navigator.nvim": {
"rev": "91d86506ac2a039504d5205d32a1d4bc7aa57072",
"src": "https://github.com/numToStr/Navigator.nvim"
},
"bento.nvim": {
"rev": "aee8a542bc1839ff1764992ef2aa41c981d0bba4",
"src": "https://github.com/serhez/bento.nvim"
},
"better-escape.nvim": {
"rev": "3f4bc0b326606264ff75967f59091b5ddada0554",
"src": "https://github.com/max397574/better-escape.nvim"
},
"blink.cmp": {
"rev": "d3874d2a13aa19b095bdd10d37a82a8f0aa7cad3",
"src": "https://github.com/saghen/blink.cmp",
"version": "'v0.*'"
},
"blink.lib": {
"rev": "f29d8bac6549bc1e7d699c83f680823d7def98bd",
"src": "https://github.com/saghen/blink.lib"
},
"conform.nvim": {
"rev": "dca1a190aa85f9065979ef35802fb77131911106",
"src": "https://github.com/stevearc/conform.nvim"
},
"friendly-snippets": {
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
"src": "https://github.com/rafamadriz/friendly-snippets"
},
"gitignore": {
"rev": "0344f643768c4d64af4add8c1bdddf6f7d4c9010",
"src": "https://github.com/wintermute-cell/gitignore.nvim"
},
"gitignore.nvim": {
"rev": "0344f643768c4d64af4add8c1bdddf6f7d4c9010",
"src": "https://github.com/wintermute-cell/gitignore.nvim"
},
"gitsigns.nvim": {
"rev": "dd3f588bacbeb041be6facf1742e42097f62165d",
"src": "https://github.com/lewis6991/gitsigns.nvim"
},
"gruvbox.nvim": {
"rev": "154eb5ff5b96d0641307113fa385eaf0d36d9796",
"src": "https://github.com/ellisonleao/gruvbox.nvim"
},
"guess-indent.nvim": {
"rev": "84a4987ff36798c2fc1169cbaff67960aed9776f",
"src": "https://github.com/NMAC427/guess-indent.nvim"
},
"hardtime.nvim": {
"rev": "b4e431934af1fe224a3a801f632c008278cb7628",
"src": "https://github.com/m4xshen/hardtime.nvim"
},
"indent-blankline.nvim": {
"rev": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03",
"src": "https://github.com/lukas-reineke/indent-blankline.nvim"
},
"markview.nvim": {
"rev": "dbf74b6db11c1468d5128a38b26b6d99dc7316e9",
"src": "https://github.com/OXY2DEV/markview.nvim"
},
"mason-conform.nvim": {
"rev": "48da2ebd5efbaf8a99566eadc3ece82d523f03c5",
"src": "https://github.com/zapling/mason-conform.nvim"
},
"mason-lspconfig.nvim": {
"rev": "1423254f58a3407a5afd5ade0ccd901f3eecc6ba",
"src": "https://github.com/mason-org/mason-lspconfig.nvim",
"version": "'main'"
},
"mason-nvim-lint": {
"rev": "cafbc5d82d8eb4af0daf0057332a325ddf2f436b",
"src": "https://github.com/rshkarin/mason-nvim-lint"
},
"mason.nvim": {
"rev": "cb8445f8ce85d957416c106b780efd51c6298f89",
"src": "https://github.com/mason-org/mason.nvim",
"version": "'main'"
},
"mdx.nvim": {
"rev": "6c3dc7c4a4b58b5d86404c21a9b4655282ca08c5",
"src": "https://github.com/davidmh/mdx.nvim"
},
"mini.nvim": {
"rev": "48555f1615f08c6318150aacb52bf7d61a5af798",
"src": "https://github.com/nvim-mini/mini.nvim"
},
"neodim": {
"rev": "1b8bda59a53b49ec2b59885e9fe78f8e90a1de76",
"src": "https://github.com/zbirenbaum/neodim"
},
"neoscroll.nvim": {
"rev": "c8d29979cb0cb3a2437a8e0ae683fd82f340d3b8",
"src": "https://github.com/karb94/neoscroll.nvim"
},
"nvim-autopairs": {
"rev": "59bce2eef357189c3305e25bc6dd2d138c1683f5",
"src": "https://github.com/windwp/nvim-autopairs"
},
"nvim-highlight-colors": {
"rev": "e4c7af0211866162d999ce0bdd6a029302e19139",
"src": "https://github.com/brenoprata10/nvim-highlight-colors"
},
"nvim-lint": {
"rev": "eab58b48eb11d7745c11c505e0f3057165902461",
"src": "https://github.com/mfussenegger/nvim-lint"
},
"nvim-lspconfig": {
"rev": "cd576dd72d31ddffcbfa6d064c0dd697ca218758",
"src": "https://github.com/neovim/nvim-lspconfig"
},
"nvim-treesitter": {
"rev": "4916d6592ede8c07973490d9322f187e07dfefac",
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
},
"nvim-ts-autotag": {
"rev": "88c1453db4ba7dd24131086fe51fdf74e587d275",
"src": "https://github.com/windwp/nvim-ts-autotag"
},
"smartcolumn.nvim": {
"rev": "b9cdbdf42f7ac5a659204cd5926017c7ff724a19",
"src": "https://github.com/m4xshen/smartcolumn.nvim"
},
"snacks.nvim": {
"rev": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e",
"src": "https://github.com/folke/snacks.nvim"
},
"suda.vim": {
"rev": "c492741b4679b3cdd4d9e34138209784e061d916",
"src": "https://github.com/lambdalisue/suda.vim"
},
"tiny-code-action.nvim": {
"rev": "0d040ed81f7953118b81cd12681fcdfcac069803",
"src": "https://github.com/rachartier/tiny-code-action.nvim"
},
"tiny-glimmer.nvim": {
"rev": "cc285167914e947fc130523d02927fdaf24636a6",
"src": "https://github.com/rachartier/tiny-glimmer.nvim"
},
"tiny-inline-diagnostic.nvim": {
"rev": "147af4e49f51dd48f41972de26552872b8ba7b25",
"src": "https://github.com/rachartier/tiny-inline-diagnostic.nvim"
},
"todo-comments.nvim": {
"rev": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668",
"src": "https://github.com/folke/todo-comments.nvim"
},
"toggleterm.nvim": {
"rev": "9a88eae817ef395952e08650b3283726786fb5fb",
"src": "https://github.com/akinsho/toggleterm.nvim",
"version": "'*'"
},
"vim-visual-multi": {
"rev": "a6975e7c1ee157615bbc80fc25e4392f71c344d4",
"src": "https://github.com/mg979/vim-visual-multi"
},
"vim-wakatime": {
"rev": "24495fb7cc9613eaf0ce45540fb8d096a30d08e9",
"src": "https://github.com/wakatime/vim-wakatime"
},
"which-key.nvim": {
"rev": "3aab2147e74890957785941f0c1ad87d0a44c15a",
"src": "https://github.com/folke/which-key.nvim"
},
"windsurf.vim": {
"rev": "3c0a4f8a7be75113a6e19be13b7cc37210d6e26a",
"src": "https://github.com/Exafunction/windsurf.vim"
}
}
}
+34
View File
@@ -0,0 +1,34 @@
add("ellisonleao/gruvbox.nvim")
local palette = require("gruvbox").palette
require("gruvbox").setup({
bold = false,
italic = {
strings = false,
emphasis = false,
comments = false,
folds = false,
},
contrast = "hard",
transparent_mode = true,
overrides = {
-- builtin
SignColumn = { bg = "None" },
CursorLineNr = { bg = "None" },
Whitespace = { fg = palette.dark0 },
EndOfBuffer = { fg = palette.dark0_hard },
Visual = { fg = "None", bg = palette.dark1 },
Label = { link = "GruvboxPurple" },
-- blink.cmp
BlinkCmpMenu = { link = "Normal" },
BlinkCmpMenuBorder = { link = "BlinkCmpMenu" },
BlinkCmpMenuSelection = { fg = "None", bg = palette.dark1 },
BlinkCmpLabelMatch = { fg = palette.bright_green },
BlinkCmpScrollBarGutter = { bg = palette.dark2 },
BlinkCmpScrollBarThumb = { bg = palette.light1 },
-- indent guides
MiniIndentscopeSymbol = { fg = palette.dark1 },
},
})
+74
View File
@@ -0,0 +1,74 @@
add({
{ src = "mason-org/mason.nvim", version = "main" }, -- lsp installer manager
{ src = "mason-org/mason-lspconfig.nvim", version = "main" }, -- lsp installer
"neovim/nvim-lspconfig", -- lsp config
"nvimdev/Lspsaga.nvim", -- lsp ui
"rachartier/tiny-inline-diagnostic.nvim", -- inline diagnostic
"rachartier/tiny-code-action.nvim", -- code action
})
-- lsp installer
require("mason").setup({
ui = {
icons = {
package_installed = "✓",
package_pending = "➜",
package_uninstalled = "✗",
},
border = "rounded",
backdrop = 100,
},
})
require("mason-lspconfig").setup({
ensure_installed = require("extensions").lsp_server,
automatic_installation = false, -- Don't auto-install or auto-configure
})
-- improve neovim lsp experience
vim.api.nvim_create_autocmd("LspAttach", {
callback = function()
require("lspsaga").setup({
ui = {
theme = "round",
border = "rounded",
devicon = true,
title = true,
winblend = 1,
expand = "",
collapse = "",
preview = "",
code_action = "󰠠 ",
diagnostic = "",
incoming = "",
outgoing = "",
hover = "",
},
})
--inline diagnostic
require("tiny-inline-diagnostic").setup({
options = {
show_source = true,
multiple_diag_under_cursor = true,
},
})
--code action
require("tiny-code-action").setup({
picker = {
"buffer",
opts = {
auto_preview = true,
hotkeys = true,
hotkeys_mode = "sequential",
},
},
})
end,
})
vim.diagnostic.config({ virtual_text = false }) -- Disable default virtual text
vim.keymap.set("n", "<leader>.", function()
require("tiny-code-action").code_action()
end, { desc = "Code action" })
+82
View File
@@ -0,0 +1,82 @@
add({
"mfussenegger/nvim-lint", -- linter
"rshkarin/mason-nvim-lint", -- linter installer
"stevearc/conform.nvim", -- autoformater
"zapling/mason-conform.nvim", -- formatter installer
})
-- linter
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("extensions").linter,
automatic_installation = false,
})
-- formatter
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("extensions").formatter,
automatic_installation = true,
})
+75
View File
@@ -0,0 +1,75 @@
add({
"saghen/blink.lib",
{ src = "saghen/blink.cmp", version = "v0.*" },
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
})
require("blink.cmp").setup({
fuzzy = { implementation = "prefer_rust" },
snippets = { preset = "luasnip" },
sources = {
default = { "lsp", "path", "snippets", "buffer" },
providers = {},
},
completion = {
ghost_text = { enabled = true },
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" },
},
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" },
},
})
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" })
+72
View File
@@ -0,0 +1,72 @@
add({
"windwp/nvim-autopairs", -- autopairs
"windwp/nvim-ts-autotag", -- autotag
"folke/todo-comments.nvim", -- todo comment highlights
"wakatime/vim-wakatime", --wakaTime coding time tracker
"lambdalisue/suda.vim", -- edit files as sudo (:SudaWrite)
"numToStr/Comment.nvim", -- smart comment toggling
"NMAC427/guess-indent.nvim", -- auto-detect tab/space indentation
"brenoprata10/nvim-highlight-colors", -- color highlighting
"davidmh/mdx.nvim", -- syntax highlighter for mdx
"nvim-treesitter/nvim-treesitter", -- nvim-treesitter
"Exafunction/windsurf.vim", -- windsurf ai for autocompletion
"numToStr/Navigator.nvim", -- navigator
"m4xshen/hardtime.nvim", -- workflow
"lukas-reineke/indent-blankline.nvim", --indent guides
"mg979/vim-visual-multi", -- multiple cursors
})
vim.g.VM_maps = {
["Find Under"] = "<M-d>", -- Alt + d | Select word under cursor and start multi-cursor
["Find Subword Under"] = "<M-d>", -- Alt + d | Select subword under cursor
["Select All"] = "<C-M-d>", -- Ctrl + Alt + d | Select all occurrences in the buffer
["Add Cursor Down"] = "<C-M-j>", -- Ctrl + Alt + j | Add a cursor on the line below
["Add Cursor Up"] = "<C-M-k>", -- Ctrl + Alt + k | Add a cursor on the line above
}
-- lazy load insert mode enhancements
vim.api.nvim_create_autocmd("InsertEnter", {
callback = function()
require("nvim-autopairs").setup({})
require("nvim-ts-autotag").setup({})
end,
once = true,
})
-- lazy load general editor enhancements
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
callback = function()
require("todo-comments").setup({ signs = false })
require("Comment").setup()
require("guess-indent").setup({})
require("nvim-highlight-colors").setup({ render = "background" })
require("Navigator").setup({
auto_save = "current",
disable_on_zoom = false,
mux = "auto",
})
end,
})
require("hardtime").setup({})
require("ibl").setup({})
require("nvim-treesitter").setup({
ensure_installed = require("extensions").ts_parsers,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
},
indent = {
enable = true,
},
})
-- windsurf
vim.keymap.set("i", "<A-f>", function()
return vim.fn["codeium#Accept"]()
end, { expr = true, silent = true })
vim.keymap.set("i", "<A-x>", function()
return vim.fn["codeium#Clear"]()
end, { expr = true, silent = true })
+34
View File
@@ -0,0 +1,34 @@
add({
"lewis6991/gitsigns.nvim",
"wintermute-cell/gitignore.nvim", -- .gitignore generator
})
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
callback = function()
require("gitsigns").setup({
signcolumn = true,
current_line_blame = true,
attach_to_untracked = false,
current_line_blame_formatter = "<author>, <author_time:%R> - <summary>",
watch_gitdir = {
follow_files = true,
},
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,
},
signs = {
add = { text = "" },
change = { text = "󱗜 " },
delete = { text = "󰍵 " },
topdelete = { text = "󱥨 " },
changedelete = { text = "󰾟 " },
untracked = { text = "󰰧 " },
},
})
end,
})
+153
View File
@@ -0,0 +1,153 @@
add("echasnovski/mini.nvim")
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
-- 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(),
-- automated change of current directory
require("mini.misc").setup_auto_root(),
})
-- splitjoin
require("mini.splitjoin").setup({
mappings = {
toggle = "<leader>tj",
split = "",
join = "",
},
})
-- surround action
require("mini.surround").setup({
mappings = {
add = "msa",
delete = "msd",
find = "msf",
find_left = "msF",
highlight = "msh",
replace = "msr",
update_n_lines = "msn",
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 },
})
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*",
callback = function(args)
if vim.bo[args.buf].buftype ~= "" then
vim.b[args.buf].miniindentscope_disable = true
end
end,
})
-- statusline
require("mini.statusline").setup({
use_icons = true,
content = {
active = function()
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
local git = MiniStatusline.section_git({ trunc_width = 40 })
local diff = MiniStatusline.section_diff({ trunc_width = 80 })
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 60 })
local lsp = MiniStatusline.section_lsp({ trunc_width = 40 })
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
local function section_filetype(args)
if MiniStatusline.is_truncated(args.trunc_width) or vim.bo.filetype == "" or vim.bo.buftype ~= "" then
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)
end
local function section_lsp_clients(args)
if MiniStatusline.is_truncated(args.trunc_width) then
return ""
end
local clients = vim.lsp.get_clients({ bufnr = 0 })
if not clients or #clients == 0 then
return ""
end
local names = vim.tbl_map(function(c)
return c.name
end, clients)
return string.format(" %s", table.concat(names, ", "))
end
local function section_searchcount(args)
if vim.v.hlsearch == 0 then
return ""
end
local ok, s = pcall(vim.fn.searchcount, { recompute = true })
if not ok or s.current == nil or s.total == 0 then
return ""
end
local icon = MiniStatusline.is_truncated(args.trunc_width) and "" or " "
if s.incomplete == 1 then
return icon .. "?/?│"
end
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)
end
local function section_location(args)
return MiniStatusline.is_truncated(args.trunc_width) and "%-2l│%-2v" or "󰉸 %-2l│󱥖 %-2v"
end
local filetype = section_filetype({ trunc_width = 70 })
local searchcount = section_searchcount({ trunc_width = 80 })
local loc = section_location({ trunc_width = 120 })
local lsp_clients = section_lsp_clients({ trunc_width = 60 })
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 = mode_hl, strings = { filetype, searchcount, loc } },
})
end,
inactive = function()
return MiniStatusline.combine_groups({
{ hl = "MiniStatuslineInactive", strings = { vim.fn.expand("%:t") } },
})
end,
},
})
+367
View File
@@ -0,0 +1,367 @@
add("folke/snacks.nvim")
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 = {
preset = {
header = [[
░█░█░█▀▀░█░█░█▀▀░█▀█░█▀▄░█▀▀░█░█
░█▀▄░█▀▀░░█░░█░░░█░█░█░█░█▀▀░▄▀▄
░▀░▀░▀▀▀░░▀░░▀▀▀░▀▀▀░▀▀░░▀▀▀░▀░▀
]],
},
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,
},
},
},
debug = { enabled = true },
dim = {
enabled = true,
scope = {
min_size = 5,
max_size = 20,
siblings = true,
},
},
explorer = { enabled = false },
projects = {
dirs = {
"~/Project",
"~/.config/Modus"
}
},
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) },
},
layout = "custom",
layouts = {
custom = {
layout = {
box = "vertical",
backdrop = false,
row = -1,
width = 0,
height = 0.4,
border = "top",
title = " {title} {live} {flags}",
title_pos = "left",
{
box = "horizontal",
{ win = "list", border = "rounded" },
{ win = "preview", title = "{preview}", width = 0.6, border = "left" },
},
{ win = "input", height = 1, border = "top" },
},
},
},
},
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,
},
},
},
})
+104
View File
@@ -0,0 +1,104 @@
add({
"m4xshen/smartcolumn.nvim", -- smart column when needed
"karb94/neoscroll.nvim", -- smooth scrolling
"OXY2DEV/markview.nvim", -- rendering for html and markdown
"serhez/bento.nvim", -- buffer manager
{ src = "akinsho/toggleterm.nvim", version = "*" }, --float terminal
"max397574/better-escape.nvim", -- better escape
"zbirenbaum/neodim", -- dimming the highlights of unused functions, variables, parameters, and more
})
-- lazy load UI enhancement plugins
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
callback = function()
require("neoscroll").setup({
mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb" },
})
require("neodim").setup({
alpha = 0.5,
blend_color = nil,
hide = {
underline = true,
virtual_text = true,
signs = true,
},
regex = {
"[uU]nused",
"[nN]ever [rR]ead",
"[nN]ot [rR]ead",
},
priority = 128,
disable = {},
})
end,
})
-- lazy load markdown preview
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function()
require("markview").setup({
preview = {
icon_provider = "mini",
enable = false,
},
})
end,
})
vim.keymap.set("n", "<leader>cv", "<cmd>Markview toggle<cr>", { desc = "toggle markdown preview" })
-- smart column only when needed
require("smartcolumn").setup({
colorcolumn = 120,
disabled_filetypes = {
"help",
"text",
"markdown",
"oil",
"snacks_dashboard",
"dashboard",
},
})
require("bento").setup({})
require("toggleterm").setup({
size = 10,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = "2",
start_in_insert = true,
insert_mappings = true,
terminal_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
},
},
})
-- lazy load better escape
vim.api.nvim_create_autocmd("InsertEnter", {
callback = function()
require("better_escape").setup({
mappings = {
i = {
k = { j = "<Esc>" },
j = { k = "<Esc>", j = "<Esc>" },
-- disable jj
-- j = { j = false },
},
},
})
end,
once = true,
})
+301
View File
@@ -0,0 +1,301 @@
add("folke/which-key.nvim")
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" },
-- { "<leader>a", group = " AI" },
{ "<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>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>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>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>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>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>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>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>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>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" },
{ "<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>l", group = " LSP" },
{ "<leader>la", ":<C-U>Lspsaga range_code_action<cr>", desc = "Code Action" },
-- { "<leader>o", group = " Options" },
{ "<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" },
{ "<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" },
{ "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 = " Next" },
{ "]g", ":Gitsigns next_hunk<cr>", desc = "Git Hunk" },
{ "]o", group = "Textobjects" },
{ "gd", ":Lspsaga goto_definition<cr>", desc = "Goto Definition" },
}
wk.add(normal_mappings)
wk.add(visual_mappings)
wk.add(no_leader_mappings)