This commit is contained in:
Mariano Z. 2024-12-21 11:22:16 -03:00
commit ae7d9bf4b6
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
63 changed files with 2160 additions and 0 deletions

View file

@ -0,0 +1,71 @@
-- Create autogroups first
local MZuninoGroup = vim.api.nvim_create_augroup("mzunino", {})
local yank_group = vim.api.nvim_create_augroup("HighlightYank", {})
local bigfile_group = vim.api.nvim_create_augroup("bigfile", {})
-- Set bigfile size threshold
vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
-- Netrw diagnostic disable
vim.api.nvim_create_autocmd("FileType", {
pattern = "netrw",
callback = function()
vim.diagnostic.enable(false)
end,
})
-- Template files
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "*.templ",
command = "set filetype=templ",
})
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
group = yank_group,
pattern = "*",
callback = function()
vim.highlight.on_yank({
higroup = "IncSearch",
timeout = 40,
})
end,
})
-- Remove trailing whitespace on save
vim.api.nvim_create_autocmd("BufWritePre", {
group = MZuninoGroup,
pattern = "*",
command = [[%s/\s\+$//e]],
})
-- Auto-apply chezmoi changes
vim.api.nvim_create_autocmd("BufWritePost", {
group = MZuninoGroup,
pattern = "~/.local/share/chezmoi/*",
command = [[silent! !chezmoi apply --source-path "%"]],
})
-- Bigfile detection
vim.filetype.add({
pattern = {
[".*"] = {
function(path, buf)
return vim.bo[buf].filetype ~= "bigfile" and path and vim.fn.getfsize(path) > vim.g.bigfile_size and "bigfile"
or nil
end,
},
},
})
-- Bigfile handling
vim.api.nvim_create_autocmd("FileType", {
group = bigfile_group,
pattern = "bigfile",
callback = function(ev)
vim.b.minianimate_disable = true
vim.schedule(function()
vim.bo[ev.buf].syntax = vim.filetype.match({ buf = ev.buf }) or ""
end)
end,
})

53
lua/config/lazy.lua Normal file
View file

@ -0,0 +1,53 @@
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)
require("lazy").setup({
spec = {
{ import = "config.plugins" },
},
performance = {
rtp = {
disabled_plugins = {
"gzip",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
change_detection = {
notify = false,
enable = true,
},
ui = {
border = "rounded",
size = {
width = 0.8,
height = 0.8,
},
},
})
nmap("<leader>la", ":Lazy<CR>", { desc = "Open Lazy" })

15
lua/config/lsp/gopls.lua Normal file
View file

@ -0,0 +1,15 @@
return {
settings = {
gopls = {
gofumpt = true, -- https://github.com/mvdan/gofumpt a stricter gofmt
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
},
},
},
flags = {
debounce_text_changes = 150, -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md#change-detection
},
}

3
lua/config/lsp/html.lua Normal file
View file

@ -0,0 +1,3 @@
return {
filetypes = { "html", "templ" },
}

3
lua/config/lsp/htmx.lua Normal file
View file

@ -0,0 +1,3 @@
return {
filetypes = { "html", "templ" },
}

16
lua/config/lsp/jsonls.lua Normal file
View file

@ -0,0 +1,16 @@
return {
settings = {
json = {
schemas = require("schemastore").json.schemas(),
},
},
setup = {
commands = {
Format = {
function()
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line("$"), 0 })
end,
},
},
},
}

22
lua/config/lsp/lua_ls.lua Normal file
View file

@ -0,0 +1,22 @@
-- With 2-space indentation
return {
settings = {
Lua = {
format = {
enable = false,
},
hint = {
enable = false,
arrayIndex = "Disable",
await = true,
paramName = "Disable",
paramType = true,
semicolon = "All",
setType = false,
},
telemetry = {
enable = false,
},
},
},
}

View file

@ -0,0 +1,7 @@
return {
settings = {
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
},
}

21
lua/config/lsp/yamlls.lua Normal file
View file

@ -0,0 +1,21 @@
return {
settings = {
yaml = {
schemaStore = {
-- You must disable built-in schemaStore support if you want to use
-- this plugin and its advanced options like `ignore`.
enable = false,
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
url = "",
},
schemas = require("schemastore").yaml.schemas({
-- additional schemas (not in the catalog)
extra = {
url = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json",
name = "Argo CD Application",
fileMatch = "argocd-application.yaml",
},
}),
},
},
}

119
lua/config/options.lua Normal file
View file

@ -0,0 +1,119 @@
vim.opt.guifont = "monospace:h17" -- the font used in graphical neovim applications
-- Make line numbers default
vim.opt.number = true
vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = "a"
-- Don't show the mode, since it's already in status line
vim.opt.showmode = false
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.opt.clipboard = "unnamedplus"
-- Enable break indent
vim.opt.breakindent = true
-- Save undo history
vim.opt.undofile = true
-- Case-insensitive searching UNLESS \C or capital in search
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Search as characters are entered
vim.opt.incsearch = true
-- Highlight search
vim.opt.hlsearch = true
-- Keep signcolumn on by default
vim.opt.signcolumn = "yes"
-- Decrease update time
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
-- Configure how new splits should be opened
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Sets how neovim will display certain whitespace in the editor.
-- See :help 'list'
-- and :help 'listchars'
vim.opt.list = true
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "" }
-- Preview substitutions live, as you type!
vim.opt.inccommand = "split"
-- Show which line your cursor is on
vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
vim.opt.wrap = false
vim.opt.colorcolumn = "120"
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.termguicolors = true
vim.opt.showmatch = true
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
-- Give more space for displaying messages.
vim.opt.cmdheight = 1
-- Don't pass messages to |ins-completion-menu|.
vim.opt.shortmess:append("c")
vim.opt.completeopt = { "menuone", "noselect" }
vim.opt.pumheight = 10
vim.opt.pumblend = 10
local group = vim.api.nvim_create_augroup("highlight_yank", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 50 })
end,
group = group,
})
vim.opt.foldmethod = "indent"
vim.opt.foldnestmax = 3
vim.opt.foldenable = false
vim.g.netrw_browse_split = 0
vim.g.netrw_banner = 0
vim.g.netrw_winsize = 25
vim.g.netrw_liststyle = 3
vim.g.netrw_localrmdir = "rm -r"
vim.g.netrw_browse_split = 0
vim.g.netrw_banner = 0
vim.g.netrw_winsize = 25
vim.filetype.add({
extension = {
templ = "templ",
njk = "html",
},
})
vim.filetype.add({
extension = { rasi = "rasi" },
pattern = {
[".*/waybar/config"] = "jsonc",
[".*/mako/config"] = "dosini",
[".*/kitty/*.conf"] = "bash",
[".*/hypr/.*%.conf"] = "hyprlang",
},
})

25
lua/config/plugins/ai.lua Normal file
View file

@ -0,0 +1,25 @@
local M = {
"Exafunction/codeium.vim",
cmd = "CodeiumEnable",
keys = {
{ "<leader>ce", "<cmd>CodeiumEnable<cr>", desc = "Codeium Enable" },
},
}
M.config = function()
vim.g.codeium_disable_bindings = 1
imap("<Tab>", function()
return vim.fn["codeium#Accept"]()
end, { expr = true, silent = true, desc = "[codeium] Accept completion" })
imap("<M-;>", function()
return vim.fn["codeium#CycleCompletions"](1)
end, { expr = true, silent = true, desc = "[codeium] Cycle completions" })
imap("<M-,>", function()
return vim.fn["codeium#CycleCompletions"](-1)
end, { expr = true, silent = true, desc = "[codeium] Cycle completions" })
end
return M

View file

@ -0,0 +1,15 @@
local M = {
"goolord/alpha-nvim",
}
M.config = function()
local startify = require("alpha.themes.startify")
startify.section.bottom_buttons.val = {
startify.button("q", "Quit", "<cmd>q <CR>"), -- preserve the quit button
}
require("alpha").setup(startify.config)
end
return M

View file

@ -0,0 +1,31 @@
local M = {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
}
M.config = function()
require("ibl").setup({
indent = {
char = "",
tab_char = "",
},
scope = { enabled = false },
exclude = {
filetypes = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
},
})
end
return M

View file

@ -0,0 +1,35 @@
return {
{
"alker0/chezmoi.vim",
lazy = false,
init = function()
-- This option is required.
vim.g["chezmoi#use_tmp_buffer"] = true
-- add other options here if needed.
end,
},
{
"xvzc/chezmoi.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("chezmoi").setup({
-- your configurations
edit = {
watch = true, -- Set true to automatically apply on save.
force = true, -- Set true to force apply. Works only when watch = true.
},
notification = {
on_open = true, -- vim.notify when start editing chezmoi-managed file.
on_apply = true, -- vim.notify on apply.
},
})
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
callback = function()
-- invoke with vim.schedule() for better startup time
vim.schedule(require("chezmoi.commands.__edit").watch)
end,
})
end,
},
}

View file

@ -0,0 +1,31 @@
local M = {
"norcalli/nvim-colorizer.lua",
branch = "master",
}
M.config = function()
require("colorizer").setup({
filetypes = {
"typescript",
"typescriptreact",
"javascript",
"javascriptreact",
"css",
"html",
"astro",
"lua",
"go",
"golang",
"bash",
"sh",
},
user_default_options = {
names = false,
rgb_fn = true,
hsl_fn = true,
tailwind = "both",
},
})
end
return M

View file

@ -0,0 +1,32 @@
local M = {
{
"EdenEast/nightfox.nvim",
enabled = true,
priority = 1000,
config = function()
vim.cmd("colorscheme nightfox")
end,
},
{
"rose-pine/neovim",
name = "rose-pine",
enabled = false,
priority = 1000,
opts = {
variant = "auto",
dark_variant = "main",
groups = {
border = "muted",
panel = "surface",
error = "love",
hint = "iris",
info = "foam",
},
},
config = function()
vim.cmd("colorscheme rose-pine")
end,
},
}
return M

View file

@ -0,0 +1,38 @@
local M = {
{
"numToStr/Comment.nvim",
dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring",
event = "VeryLazy",
},
},
{ "folke/todo-comments.nvim" },
}
M.config = function()
vim.g.skip_ts_context_commentstring_module = true
require("ts_context_commentstring").setup({
enable_autocmd = false,
})
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
opleader = {
line = "gc",
block = "gC",
},
mappings = {
basic = true,
},
})
require("todo-comments").setup({
keywords = {
FUCK = { icon = "󰇷 ", color = "error" },
SHITTY = { icon = "󰇷 ", color = "error" },
},
})
end
return M

View file

@ -0,0 +1,42 @@
local M = {
"saghen/blink.cmp",
dependencies = "rafamadriz/friendly-snippets",
version = "v0.*",
}
M.config = function()
require("blink.cmp").setup({
keymap = {
["<C-space>"] = {
"show",
"show_documentation",
"hide_documentation",
},
["<C-d>"] = { "hide", "fallback" },
["<C-c>"] = { "hide", "fallback" },
["<C-k>"] = { "select_prev", "fallback" },
["<C-j>"] = { "select_next", "fallback" },
},
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = "mono",
},
signature = {
enabled = true,
},
completion = {
accept = {
create_undo_point = true,
auto_brackets = {
enabled = true,
},
},
},
})
end
return M

18
lua/config/plugins/db.lua Normal file
View file

@ -0,0 +1,18 @@
local M = {
"tpope/vim-dadbod",
cmd = {
"DBUI",
},
dependencies = {
"kristijanhusak/vim-dadbod-ui",
"kristijanhusak/vim-dadbod-completion",
},
}
M.config = function()
vim.g.db_ui_use_nerd_fonts = 1
-- g:db_ui_save_location
vim.g.db_ui_save_location = "~/Sync/saved_queries"
end
return M

View file

@ -0,0 +1,121 @@
local M = {
"folke/trouble.nvim",
branch = "main",
}
local function setup_keymaps(trouble)
-- Diagnostic navigation
nmap("[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" })
nmap("]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" })
-- Trouble specific navigation
nmap("<a-k>", function()
trouble.previous({ skip_groups = true, jump = true })
end, { desc = "Previous trouble item" })
nmap("<a-j>", function()
trouble.next({ skip_groups = true, jump = true })
end, { desc = "Next trouble item" })
-- Trouble mode toggles
nmap("<leader>tt", "<cmd>TroubleToggle<cr>", { desc = "Toggle trouble" })
nmap("<leader>tw", "<cmd>TroubleToggle workspace_diagnostics<cr>", { desc = "Workspace diagnostics" })
nmap("<leader>td", "<cmd>TroubleToggle document_diagnostics<cr>", { desc = "Document diagnostics" })
nmap("<leader>tq", "<cmd>TroubleToggle quickfix<cr>", { desc = "Quickfix list" })
nmap("<leader>tl", "<cmd>TroubleToggle loclist<cr>", { desc = "Location list" })
end
local function setup_diagnostic_config()
vim.diagnostic.config({
virtual_text = {
prefix = "",
suffix = "",
format = function(diagnostic)
local icons = {
[vim.diagnostic.severity.ERROR] = " ",
[vim.diagnostic.severity.WARN] = " ",
[vim.diagnostic.severity.HINT] = " ",
[vim.diagnostic.severity.INFO] = " ",
}
local icon = icons[diagnostic.severity] or ""
return string.format("%s %s", icon, diagnostic.message)
end,
},
underline = false,
update_in_insert = false,
signs = {
active = true,
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.HINT] = "",
[vim.diagnostic.severity.INFO] = "",
},
},
float = {
focusable = true,
style = "minimal",
border = "rounded",
source = true,
header = "",
prefix = "",
format = function(diagnostic)
local severity = vim.diagnostic.severity[diagnostic.severity]
return string.format("%s: %s", severity:lower(), diagnostic.message)
end,
},
severity_sort = true,
})
end
function M.config()
local trouble = require("trouble")
trouble.setup({
position = "bottom",
height = 10,
width = 50,
icons = true,
mode = "workspace_diagnostics",
fold_open = "",
fold_closed = "",
group = true,
padding = true,
action_keys = {
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
toggle_mode = "m", -- toggle between "workspace" and "document" mode
toggle_preview = "P", -- toggle auto_preview
preview = "p", -- preview the diagnostic location
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j", -- next item
},
auto_preview = true,
auto_fold = false,
auto_jump = { "lsp_definitions" },
signs = {
-- Icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = "",
},
use_diagnostic_signs = false,
})
-- Setup keymaps
setup_keymaps(trouble)
-- Setup diagnostic configuration
setup_diagnostic_config()
end
return M

View file

@ -0,0 +1,59 @@
local M = {
{
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
cloak_character = "*",
highlight_group = "Comment",
patterns = {
{
file_pattern = {
".env*",
"wrangler.toml",
".dev.vars",
},
cloak_pattern = "=.+",
},
},
})
nmap("<Leader>cc", ":CloakToggle<cr>")
end,
},
{
"philosofonusus/ecolog.nvim",
keys = {
{ "<leader>ge", "<cmd>EcologGoto<cr>", desc = "Go to env file" },
{ "<leader>ep", "<cmd>EcologPeek<cr>", desc = "Ecolog peek variable" },
{ "<leader>es", "<cmd>EcologSelect<cr>", desc = "Switch env file" },
},
-- Lazy loading is done internally
lazy = false,
opts = {
integrations = {
blink_cmp = true,
},
-- Enables shelter mode for sensitive values
shelter = {
configuration = {
partial_mode = false, -- false by default, disables partial mode, for more control check out shelter partial mode
mask_char = "*", -- Character used for masking
},
modules = {
cmp = true, -- Mask values in completion
peek = false, -- Mask values in peek view
files = false, -- Mask values in files
telescope = false, -- Mask values in telescope
},
},
-- true by default, enables built-in types (database_url, url, etc.)
types = true,
path = vim.fn.getcwd(), -- Path to search for .env files
preferred_environment = "development", -- Optional: prioritize specific env files
},
},
}
M.config = function() end
return M

View file

@ -0,0 +1,22 @@
local M = {
"folke/flash.nvim",
opts = {
jump = {
autojump = true,
},
modes = {
char = {
jump_labels = true,
multi_line = false,
},
},
},
}
M.config = function()
nmap("<leader>ff", function()
require("flash").jump()
end, { desc = "Flash" })
end
return M

View file

@ -0,0 +1,53 @@
return {
"bbjornstad/pretty-fold.nvim",
enabled = true,
config = function()
local global_setup = {
sections = {
left = { "content" },
right = {
" ",
function()
return ("[%dL]"):format(vim.v.foldend - vim.v.foldstart)
end,
"[",
"percentage",
"]",
},
},
matchup_patterns = {
{ "{", "}" },
{ "%(", ")" }, -- % to escape lua pattern char
{ "%[", "]" }, -- % to escape lua pattern char
},
-- add_close_pattern = true,
process_comment_signs = ({ "delete", "spaces", false })[2],
}
local function ft_setup(lang, options) -- {{{
local opts = vim.tbl_deep_extend("force", global_setup, options)
-- combine global and ft specific matchup_patterns
if opts and opts.matchup_patterns and global_setup.matchup_patterns then
opts.matchup_patterns = vim.list_extend(opts.matchup_patterns, global_setup.matchup_patterns)
end
require("pretty-fold").ft_setup(lang, opts)
end -- }}}
require("pretty-fold").setup(global_setup)
ft_setup("lua", { -- {{{
matchup_patterns = {
{ "^%s*do$", "end" }, -- do ... end blocks
{ "^%s*if", "end" }, -- if ... end
{ "^%s*for", "end" }, -- for
{ "function[^%(]*%(", "end" }, -- 'function( or 'function (''
},
}) -- }}}
ft_setup("vim", { -- {{{
matchup_patterns = {
{ "^%s*function!?[^%(]*%(", "endfunction" },
},
}) -- }}}
end,
}

View file

@ -0,0 +1,38 @@
return {
"stevearc/conform.nvim",
event = {
"BufReadPre",
"BufNewFile",
},
config = function()
require("conform").setup({
formatters_by_ft = {
graphql = { "prettierd", "prettier" },
njk = { "prettierd", "prettier" },
html = { "prettierd", "prettier" },
typescript = { "prettierd", "prettier" },
lua = { "stylua" },
javascript = { "prettierd", "prettier", stop_after_first = true },
json = { "prettierd", "prettier" },
sh = { "shfmt" },
bash = { "shfmt" },
tex = { "latexindent" },
go = { "gofumpt", "goimports-reviser", "golines" },
cs = { "csharpier" },
templ = { "templ" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
async = false,
},
notify_on_error = false,
})
end,
}

View file

@ -0,0 +1,72 @@
local M = {
"ibhagwan/fzf-lua",
}
M.config = function()
local config = require("fzf-lua.config")
local actions = require("trouble.sources.fzf").actions
config.defaults.actions.files["ctrl-q"] = actions.open
local fzf_lua = require("fzf-lua")
-- Basic fzf-lua setup
fzf_lua.setup({
layout = "fzf-vim",
keymap = {
fzf = {
["CTRL-Q"] = "select-all+accept",
},
},
grep = {
fzf_opts = {
["--history"] = vim.fn.stdpath("data") .. "/fzf-lua-grep-history",
},
},
})
nmap("K", vim.lsp.buf.hover, { desc = "Hover Documentation" })
nmap("gd", function()
fzf_lua.lsp_definitions({ jump_to_single_result = true })
end, { desc = "Goto Definition" })
nmap("gr", function()
fzf_lua.lsp_references({ ignore_current_line = true })
end, { desc = "Goto References" })
nmap("gi", function()
fzf_lua.lsp_implementations({ jump_to_single_result = true })
end, { desc = "Goto Implementation" })
nmap("<leader>D", fzf_lua.lsp_typedefs, { desc = "Type Definition" })
nmap("<leader>ca", fzf_lua.lsp_code_actions, { desc = "Code Action" })
nmap("<leader>ds", fzf_lua.lsp_document_symbols, { desc = "Document Symbols" })
nmap("<leader>ws", fzf_lua.lsp_workspace_symbols, { desc = "Workspace Symbols" })
nmap("<leader>ic", fzf_lua.lsp_incoming_calls, { desc = "Incoming Calls" })
nmap("<leader>oc", fzf_lua.lsp_outgoing_calls, { desc = "Outgoing Calls" })
-- keys = {
nmap("<leader>/", function()
fzf_lua.files({
cwd_prompt = false,
silent = true,
})
end, { desc = "Find Files" })
nmap(";", fzf_lua.buffers, { desc = "Find Buffers" })
nmap("gf", fzf_lua.live_grep, { desc = "Find Live Grep" })
nmap("sb", fzf_lua.grep_curbuf, { desc = "Search Current Buffer" })
nmap("gw", fzf_lua.grep_cword, { desc = "Search word under cursor" })
nmap("gW", fzf_lua.grep_cWORD, { desc = "Search WORD under cursor" })
nmap("sk", fzf_lua.keymaps, { desc = "Search Keymaps" })
nmap("sh", fzf_lua.help_tags, { desc = "Search help" })
-- Automatic sizing of height/width of vim.ui.select
fzf_lua.register_ui_select(function(_, items)
local min_h, max_h = 0.60, 0.80
local h = (#items + 4) / vim.o.lines
if h < min_h then
h = min_h
elseif h > max_h then
h = max_h
end
return { winopts = { height = h, width = 0.80, row = 0.40 } }
end)
end
return M

View file

@ -0,0 +1,47 @@
local M = {
{ "lewis6991/gitsigns.nvim" },
{
"kdheepak/lazygit.nvim",
cmd = {
"LazyGit",
"LazyGitConfig",
"LazyGitCurrentFile",
"LazyGitFilter",
"LazyGitFilterCurrentFile",
},
dependencies = {
"nvim-lua/plenary.nvim",
},
keys = {
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
},
},
{
"ruifm/gitlinker.nvim",
},
}
M.config = function()
require("gitsigns").setup({
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
current_line_blame = true,
signs = {
add = { text = icons.ui.BoldLineMiddle },
change = { text = icons.ui.BoldLineDashedMiddle },
delete = { text = icons.ui.TriangleShortArrowRight },
topdelete = { text = icons.ui.TriangleShortArrowRight },
changedelete = { text = icons.ui.BoldLineMiddle },
},
})
require("gitlinker").setup({
message = false,
console_log = false,
})
nmap("<leader>gy", "<cmd>lua require('gitlinker').get_buf_range_url('n')<cr>")
namp("<leader>gY", "<cmd>lua require('gitlinker').get_buf_range_url('n', 'blame')<cr>")
end
return M

View file

@ -0,0 +1,35 @@
local M = {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
},
}
M.config = function()
local harpoon = require("harpoon")
harpoon:setup({
settings = {
save_on_toggle = true,
sync_on_ui_close = true,
},
})
nmap("<leader>a", function()
harpoon:list():add()
end, { desc = "Harpoon: Append" })
nmap("<leader>h", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = "Harpoon: Toggle Quick Menu" })
for i = 1, 4 do
nmap("<leader>" .. i, function()
harpoon:list():select(i)
end, { desc = "Harpoon: Select " .. i })
end
end
return M

View file

@ -0,0 +1,3 @@
local M = { "ethanholz/nvim-lastplace" }
return M

View file

@ -0,0 +1,44 @@
local M = {
"mfussenegger/nvim-lint",
event = {
"BufReadPre",
"BufNewFile",
},
}
M.config = function()
local lint = require("lint")
lint.linters_by_ft = {
javascript = {
"eslint_d",
},
typescript = {
"eslint_d",
},
javascriptreact = {
"eslint_d",
},
typescriptreact = {
"eslint_d",
},
-- go = {
-- "revive",
-- },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave", "BufEnter" }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
nmap("<leader>ll", function()
lint.try_lint()
end, { desc = "Trigger linting for current file" })
end
return M

View file

@ -0,0 +1,13 @@
return {
"olexsmir/gopher.nvim",
ft = "go",
config = function(_, opts)
require("gopher").setup(opts)
vim.keymap.set("n", "<leader>gmt", ":GoMod tidy<cr>", {
desc = "[Go] Tidy",
})
end,
build = function()
vim.cmd([[silent! GoInstallDeps]])
end,
}

View file

@ -0,0 +1,9 @@
return {
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
}

View file

@ -0,0 +1,10 @@
return {
"yioneko/nvim-vtsls",
dependencies = {
"dmmulroy/ts-error-translator.nvim",
},
config = function()
require("ts-error-translator").setup()
end,
ft = { "typescript", "javascript", "jsx", "tsx", "json" },
}

View file

@ -0,0 +1,139 @@
local M = {
"neovim/nvim-lspconfig",
dependencies = {
"saghen/blink.cmp",
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
require("config.plugins.lsp.extras.lazydev"),
require("config.plugins.lsp.extras.gopher"),
require("config.plugins.lsp.extras.typescript"),
},
}
local function setup_autocommands(client, bufnr)
if client.server_capabilities.documentHighlightProvider then
local group = vim.api.nvim_create_augroup("LSPDocumentHighlight", { clear = true })
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
group = group,
buffer = bufnr,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
group = group,
buffer = bufnr,
callback = vim.lsp.buf.clear_references,
})
end
end
local function setup_keymaps(bufnr)
local keymaps = {
{ "<C-h>", vim.lsp.buf.signature_help, "Signature Help" },
{ "<leader>cw", vim.lsp.buf.rename, "Rename" },
{ "<leader>r", vim.lsp.buf.rename, "Rename" },
{ "vd", vim.diagnostic.open_float, "Open Diagnostics" },
{ "<leader>lr", ":LspRestart<CR>", "Restart LSP" },
{ "<leader>li", ":LspInfo<CR>", "LSP Info" },
}
for _, map in ipairs(keymaps) do
nmap(map[1], map[2], {
buffer = bufnr,
desc = map[3],
})
end
end
local function on_attach(client, bufnr)
setup_autocommands(client, bufnr)
setup_keymaps(bufnr)
end
local BORDER = "rounded"
local handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = BORDER }),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = BORDER }),
}
function M.config()
require("mason").setup({
max_concurrent_installers = 4,
})
-- Ensure all tools are installed
local ensure_installed = {
-- LSP servers
"gopls",
"graphql-language-service-cli",
"html-lsp",
"htmx-lsp",
"json-lsp",
"lua-language-server",
"omnisharp",
"vtsls",
"yaml-language-server",
-- Formatters
"prettierd",
"shfmt",
"stylua",
"latexindent",
-- Additional tools
"eslint_d",
"templ",
}
local registry = require("mason-registry")
for _, tool in ipairs(ensure_installed) do
if not registry.is_installed(tool) then
vim.cmd("MasonInstall " .. tool)
end
end
require("mason-lspconfig").setup({
automatic_installation = true,
ensure_installed = {
"gopls",
"html",
"htmx",
"jsonls",
"lua_ls",
"omnisharp",
"yamlls",
"graphql",
},
handlers = {
function(server_name)
local capabilities = require("blink.cmp").get_lsp_capabilities()
-- Enable folding capabilities
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
local base_opts = {
on_attach = on_attach,
capabilities = capabilities,
handlers = handlers,
flags = {
debounce_text_changes = 150,
},
}
-- Try to load server-specific configuration
local ok, server_opts = pcall(require, "config.plugins.lsp.servers." .. server_name)
if ok then
base_opts = vim.tbl_deep_extend("force", base_opts, server_opts)
end
-- Set up the LSP server
require("lspconfig")[server_name].setup(base_opts)
end,
},
})
end
return M

View file

@ -0,0 +1,15 @@
return {
settings = {
gopls = {
gofumpt = true, -- https://github.com/mvdan/gofumpt a stricter gofmt
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
},
},
},
flags = {
debounce_text_changes = 150, -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md#change-detection
},
}

View file

@ -0,0 +1,3 @@
return {
filetypes = { "html", "templ" },
}

View file

@ -0,0 +1,3 @@
return {
filetypes = { "html", "templ" },
}

View file

@ -0,0 +1,16 @@
return {
settings = {
json = {
schemas = require("schemastore").json.schemas(),
},
},
setup = {
commands = {
Format = {
function()
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line("$"), 0 })
end,
},
},
},
}

View file

@ -0,0 +1,21 @@
return {
settings = {
Lua = {
format = {
enable = false,
},
hint = {
enable = false,
arrayIndex = "Disable", -- "Enable" | "Auto" | "Disable"
await = true,
paramName = "Disable", -- "All" | "Literal" | "Disable"
paramType = true,
semicolon = "All", -- "All" | "SameLine" | "Disable"
setType = false,
},
telemetry = {
enable = false,
},
},
},
}

View file

@ -0,0 +1,7 @@
return {
settings = {
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
},
}

View file

@ -0,0 +1,21 @@
return {
settings = {
yaml = {
schemaStore = {
-- You must disable built-in schemaStore support if you want to use
-- this plugin and its advanced options like `ignore`.
enable = false,
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
url = "",
},
schemas = require("schemastore").yaml.schemas({
-- additional schemas (not in the catalog)
extra = {
url = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json",
name = "Argo CD Application",
fileMatch = "argocd-application.yaml",
},
}),
},
},
}

View file

@ -0,0 +1,20 @@
local M = {
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && yarn install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = { "markdown" },
},
{
"MeanderingProgrammer/render-markdown.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite
opts = {},
},
}
M.config = function() end
return M

View file

@ -0,0 +1,24 @@
return {
"echasnovski/mini.nvim",
config = function()
require("mini.icons").setup()
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
require("mini.ai").setup({ n_lines = 500 })
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require("mini.surround").setup({})
end,
init = function()
package.preload["nvim-web-devicons"] = function()
require("mini.icons").mock_nvim_web_devicons()
return package.loaded["nvim-web-devicons"]
end
end,
}

View file

@ -0,0 +1,19 @@
local M = {
"SmiteshP/nvim-navic",
}
M.config = function()
require("nvim-navic").setup({
icons = icons.kind,
highlight = true,
lsp = {
auto_attach = true,
},
click = true,
separator = " " .. icons.ui.ChevronRight .. " ",
depth_limit = 0,
depth_limit_indicator = "..",
})
end
return M

View file

@ -0,0 +1,93 @@
local M = {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
},
}
M.config = function()
local noice = require("noice")
noice.setup({
routes = {
{
filter = {
event = "msg_show",
any = {
{ find = "%d+L, %d+B" },
{ find = "; after #%d+" },
{ find = "; before #%d+" },
{ find = "%d fewer lines" },
{ find = "%d more lines" },
},
},
opts = { skip = true },
},
},
lsp = {
progress = { enabled = true },
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
hover = { silent = true },
signature = {
auto_open = { throttle = vim.api.nvim_get_option_value("updatetime", { scope = "global" }) },
},
},
cmdline = {
format = {
cmdline = { icon = "" },
search_down = { icon = " " },
search_up = { icon = " " },
},
},
messages = {
enabled = false,
},
popupmenu = { enabled = true },
presets = {
bottom_search = true,
long_message_to_split = true,
lsp_doc_border = true,
},
throttle = 1000,
views = {
split = {
enter = true,
size = "25%",
win_options = {
signcolumn = "no",
number = false,
relativenumber = false,
list = false,
wrap = false,
},
},
popup = { border = { style = "rounded" } },
hover = {
border = { style = "rounded" },
position = { row = 2, col = 2 },
},
mini = {
timeout = 3000,
position = { row = -2 },
border = { style = "rounded" },
win_options = {
winblend = vim.api.nvim_get_option_value("winblend", { scope = "global" }),
},
},
cmdline_popup = { border = { style = "rounded" } },
confirm = {
border = {
style = "rounded",
padding = { 0, 1 },
},
},
},
})
end
return M

View file

@ -0,0 +1,69 @@
local M = {
"stevearc/oil.nvim",
}
M.config = function()
local function max_height()
local height = vim.fn.winheight(0)
if height >= 40 then
return 30
elseif height >= 30 then
return 20
else
return 10
end
end
require("oil").setup({
keymaps = {
["<C-p>"] = false,
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-s>"] = "actions.select_vsplit",
["<C-h>"] = "actions.select_split",
["<C-t>"] = "actions.select_tab",
["<C-c>"] = "actions.close",
["<C-l>"] = "actions.refresh",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["g."] = "actions.toggle_hidden",
},
-- Set to false if you still want to use netrw.
default_file_explorer = true,
delete_to_trash = true,
-- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits)
skip_confirm_for_simple_edits = true,
view_options = {
natural_order = true,
-- Show files and directories that start with "."
show_hidden = false,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name)
local ignore_folders = { "node_modules", "dist", "build", "coverage" }
return vim.startswith(name, ".") or vim.tbl_contains(ignore_folders, name)
end,
wrap = true,
},
-- Configuration for the floating window in oil.open_float
float = {
padding = 2,
max_width = 120,
max_height = max_height(),
border = "rounded",
win_options = {
winblend = 0,
},
},
})
vim.keymap.set("n", "-", function()
require("oil").open()
end)
end
return M

View file

@ -0,0 +1,7 @@
local M = {
"b0o/schemastore.nvim",
}
M.config = function() end
return M

View file

@ -0,0 +1,41 @@
local M = {
"karb94/neoscroll.nvim",
}
M.config = function()
require("neoscroll").setup({
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = { "<C-u>", "<C-d>" },
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends
performance_mode = false, -- Disable "Performance Mode" on all buffers.
})
local neoscroll = require("neoscroll")
local t = {
["<C-u>"] = function()
neoscroll.ctrl_u({ duration = 50 })
end,
["<C-k>"] = function()
neoscroll.ctrl_u({ duration = 50 })
end,
["<C-d>"] = function()
neoscroll.ctrl_d({ duration = 50 })
end,
["<C-j>"] = function()
neoscroll.ctrl_d({ duration = 50 })
end,
}
local modes = { "n", "v", "x" }
for key, func in pairs(t) do
vim.keymap.set(modes, key, func)
end
end
return M

View file

@ -0,0 +1,20 @@
local M = {
"L3MON4D3/LuaSnip",
dependencies = {
"rafamadriz/friendly-snippets",
-- "saadparwaiz1/cmp_luasnip",
},
build = "make install_jsregexp",
}
M.config = function()
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load({ paths = vim.fn.stdpath("config") .. "/lua/plugins/snippets/" })
require("luasnip").config.set_config({
history = true,
updateevents = "TextChanged,TextChangedI",
})
end
return M

View file

@ -0,0 +1,22 @@
local M = {
"nvim-pack/nvim-spectre",
}
M.config = function()
require("spectre").setup()
nmap("<leader>S", '<cmd>lua require("spectre").toggle()<CR>', {
desc = "Toggle Spectre",
})
nmap("<leader>sw", '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', {
desc = "[Spectre] Search current word",
})
nmap("<leader>sw", '<esc><cmd>lua require("spectre").open_visual()<CR>', {
desc = "[Spectre] Search current word",
})
nmap("<leader>sp", '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', {
desc = "[Spectre] Search on current file",
})
end
return M

View file

@ -0,0 +1,66 @@
local M = {
"nvim-lualine/lualine.nvim",
}
function M.config()
local lualine = require("lualine")
local mode = "mode"
local filetype = { "filetype", icon_only = true }
local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn", "info", "hint" },
symbols = {
error = icons.diagnostics.Error,
hint = icons.diagnostics.Hint,
info = icons.diagnostics.Info,
warn = icons.diagnostics.Warning,
},
colored = true,
update_in_insert = false,
always_visible = false,
}
local diff = {
"diff",
source = function()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end,
symbols = {
added = icons.git.LineAdded .. " ",
modified = icons.git.LineModified .. " ",
removed = icons.git.LineRemoved .. " ",
},
colored = true,
always_visible = false,
}
lualine.setup({
options = {
theme = "auto",
globalstatus = true,
section_separators = "",
component_separators = "",
disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } },
},
sections = {
lualine_a = { mode },
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { diff, diagnostics, filetype },
lualine_y = {},
lualine_z = {},
},
})
end
return M

View file

@ -0,0 +1,4 @@
return {
"lambdalisue/suda.vim",
lazy = false,
}

View file

@ -0,0 +1,9 @@
local M = {
"tpope/vim-sleuth",
}
M.config = function()
vim.g.sleuth_automatic = 1
end
return M

View file

@ -0,0 +1,24 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = { "c", "lua", "typescript", "go", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
ignore_install = {},
modules = {},
sync_install = false,
auto_install = false,
highlight = {
enable = true,
disable = function(_, buf)
local max_filesize = 100 * 1024
local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
additional_vim_regex_highlighting = false,
},
})
end,
}

View file

@ -0,0 +1,9 @@
local M = {
"stevearc/dressing.nvim",
}
M.config = function()
require("dressing").setup()
end
return M

View file

@ -0,0 +1,12 @@
local M = {
"mbbill/undotree",
cmd = {
"UndotreeToggle",
},
}
M.config = function()
vim.opt.undodir = vim.fn.expand("~/.config/undodir")
end
return M

91
lua/config/remap.lua Normal file
View file

@ -0,0 +1,91 @@
nmap("<Space>", "")
vim.g.mapleader = " "
vim.g.maplocalleader = " "
nmap("Y", "yy")
nmap("<leader><leader>", "<c-^>", { desc = "Switch to last buffer" })
nmap("<M-h>", ":vertical resize +3<CR>", { desc = "Resize window" })
nmap("<M-l>", ":vertical resize -3<CR>", { desc = "Resize window" })
nmap("<M-k>", ":resize +3<CR>", { desc = "Resize window" })
nmap("<M-j>", ":resize -3<CR>", { desc = "Resize window" })
vim.cmd([[
nnoremap <silent> <C-j> <C-d>
nnoremap <silent> <C-k> <C-u>
]])
nmap("n", "nzz", { desc = "Move to next search match" })
nmap("N", "Nzz", { desc = "Move to previous search match" })
nmap("*", "*zz", { desc = "Move to next search match" })
nmap("#", "#zz", { desc = "Move to previous search match" })
nmap("g*", "g*zz", { desc = "Move to next search match" })
nmap("g#", "g#zz", { desc = "Move to previous search match" })
-- stay in indent mode
vmap("<", "<gv", { desc = "Indent left" })
vmap(">", ">gv", { desc = "Indent right" })
-- keep register after paste
map("x", "p", [["_dP]])
map({ "n", "o", "x" }, "<s-h>", "^", { desc = "Move to first non-blank character" })
map({ "n", "o", "x" }, "<s-l>", "g_", { desc = "Move to last non-blank character" })
nmap("<leader>q", ":q<CR>", { desc = "Quit" })
nmap("<leader>Q", function()
vim.api.nvim_command("bd!|qall!")
end, { desc = "Quit all" })
-- create a user command to save without formatting :noa w
vim.api.nvim_create_user_command("W", function()
-- if buffer is empty, don't save
if vim.fn.empty(vim.fn.expand("%:t")) == 1 then
return vim.notify("Buffer is empty, not saving", vim.log.levels.ERROR)
end
vim.api.nvim_command("noa w")
end, { nargs = 0, desc = "Save without formatting" })
-- move lines
vmap("J", ":m '>+1<CR>gv=gv", { desc = "Move lines down" })
vmap("K", ":m '<-2<CR>gv=gv", { desc = "Move lines up" })
-- undo tree
nmap("<leader>u", vim.cmd.UndotreeToggle)
-- nnoremap yl :let @" = expand("%:p")<cr>
nmap("yl", function()
local file = vim.fn.expand("%:p")
print("Copied path to clipboard: " .. file)
-- copy to os clipboard
vim.fn.setreg("+", file)
end, { desc = "Copy file path to clipboard" })
nmap("<Leader>x", "<cmd>!chmod +x %<cr>", { desc = "Make file executable" })
vim.g.user_emmet_leader_key = ","
nmap("<leader>gp", "<CMD>Git push<CR>", { desc = "Git push" })
-- reset cmdheight
nmap("<leader>ch", function()
vim.o.cmdheight = 1
end, { desc = "Reset cmdheight" })
nmap("<leader>w", function()
vim.api.nvim_command("w")
end, { desc = "Save" })
nmap("<leader>W", function()
vim.api.nvim_command("wa")
end, { desc = "Save all" })
-- format json using jq
nmap("<leader>jq", ":%!jq '.'<CR>", { desc = "Format json using jq" })
vmap("<leader>jq", ":!jq '.'<CR>", { desc = "Format json using jq" })
-- Navigate quickfix list
nmap("qj", "<cmd>cnext<cr>", { desc = "Next quickfix item" })
nmap("qk", "<cmd>cprev<cr>", { desc = "Previous quickfix item" })
nmap("<Esc>", "<cmd>nohlsearch<CR>", { desc = "Clear search highlights" })

177
lua/config/utils.lua Normal file
View file

@ -0,0 +1,177 @@
_G.map = function(mode, keys, func, opts)
opts = opts or {}
opts.desc = opts.desc or nil
vim.keymap.set(mode, keys, func, opts)
end
_G.nmap = function(keys, func, opts)
_G.map("n", keys, func, opts)
end
_G.imap = function(keys, func, opts)
_G.map("i", keys, func, opts)
end
_G.vmap = function(keys, func, opts)
_G.map("v", keys, func, opts)
end
_G.icons = {
kind = {
Array = "",
Boolean = "",
Class = "",
Color = "",
Constant = "",
Constructor = "",
Enum = "",
EnumMember = "",
Event = "",
Field = "",
File = "",
Folder = "󰉋 ",
Function = "",
Interface = "",
Key = "",
Keyword = "",
Method = "",
-- Module = " ",
Module = "",
Namespace = "",
Null = "󰟢 ",
Number = "",
Object = "",
Operator = "",
Package = "",
Property = "",
Reference = "",
Snippet = "",
String = "",
Struct = "",
Text = "",
TypeParameter = "",
Unit = "",
Value = "",
Variable = "",
},
git = {
LineAdded = "",
LineModified = "",
LineRemoved = "",
FileDeleted = "",
FileIgnored = "",
FileRenamed = "",
FileStaged = "S",
FileUnmerged = "",
FileUnstaged = "",
FileUntracked = "U",
Diff = "",
Repo = "",
Octoface = "",
Copilot = "",
Branch = "",
},
ui = {
Message = "󰍡 ",
ArrowCircleDown = "",
ArrowCircleLeft = "",
ArrowCircleRight = "",
ArrowCircleUp = "",
BoldArrowDown = "",
BoldArrowLeft = "",
BoldArrowRight = "",
BoldArrowUp = "",
BoldClose = "",
BoldDividerLeft = "",
BoldDividerRight = "",
BoldLineLeft = "",
BoldLineMiddle = "",
BoldLineDashedMiddle = "",
BookMark = "",
BoxChecked = "",
Bug = "",
Stacks = "",
Scopes = "",
Watches = "󰂥",
DebugConsole = "",
Calendar = "",
Check = "",
ChevronRight = "",
ChevronShortDown = "",
ChevronShortLeft = "",
ChevronShortRight = "",
ChevronShortUp = "",
Circle = "",
Close = "󰅖",
CloudDownload = "",
Code = "",
Comment = "",
Dashboard = "",
DividerLeft = "",
DividerRight = "",
DoubleChevronRight = "»",
Ellipsis = "",
EmptyFolder = "",
EmptyFolderOpen = "",
File = "",
FileSymlink = "",
Files = "",
FindFile = "󰈞",
FindText = "󰊄",
Fire = "",
Folder = "󰉋 ",
FolderOpen = "",
FolderSymlink = "",
Forward = "",
Gear = "",
History = "",
Lightbulb = "",
LineLeft = "",
LineMiddle = "",
List = "",
Lock = "",
NewFile = " ",
Note = "",
Package = "",
Pencil = "󰏫 ",
Plus = "",
Project = "",
Search = "",
SignIn = "",
SignOut = "",
Tab = "󰌒 ",
Table = "",
Target = "󰀘 ",
Telescope = "🔭",
Text = "",
Tree = "",
Triangle = "󰐊",
TriangleShortArrowDown = "",
TriangleShortArrowLeft = "",
TriangleShortArrowRight = "",
TriangleShortArrowUp = "",
},
diagnostics = {
BoldError = "",
Error = "",
BoldWarning = "",
Warning = "",
BoldInformation = "",
Information = "",
BoldQuestion = "",
Question = "",
BoldHint = "",
Hint = "󰌶",
Debug = "",
Trace = "",
},
misc = {
Robot = "󰚩 ",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}