diff --git a/.envrc b/.envrc
deleted file mode 100644
index a1d3540..0000000
--- a/.envrc
+++ /dev/null
@@ -1 +0,0 @@
-use flake . -Lv
diff --git a/.gitignore b/.gitignore
index 7a8b6a5..cece139 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
-result
-.direnv
+tags
.luarc.json
+/result
diff --git a/.stylua.toml b/.stylua.toml
index 49b29eb..139e939 100644
--- a/.stylua.toml
+++ b/.stylua.toml
@@ -1,10 +1,6 @@
-column_width = 80
+column_width = 160
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
-call_parentheses = "Always"
-collapse_simple_statement = "Never"
-
-[sort_requires]
-enabled = true
+call_parentheses = "None"
diff --git a/Justfile b/Justfile
deleted file mode 100644
index 5f083b6..0000000
--- a/Justfile
+++ /dev/null
@@ -1,23 +0,0 @@
-alias d := dev
-dev:
- nix develop
-
-alias t := test
-test:
- git aa && nix run .
-
-alias to := testone
-testone:
- git aa && nix run . -- flake.nix
-
-alias tt := testtwo
-testtwo:
- git aa && nix run . -- flake.nix .stylua.toml
-
-alias tl := testlua
-testlua:
- git aa && nix run . -- nvim/lua/autocmds.lua
-
-alias s := search
-search this:
- nh search {{this}}
diff --git a/README.md b/README.md
index 54fb994..44811d4 100644
--- a/README.md
+++ b/README.md
@@ -1,332 +1,5 @@
-
-
-
❄️
-- - A dead simple Nix flake template repository - for Neovim - -
+# LazyVim distribution -[![Neovim][neovim-shield]][neovim-url] -[![Nix][nix-shield]][nix-url] -[![Lua][lua-shield]][lua-url] +How to get the [LazyVim](http://www.lazyvim.org/) distribution up and running -[![GPL2 License][license-shield]][license-url] -[![Issues][issues-shield]][issues-url] -', - group = augroup('close_with_q'), - pattern = { - 'PlenaryTestPopup', - 'checkhealth', - 'dbout', - 'gitsigns-blame', - 'grug-far', - 'help', - 'lspinfo', - 'neotest-output', - 'neotest-output-panel', - 'neotest-summary', - 'notify', - 'qf', - 'snacks_win', - 'spectre_panel', - 'startuptime', - 'tsplayground', - }, - callback = function(event) - vim.bo[event.buf].buflisted = false - - vim.schedule(function() - vim.keymap.set({ 'n' }, 'q', function() - vim.cmd('close') - pcall(vim.api.nvim_buf_delete, event.buf, { force = true }) - end, { - desc = 'Quit buffer', - buffer = event.buf, - silent = true, - }) - end) - end, -}) - -autocmd({ 'FileType' }, { - desc = 'Make it easier to close man-files', - group = augroup('man_unlisted'), - pattern = { 'man' }, - callback = function(event) - vim.bo[event.buf].buflisted = false - end, -}) - -autocmd({ 'FileType' }, { - desc = 'Fix conceallevel for JSON files', - group = augroup('json_conceal'), - pattern = { 'json', 'jsonc', 'json5' }, - callback = function() - vim.opt_local.conceallevel = 0 - end, -}) - -autocmd({ 'BufWritePre' }, { - desc = 'Auto create missing directories when saving a file', - group = augroup('auto_create_dir'), - callback = function(event) - if event.match:match('^%w%w+:[\\/][\\/') then - return - end - - local file = vim.uv.fs_realpath(event.match) or event.match - - vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p') - end, -}) - -autocmd({ 'BufWinEnter' }, { - desc = 'Open help files in vertical split to the right', - group = augroup('help_window_right'), - pattern = { '*.txt' }, - callback = function() - if vim.o.filetype == 'help' then - vim.cmd.wincmd('L') - end - end, -}) diff --git a/nvim/lua/colors.lua b/nvim/lua/colors.lua deleted file mode 100644 index 0a39f22..0000000 --- a/nvim/lua/colors.lua +++ /dev/null @@ -1,381 +0,0 @@ ----@class colors ----@field tailwind colors.tailwind ----@field [string] colorNames -local M = {} - ----@alias colorNames "azure" | "blue" | "cyan" | "green" | "grey" | "orange" | "purple" | "red" | "yellow" - ----@type {[string]:colorNames} -M.colors = { - around = 'purple', - buffers = 'cyan', - change = 'cyan', - delete = 'red', - diagnostics = 'green', - explorer = 'yellow', - fold = 'purple', - format = 'purple', - git = 'orange', - go_to = 'cyan', - inner = 'purple', - notifications = 'orange', - replace = 'blue', - search = 'green', - sessions = 'azure', - spell = 'red', - surround = 'purple', - ui = 'green', - visual = 'purple', - window = 'blue', - yank = 'yellow', -} - ----@class colorSteps ----@field [50] string ----@field [100] string ----@field [200] string ----@field [300] string ----@field [400] string ----@field [500] string ----@field [600] string ----@field [700] string ----@field [800] string ----@field [900] string ----@field [950] string - ----@class colors.tailwind ----@field slate colorSteps ----@field gray colorSteps ----@field zinc colorSteps ----@field neutral colorSteps ----@field stone colorSteps ----@field red colorSteps ----@field orange colorSteps ----@field amber colorSteps ----@field yellow colorSteps ----@field lime colorSteps ----@field green colorSteps ----@field emerald colorSteps ----@field teal colorSteps ----@field cyan colorSteps ----@field sky colorSteps ----@field blue colorSteps ----@field indigo colorSteps ----@field violet colorSteps ----@field purple colorSteps ----@field fuchsia colorSteps ----@field pink colorSteps ----@field rose colorSteps - ----@type colors.tailwind -M.tailwind = { - slate = { - [50] = 'f8fafc', - [100] = 'f1f5f9', - [200] = 'e2e8f0', - [300] = 'cbd5e1', - [400] = '94a3b8', - [500] = '64748b', - [600] = '475569', - [700] = '334155', - [800] = '1e293b', - [900] = '0f172a', - [950] = '020617', - }, - - gray = { - [50] = 'f9fafb', - [100] = 'f3f4f6', - [200] = 'e5e7eb', - [300] = 'd1d5db', - [400] = '9ca3af', - [500] = '6b7280', - [600] = '4b5563', - [700] = '374151', - [800] = '1f2937', - [900] = '111827', - [950] = '030712', - }, - - zinc = { - [50] = 'fafafa', - [100] = 'f4f4f5', - [200] = 'e4e4e7', - [300] = 'd4d4d8', - [400] = 'a1a1aa', - [500] = '71717a', - [600] = '52525b', - [700] = '3f3f46', - [800] = '27272a', - [900] = '18181b', - [950] = '09090B', - }, - - neutral = { - [50] = 'fafafa', - [100] = 'f5f5f5', - [200] = 'e5e5e5', - [300] = 'd4d4d4', - [400] = 'a3a3a3', - [500] = '737373', - [600] = '525252', - [700] = '404040', - [800] = '262626', - [900] = '171717', - [950] = '0a0a0a', - }, - - stone = { - [50] = 'fafaf9', - [100] = 'f5f5f4', - [200] = 'e7e5e4', - [300] = 'd6d3d1', - [400] = 'a8a29e', - [500] = '78716c', - [600] = '57534e', - [700] = '44403c', - [800] = '292524', - [900] = '1c1917', - [950] = '0a0a0a', - }, - - red = { - [50] = 'fef2f2', - [100] = 'fee2e2', - [200] = 'fecaca', - [300] = 'fca5a5', - [400] = 'f87171', - [500] = 'ef4444', - [600] = 'dc2626', - [700] = 'b91c1c', - [800] = '991b1b', - [900] = '7f1d1d', - [950] = '450a0a', - }, - - orange = { - [50] = 'fff7ed', - [100] = 'ffedd5', - [200] = 'fed7aa', - [300] = 'fdba74', - [400] = 'fb923c', - [500] = 'f97316', - [600] = 'ea580c', - [700] = 'c2410c', - [800] = '9a3412', - [900] = '7c2d12', - [950] = '431407', - }, - - amber = { - [50] = 'fffbeb', - [100] = 'fef3c7', - [200] = 'fde68a', - [300] = 'fcd34d', - [400] = 'fbbf24', - [500] = 'f59e0b', - [600] = 'd97706', - [700] = 'b45309', - [800] = '92400e', - [900] = '78350f', - [950] = '451a03', - }, - - yellow = { - [50] = 'fefce8', - [100] = 'fef9c3', - [200] = 'fef08a', - [300] = 'fde047', - [400] = 'facc15', - [500] = 'eab308', - [600] = 'ca8a04', - [700] = 'a16207', - [800] = '854d0e', - [900] = '713f12', - [950] = '422006', - }, - - lime = { - [50] = 'f7fee7', - [100] = 'ecfccb', - [200] = 'd9f99d', - [300] = 'bef264', - [400] = 'a3e635', - [500] = '84cc16', - [600] = '65a30d', - [700] = '4d7c0f', - [800] = '3f6212', - [900] = '365314', - [950] = '1a2e05', - }, - - green = { - [50] = 'f0fdf4', - [100] = 'dcfce7', - [200] = 'bbf7d0', - [300] = '86efac', - [400] = '4ade80', - [500] = '22c55e', - [600] = '16a34a', - [700] = '15803d', - [800] = '166534', - [900] = '14532d', - [950] = '052e16', - }, - - emerald = { - [50] = 'ecfdf5', - [100] = 'd1fae5', - [200] = 'a7f3d0', - [300] = '6ee7b7', - [400] = '34d399', - [500] = '10b981', - [600] = '059669', - [700] = '047857', - [800] = '065f46', - [900] = '064e3b', - [950] = '022c22', - }, - - teal = { - [50] = 'f0fdfa', - [100] = 'ccfbf1', - [200] = '99f6e4', - [300] = '5eead4', - [400] = '2dd4bf', - [500] = '14b8a6', - [600] = '0d9488', - [700] = '0f766e', - [800] = '115e59', - [900] = '134e4a', - [950] = '042f2e', - }, - - cyan = { - [50] = 'ecfeff', - [100] = 'cffafe', - [200] = 'a5f3fc', - [300] = '67e8f9', - [400] = '22d3ee', - [500] = '06b6d4', - [600] = '0891b2', - [700] = '0e7490', - [800] = '155e75', - [900] = '164e63', - [950] = '083344', - }, - - sky = { - [50] = 'f0f9ff', - [100] = 'e0f2fe', - [200] = 'bae6fd', - [300] = '7dd3fc', - [400] = '38bdf8', - [500] = '0ea5e9', - [600] = '0284c7', - [700] = '0369a1', - [800] = '075985', - [900] = '0c4a6e', - [950] = '082f49', - }, - - blue = { - [50] = 'eff6ff', - [100] = 'dbeafe', - [200] = 'bfdbfe', - [300] = '93c5fd', - [400] = '60a5fa', - [500] = '3b82f6', - [600] = '2563eb', - [700] = '1d4ed8', - [800] = '1e40af', - [900] = '1e3a8a', - [950] = '172554', - }, - - indigo = { - [50] = 'eef2ff', - [100] = 'e0e7ff', - [200] = 'c7d2fe', - [300] = 'a5b4fc', - [400] = '818cf8', - [500] = '6366f1', - [600] = '4f46e5', - [700] = '4338ca', - [800] = '3730a3', - [900] = '312e81', - [950] = '1e1b4b', - }, - - violet = { - [50] = 'f5f3ff', - [100] = 'ede9fe', - [200] = 'ddd6fe', - [300] = 'c4b5fd', - [400] = 'a78bfa', - [500] = '8b5cf6', - [600] = '7c3aed', - [700] = '6d28d9', - [800] = '5b21b6', - [900] = '4c1d95', - [950] = '2e1065', - }, - - purple = { - [50] = 'faf5ff', - [100] = 'f3e8ff', - [200] = 'e9d5ff', - [300] = 'd8b4fe', - [400] = 'c084fc', - [500] = 'a855f7', - [600] = '9333ea', - [700] = '7e22ce', - [800] = '6b21a8', - [900] = '581c87', - [950] = '3b0764', - }, - - fuchsia = { - [50] = 'fdf4ff', - [100] = 'fae8ff', - [200] = 'f5d0fe', - [300] = 'f0abfc', - [400] = 'e879f9', - [500] = 'd946ef', - [600] = 'c026d3', - [700] = 'a21caf', - [800] = '86198f', - [900] = '701a75', - [950] = '4a044e', - }, - - pink = { - [50] = 'fdf2f8', - [100] = 'fce7f3', - [200] = 'fbcfe8', - [300] = 'f9a8d4', - [400] = 'f472b6', - [500] = 'ec4899', - [600] = 'db2777', - [700] = 'be185d', - [800] = '9d174d', - [900] = '831843', - [950] = '500724', - }, - - rose = { - [50] = 'fff1f2', - [100] = 'ffe4e6', - [200] = 'fecdd3', - [300] = 'fda4af', - [400] = 'fb7185', - [500] = 'f43f5e', - [600] = 'e11d48', - [700] = 'be123c', - [800] = '9f1239', - [900] = '881337', - [950] = '4c0519', - }, -} - -return M diff --git a/nvim/lua/icons.lua b/nvim/lua/icons.lua deleted file mode 100644 index cb7f6cc..0000000 --- a/nvim/lua/icons.lua +++ /dev/null @@ -1,95 +0,0 @@ -return { - around = '', - bottom = '', - center = '', - change = '', - char = '', - comment = '', - dashboard = { - quit = '', - mru = '', - project = '', - }, - delete = '', - diagnostics = { - Error = '', - Warn = '', - Hint = '', - Info = '', - }, - explorer = '', - first = '', - fold = '', - format = '', - git = { - added = ' ', - modified = ' ', - removed = ' ', - unstaged = '', - staged = '', - diff = '', - }, - go_to = '', - indent = { - left = '', - decrease = '', - right = '', - increase = '', - }, - inner = '', - last = '', - lazygit = '', - left = '', - lsp = { - Array = '', - Boolean = '◩', - Class = '', - Color = '', - Control = '', - Constant = '', - Constructor = '', - Enum = '', - EnumMember = '', - Event = '', - Field = '', - File = '', - Folder = '', - Function = '', - Interface = '', - Key = '', - Keyword = '', - Method = '', - Module = '', - Namespace = '', - Null = '', - Number = '', - Object = '', - Operator = '', - Package = '', - Property = '', - Reference = '', - Snippet = '', - String = '', - Struct = '', - Text = '', - TypeParameter = '', - Unit = '', - Value = '', - Variable = '', - }, - next = '', - notifications = '', - prev = '', - registers = '', - replace = '', - right = '', - sessions = '', - spell = '', - search = '', - top = '', - ui = '', - undo = '', - visual = '', - word = '', - yank = '', -} diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua deleted file mode 100644 index ab1cae5..0000000 --- a/nvim/lua/keymaps.lua +++ /dev/null @@ -1,207 +0,0 @@ -local g = vim.g -local set = vim.keymap.set -local f = string.format - -g.mapleader = ' ' -g.maplocalleader = '\\' - --- Disable arrow key movement -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for _, key in ipairs({ '', ' ', ' ', ' ' }) do - set({ 'n', 'i' }, key, ' ') -end - --- Better up/down -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for dir, key in pairs({ Down = 'j', Up = 'k' }) do - set( - { 'n', 'x' }, - key, - f("v:count == 0 ? 'g%s' : '%s'", key, key), - { desc = dir, expr = true, silent = true } - ) -end - --- Resize windows -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for key, dir in pairs({ - Up = 'increase', - Down = 'decrease', - Left = 'decrease', - Right = 'increase', -}) do - local sign = (dir == 'increase') and '+' or '-' - - set( - { 'n' }, - f(' ', key), - f(' resize %s4 ', sign), - { desc = f('%s window height', dir) } - ) -end - --- Buffers -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for key, dir in pairs({ - [' '] = 'previous', - [' '] = 'next', - ['[b'] = 'previous', - [']b'] = 'next', -}) do - -- previous -> prev - local prettyDir = dir:sub(1, 4) - - set( - { 'n' }, - key, - f(' b%s ', dir), - { desc = f('%s buffer', prettyDir) } - ) -end - -set({ 'n' }, ' bD', ' bd ', { desc = 'delete buffer and window' }) - --- Clear search & refresh -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -set( - { 'n', 'i' }, - ' ', - ' noh ', - { desc = 'escape and clear hlsearch' } -) - -set( - { 'n' }, - ' ur', - ' nohlsearch diffupdate normal! ', - { desc = 'redraw / clear hlsearch / diff update' } -) - --- Better n & N -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for _, mode in ipairs({ 'n', 'x', 'o' }) do - local zv = (mode == 'n') and ".'zv'" or '' - - set( - { mode }, - 'n', - f("'Nn'[v:searchforward]%s", zv), - { desc = 'next search result', expr = true } - ) - - set( - { mode }, - 'N', - f("'nN'[v:searchforward]%s", zv), - { desc = 'previous search result', expr = true } - ) -end - --- Undo break-points -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for _, char in ipairs({ ',', '.', ';' }) do - set({ 'i' }, char, f('%s u', char)) -end - --- Search docs (keywordprog) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- https://til.codeinthehole.com/posts/about-how-to-use-keywordprg-effectively/ -set( - { 'n' }, - ' K', - ' norm! K ', - { desc = 'search for word' } -) - --- Better indenting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for _, char in ipairs({ '<', '>' }) do - local desc = 'indent ' .. (char == '<' and 'left' or 'right') - - set({ 'v' }, char, f('%sgv', char), { desc = desc }) -end - --- Commenting -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for key, dir in pairs({ o = 'below', O = 'above' }) do - set( - { 'n' }, - f('gc%s', key), - f('%s Vcx normal gcc fxa ', key), - { desc = f('add comment %s', dir) } - ) -end - --- New files -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -set({ 'n' }, ' fn', ' enew ', { desc = 'new file' }) - --- Locations/quickfixes -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -set({ 'n' }, ' xl', ' lopen ', { desc = 'location list' }) -set({ 'n' }, ' xq', ' copen ', { desc = 'quickfix list' }) - -for key, dir in pairs({ ['['] = 'previous', [']'] = 'next' }) do - -- previous -> prev - local cmd = dir:sub(1, 4) - - set( - { 'n' }, - f('%sq', key), - f(' c%s ', cmd), - { desc = f('%s quickfix', dir) } - ) -end - --- Diagnostics -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -set({ 'n' }, ' cd', function() - vim.diagnostic.open_float() -end, { desc = 'line diagnostics' }) - -local function goto_diagnostic(next, severity) - local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev - severity = severity and vim.diagnostic.severity[severity] or nil - return function() - go({ severity = severity }) - end -end - -for key, sev in pairs({ - d = { nil, 'diagnostic' }, - e = { 'ERROR', 'error' }, - w = { 'WARN', 'warning' }, -}) do - set( - { 'n' }, - f(']%s', key), - goto_diagnostic(true, sev[1]), - { desc = f('next %s', sev[2]) } - ) - - set( - { 'n' }, - f('[%s', key), - goto_diagnostic(false, sev[1]), - { desc = f('previous %s', sev[2]) } - ) -end - --- Quit -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -set({ 'n' }, ' qq', ' qa ', { desc = 'quit all' }) - --- Inspect -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -set({ 'n' }, ' ui', vim.show_pos, { desc = 'inspect position' }) - --- Window management -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -set({ 'n' }, ' w', ' ', { desc = 'windows', remap = true }) -set({ 'n' }, ' -', ' s', { desc = 'split below', remap = true }) -set({ 'n' }, ' |', ' v', { desc = 'split right', remap = true }) -set({ 'n' }, ' wd', ' c', { desc = 'delete window', remap = true }) - --- Tab management -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -for key, act in pairs({ - l = 'last', - o = 'only', - f = 'first', - [' '] = 'new', - [']'] = 'next', - d = 'close', - ['['] = 'previous', -}) do - local desc = (act == 'only') and 'close other tabs' or f('%s tab', act) - - set( - { 'n' }, - f(' %s', key), - f(' tab%s ', act:lower()), - { desc = desc } - ) -end diff --git a/nvim/lua/lib/init.lua b/nvim/lua/lib/init.lua deleted file mode 100644 index 164a9ba..0000000 --- a/nvim/lua/lib/init.lua +++ /dev/null @@ -1,53 +0,0 @@ ----@class lib -local M = {} - -M.lsp = require('lib.lsp') -M.prettier = require('lib.prettier') - ----Find the root of a project based on `vim.g.root_spec`. Defaults to ----`{ '.git' }` if unset. ----@return string? -function M.root() - local root_spec = vim.g.root_spec or { '.git' } - - return vim.fs.root(0, root_spec) -end - ----Require a file relative to the given prefix, to avoid repetition. ----@param prefix string The string to prefix to all req calls. -function M.local_require(prefix) - ---@param mod string The module to require. - return function(mod) - return require(prefix .. '.' .. mod) - end -end - ----Get and format the foreground of a highlight group. ----@param name string The highlight group name to fetch from. ----@return {fg:string}? -function M.fg(name) - local hl = vim.api.nvim_get_hl(0, { name = name, link = false }) - - return hl and { fg = string.format('#%06x', hl.fg) } or nil -end - ----Generates a function that can be used to create which-key mappings. ----@param color string The color to use for the icon. ----@return function -function M.wkSpec(color) - ---@param lhs string - ---@param rhs string | fun() - ---@param icon string | wk.Icon - ---@param opts? wk.Spec - return function(lhs, rhs, icon, opts) - if type(icon) == 'string' then - icon = { icon = icon, color = color } - else - icon = vim.tbl_deep_extend('force', icon, { color = color }) - end - - return vim.tbl_deep_extend('force', { lhs, rhs, icon = icon }, (opts or {})) - end -end - -return M diff --git a/nvim/lua/lib/lsp.lua b/nvim/lua/lib/lsp.lua deleted file mode 100644 index ead14c1..0000000 --- a/nvim/lua/lib/lsp.lua +++ /dev/null @@ -1,20 +0,0 @@ ----@class lib.lsp -local M = {} - ----Boilerplate to create an autocommand to do something on LspAttach. ----@param callback fun(client:vim.lsp.Client, buffer:number) ----@param name? string -function M.on_attach(callback, name) - return vim.api.nvim_create_autocmd('LspAttach', { - callback = function(args) - local buffer = args.buf ---@type number - local client = vim.lsp.get_client_by_id(args.data.client_id) - - if client and (not name or client.name == name) then - return callback(client, buffer) - end - end, - }) -end - -return M diff --git a/nvim/lua/lib/prettier.lua b/nvim/lua/lib/prettier.lua deleted file mode 100644 index ee7eb53..0000000 --- a/nvim/lua/lib/prettier.lua +++ /dev/null @@ -1,54 +0,0 @@ ----@class lib.prettier -local M = {} - ----@alias ConformCtx {buf: number, filename: string, dirname: string} - -M.supported = { - 'css', - 'graphql', - 'handlebars', - 'html', - 'javascript', - 'javascriptreact', - 'json', - 'jsonc', - 'less', - 'markdown', - 'markdown.mdx', - 'scss', - 'typescript', - 'typescriptreact', - 'vue', - 'yaml', -} - ----Check if a parser exists for the given context. ----@param ctx ConformCtx -function M.has_parser(ctx) - local ft = vim.bo[ctx.buf].filetype --[[@as string]] - - -- Default filetypes are always supported. - if vim.tbl_contains(M.supported, ft) then - return true - end - - -- Otherwise, check if a parser can be inferred. - local inferred = vim.fn.system({ 'prettier', '--file-info', ctx.filename }) - - ---@type boolean, string? - local ok, parser = pcall(function() - return vim.fn.json_decode(inferred).inferredParser - end) - - return ok and parser and parser ~= vim.NIL -end - ----Check if a Prettier config file exists in the current context. ----@param ctx ConformCtx -function M.has_config(ctx) - vim.fn.system({ 'prettier', '--find-config-path', ctx.filename }) - - return vim.v.shell_error == 0 -end - -return M diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua deleted file mode 100644 index 040c6a0..0000000 --- a/nvim/lua/lsp.lua +++ /dev/null @@ -1,181 +0,0 @@ -local i = require('icons') - --- Diagnostics -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----@type vim.diagnostic.Opts -local diagnosticConfig = { - underline = true, - update_in_insert = true, - virtual_text = { - spacing = 4, - source = 'if_many', - prefix = function(diagnostic) - for d, icon in pairs(i.diagnostics) do - if diagnostic.severity == vim.diagnostic.severity[d:upper()] then - return icon - end - end - - return '' - end, - }, - severity_sort = true, - signs = { - text = { - [vim.diagnostic.severity.ERROR] = i.diagnostics.Error, - [vim.diagnostic.severity.WARN] = i.diagnostics.Warn, - [vim.diagnostic.severity.HINT] = i.diagnostics.Hint, - [vim.diagnostic.severity.INFO] = i.diagnostics.Info, - }, - }, -} - -for severity, icon in pairs(diagnosticConfig.signs.text) do - local name = - vim.diagnostic.severity[severity]:lower():gsub('^%l', string.upper) - name = 'DiagnosticSign' .. name - - vim.fn.sign_define(name, { text = icon, texthl = name, numhl = '' }) -end - -vim.diagnostic.config(diagnosticConfig) - --- Codelens -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -vim.api.nvim_create_autocmd('User', { - pattern = 'LspSupportsMethod', - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - local buffer = args.data.buffer - - if client and args.data.method == 'textDocument/codeLens' then - vim.lsp.codelens.refresh() - - vim.api.nvim_create_autocmd({ 'BufEnter', 'CursorHold', 'InsertLeave' }, { - buffer = buffer, - callback = vim.lsp.codelens.refresh, - }) - end - end, -}) - --- Server Setup -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -local has_blink, blink = pcall(require, 'blink.cmp') -local capabilities = vim.tbl_deep_extend( - 'force', - {}, - vim.lsp.protocol.make_client_capabilities(), - has_blink and blink.get_lsp_capabilities() or {}, - { - workspace = { - fileOperations = { - didRename = true, - willRename = true, - }, - }, - } -) - -vim.lsp.config('*', { - root_markers = { '.git' }, - capabilities = capabilities, -}) - -vim.lsp.enable({ - 'bash-language-server', - 'emmet-language-server', - 'lua-language-server', - 'nil', - -- 'nixd', - 'phpactor', - 'stylelint-lsp', - 'taplo', - 'vscode-css-language-server', - 'vscode-html-language-server', -}) - --- Keymaps -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -MarleyVim.lsp.on_attach(function(client) - local set = vim.keymap.set - - set('n', 'gD', vim.lsp.buf.declaration, { desc = 'declaration' }) - set('n', 'gI', vim.lsp.buf.implementation, { desc = 'implementation' }) - - set('n', 'gr', vim.lsp.buf.references, { desc = 'references', nowait = true }) - - set('n', 'gy', vim.lsp.buf.type_definition, { desc = 'type definition' }) - - set('n', 'K', function() - return vim.lsp.buf.hover() - end, { desc = 'hover' }) - - if client.supports_method('textDocument/codeAction') then - set( - { 'n', 'v' }, - ' ca', - vim.lsp.buf.code_action, - { desc = 'code action' } - ) - end - - if client.supports_method('textDocument/codeLens') then - set( - { 'n', 'v' }, - ' cc', - vim.lsp.codelens.run, - { desc = 'run codelens' } - ) - - set( - 'n', - ' cC', - vim.lsp.codelens.refresh, - { desc = 'refresh & display codelens' } - ) - end - - if client.supports_method('textDocument/definition') then - set('n', 'gd', vim.lsp.buf.definition, { desc = 'definition' }) - end - - if client.supports_method('textDocument/documentHighlight') then - if Snacks.words.is_enabled() then - set('n', ' ', function() - Snacks.words.jump(vim.v.count1, true) - end, { desc = 'next reference' }) - - set('n', ' ', function() - Snacks.words.jump(-vim.v.count1, true) - end, { desc = 'prev reference' }) - - set('n', ']]', function() - Snacks.words.jump(vim.v.count1) - end, { desc = 'next reference' }) - - set('n', '[[', function() - Snacks.words.jump(-vim.v.count1) - end, { desc = 'prev reference' }) - end - end - - if client.supports_method('textDocument/rename') then - set('n', ' cr', vim.lsp.buf.rename, { desc = 'rename' }) - end - - if client.supports_method('textDocument/signatureHelp') then - set('i', ' ', function() - return vim.lsp.buf.signature_help() - end, { desc = 'signature help' }) - - set('n', 'gK', function() - vim.lsp.buf.signature_help() - end, { desc = 'signature help' }) - end - - if - client.supports_method('workspace/didRenameFiles') - or client.supports_method('workspace/willRenameFiles') - then - set('n', ' cR', function() - Snacks.rename.rename_file() - end, { desc = 'rename file' }) - end -end) diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua deleted file mode 100644 index dfea37a..0000000 --- a/nvim/lua/options.lua +++ /dev/null @@ -1,135 +0,0 @@ -local g = vim.g -local opt = vim.opt - --- Root dir detection options. --- Each entry can be a pattern `.git` or `package.json` -g.root_spec = { '.git', 'package.json' } - --- Only set clipboard if not in SSH, to make sure the OSC 52 integration works --- automatically. Requires Neovim >= 0.10.0. --- `unnamedplus` is the system clipboard. -opt.clipboard = vim.env.SSH_TTY and '' or 'unnamedplus' - --- Relative line numbers. -opt.number = true -opt.relativenumber = true - --- Set to 2 spaces. -opt.expandtab = true -opt.shiftwidth = 2 -opt.tabstop = 2 - --- Smart/auto indenting. -opt.shiftround = true -opt.smartindent = true -opt.breakindent = true - --- Show matches in real time while searching. -opt.hlsearch = true -opt.incsearch = true - --- Disable text wrap. -opt.wrap = false - --- Better splitting. -opt.splitbelow = true -opt.splitright = true - --- Enable mouse mode. -opt.mouse = 'a' - --- Smart handling of case when searching. -opt.ignorecase = true -opt.smartcase = true - --- Use Ripgrep for searching. -opt.grepprg = 'rg --vimgrep' -opt.grepformat = '%f:%l:%c:%m' - --- More frequent swap file saving. -opt.updatetime = 200 - --- Completion options. -opt.completeopt = { 'menu', 'menuone', 'noselect', 'noinsert' } - --- Persistant & bigger undo history. -opt.undofile = true -opt.undolevels = 10000 - --- Enable 24-bit colors. -opt.termguicolors = true - --- Always show the signcolumn to keep the text from jumping. -opt.signcolumn = 'yes' - --- Highlight the current line. -opt.cursorline = true - --- Fold settings. -opt.foldcolumn = '1' -opt.foldlevel = 99 -opt.foldenable = true -opt.foldmethod = 'expr' -opt.foldexpr = 'nvim_treesitter#foldexpr()' -opt.foldtext = '' - --- Always keep 4 lines above/below cursor. -opt.scrolloff = 4 - --- Max width. -opt.textwidth = 80 -opt.colorcolumn = '+1' - --- Show some invisible chars. -opt.list = true -opt.listchars = { tab = '->', trail = '·' } - --- Only show a single statusline instead of one for each window. -opt.laststatus = 3 - --- Preview subsitutions as you type. -opt.inccommand = 'split' - --- Ask to save changes before exiting modified buffer. -opt.confirm = true - --- I don't understand this but LazyVim sets it and it seems like a good idea. -opt.jumpoptions = 'view' - --- Enable a little transparency for pop-ups. -opt.pumblend = 10 - --- Disable default line/col numbers in statusline. -opt.ruler = false - --- What to save when calling :mksession. -opt.sessionoptions = { - 'buffers', - 'curdir', - 'tabpages', - 'winsize', - 'help', - 'globals', - 'skiprtp', - 'folds', -} - --- Scrolling. -opt.smoothscroll = true -opt.sidescroll = 1 -opt.sidescrolloff = 8 - --- Spelling suggestions language. -opt.spelllang = { 'en' } - --- Allow cursor to move where there is no text in visual block mode. -opt.virtualedit = 'block' - --- Command mode completion mode. -opt.wildmode = { 'longest:full', 'full' } - --- Min window width when splitting. -opt.winminwidth = 5 - --- Disable some messages. -opt.shortmess:append({ W = true, I = true, c = true, C = true }) diff --git a/nvim/lua/plugins/coding/blink-cmp.lua b/nvim/lua/plugins/coding/blink-cmp.lua deleted file mode 100644 index c34e384..0000000 --- a/nvim/lua/plugins/coding/blink-cmp.lua +++ /dev/null @@ -1,84 +0,0 @@ -return { - 'blink.cmp', - event = 'InsertEnter', - before = function() - require('lz.n').trigger_load({ - 'mini.icons', - 'luasnip', - }) - end, - after = function() - ---@module 'blink.cmp' - ---@type blink.cmp.Config - local opts = { - appearance = { - use_nvim_cmp_as_default = false, - nerd_font_variant = 'mono', - }, - completion = { - accept = { - auto_brackets = { - enabled = true, - }, - }, - menu = { - draw = { - treesitter = { 'lsp' }, - components = { - kind_icon = { - ellipsis = false, - text = function(ctx) - local icon, _, _ = require('mini.icons').get('lsp', ctx.kind) - return icon - end, - highlight = function(ctx) - local _, hl, _ = require('mini.icons').get('lsp', ctx.kind) - return hl - end, - }, - }, - }, - }, - documentation = { - auto_show = true, - auto_show_delay_ms = 200, - }, - ghost_text = { - enabled = false, - }, - list = { - selection = { preselect = true, auto_insert = false }, - }, - }, - - snippets = { - preset = 'luasnip', - expand = function(snippet) - require('luasnip').lsp_expand(snippet) - end, - - active = function(filter) - if filter and filter.direction then - return require('luasnip').jumpable(filter.direction) - end - - return require('luasnip').in_snippet() - end, - - jump = function(direction) - require('luasnip').jump(direction) - end, - }, - - sources = { - default = { 'lsp', 'path', 'snippets', 'buffer' }, - }, - - keymap = { - preset = 'super-tab', - }, - } - - require('blink.cmp').setup(opts) - end, -} diff --git a/nvim/lua/plugins/coding/friendly-snippets.lua b/nvim/lua/plugins/coding/friendly-snippets.lua deleted file mode 100644 index afaa69c..0000000 --- a/nvim/lua/plugins/coding/friendly-snippets.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - 'friendly-snippets', - lazy = true, -} diff --git a/nvim/lua/plugins/coding/init.lua b/nvim/lua/plugins/coding/init.lua deleted file mode 100644 index 27f6238..0000000 --- a/nvim/lua/plugins/coding/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -local req = MarleyVim.local_require('plugins.coding') - -return { - req('blink-cmp'), - req('friendly-snippets'), - req('lexima-vim'), - req('luasnip'), - req('mini-ai'), - req('mini-comment'), - req('mini-surround'), - req('neotab-nvim'), - req('ts-comments-nvim'), - req('yanky-nvim'), -} diff --git a/nvim/lua/plugins/coding/lexima-vim.lua b/nvim/lua/plugins/coding/lexima-vim.lua deleted file mode 100644 index b0e6bb3..0000000 --- a/nvim/lua/plugins/coding/lexima-vim.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - 'lexima.vim', - event = 'DeferredUIEnter', -} diff --git a/nvim/lua/plugins/coding/luasnip.lua b/nvim/lua/plugins/coding/luasnip.lua deleted file mode 100644 index 97ab788..0000000 --- a/nvim/lua/plugins/coding/luasnip.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - 'luasnip', - lazy = true, - before = function() - require('lz.n').trigger_load({ - 'friendly-snippets', - }) - end, - after = function() - require('luasnip').setup({ - history = true, - delete_check_events = 'TextChanged', - store_selection_keys = ' ', - update_events = 'TextChanged,TextChangedI', - }) - - -- friendly-snippets - require('luasnip.loaders.from_vscode').lazy_load() - - -- Personal snippets. - local snippets = {} - - local paths = vim.api.nvim_get_runtime_file('lua/snippets', true) - for _, path in ipairs(paths) do - if string.find(path, '%/nix%/store%/.+') then - table.insert(snippets, path) - end - end - - require('luasnip.loaders.from_lua').load({ paths = snippets }) - end, -} diff --git a/nvim/lua/plugins/coding/mini-ai.lua b/nvim/lua/plugins/coding/mini-ai.lua deleted file mode 100644 index da00562..0000000 --- a/nvim/lua/plugins/coding/mini-ai.lua +++ /dev/null @@ -1,124 +0,0 @@ -return { - 'mini.ai', - event = 'DeferredUIEnter', - before = function() - require('lz.n').trigger_load('which-key.nvim') - end, - after = function() - local ai = require('mini.ai') - - ai.setup({ - n_lines = 500, - custom_textobjects = { - -- code blOck - o = ai.gen_spec.treesitter({ - a = { '@block.outer', '@conditional.outer', '@loop.outer' }, - i = { '@block.inner', '@conditional.inner', '@loop.inner' }, - }), - - -- Class - c = ai.gen_spec.treesitter({ - a = '@class.outer', - i = '@class.inner', - }), - - -- Usage (fn call) - u = ai.gen_spec.function_call(), - - -- Usage (to last .) - U = ai.gen_spec.function_call({ name_pattern = '[%w_]' }), - - -- Digit - d = { '%f[%d]%d+' }, - - -- word within casE (snake_case, CamelCase, etc) - e = { - { - '%u[%l%d]+%f[^%l%d]', - '%f[%S][%l%d]+%f[^%l%d]', - '%f[%P][%l%d]+%f[^%l%d]', - '^[%l%d]+%f[^%l%d]', - }, - '^().*()$', - }, - - -- buffer - g = { - from = { line = 1, col = 1 }, - to = { - line = vim.fn.line('$'), - col = math.max(vim.fn.getline('$'):len(), 1), - }, - }, - }, - }) - - local i = require('icons') - local c = require('colors') - local mkA = MarleyVim.wkSpec(c.around) - local mkI = MarleyVim.wkSpec(c.inner) - - ---@param lhs string - ---@param icon string - ---@param opts table - local function mkKey(lhs, icon, opts) - if lhs:sub(1, 1) == 'a' then - return mkA(lhs, nil, icon, opts) - else - return mkI(lhs, nil, icon, opts) - end - end - - local groups = { - around = { 'a', i.around }, - around_last = { 'al', i.around }, - around_next = { 'an', i.around }, - inner = { 'i', i.inner }, - inner_last = { 'il', i.inner }, - inner_next = { 'in', i.inner }, - } - - local mappings = { - { ' ', '', 'whitespace' }, - { '"', '', 'double quotes' }, - { "'", '', 'single quotes' }, - { '`', '', 'backticks' }, - { '(', '', '()' }, - { ')', '', '() with ws' }, - { '[', '', '[] block' }, - { ']', '', '[] block with ws' }, - { '{', '', '{} block' }, - { '}', '', '{} block with ws' }, - { '<', '', '<>' }, - { '>', '', '<> with ws' }, - { '_', '', 'underscores' }, - { '?', '', 'user prompt' }, - { 'a', i.lsp.Variable, 'argument' }, - { 'b', '', ')]} block' }, - { 'c', i.lsp.Class, 'class' }, - { 'd', i.lsp.Number, 'numbers' }, - { 'e', i.lsp.Variable, 'word within case' }, - { 'f', i.lsp.Function, 'function' }, - { 'g', i.lsp.File, 'entire buffer' }, - { 'o', i.lsp.Control, 'block, conditional, loop' }, - { 'q', i.lsp.String, 'quotes/backticks' }, - { 't', '', 'tags' }, - { 'u', i.lsp.Method, 'use/call' }, - { 'U', i.lsp.Method, 'use/call without dot' }, - } - - local spec = { mode = { 'o', 'x' } } - - for name, data in pairs(groups) do - name = name:gsub('^around_', ''):gsub('^insude_', '') - - spec[#spec + 1] = mkKey(data[1], data[2], { group = name }) - - for _, item in ipairs(mappings) do - spec[#spec + 1] = mkKey(data[1] .. item[1], item[2], { desc = item[3] }) - end - end - - require('which-key').add({ spec }) - end, -} diff --git a/nvim/lua/plugins/coding/mini-comment.lua b/nvim/lua/plugins/coding/mini-comment.lua deleted file mode 100644 index f581764..0000000 --- a/nvim/lua/plugins/coding/mini-comment.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - 'mini.comment', - event = 'DeferredUIEnter', - after = function() - require('mini.comment').setup({}) - end, -} diff --git a/nvim/lua/plugins/coding/mini-surround.lua b/nvim/lua/plugins/coding/mini-surround.lua deleted file mode 100644 index a03a922..0000000 --- a/nvim/lua/plugins/coding/mini-surround.lua +++ /dev/null @@ -1,26 +0,0 @@ -local keys = { - add = 'gsa', - delete = 'gsd', - find = 'gsf', - find_left = 'gsF', - highlight = 'gsh', - replace = 'gsr', - update_n_lines = 'gsn', -} -return { - 'mini.surround', - keys = { - { keys.add, desc = 'add surrounding', mode = { 'n', 'v' } }, - { keys.delete, desc = 'delete surrounding' }, - { keys.find, desc = 'find right surrounding' }, - { keys.find_left, desc = 'find left surrounding' }, - { keys.highlight, desc = 'highlight surrounding' }, - { keys.replace, desc = 'replace surrounding' }, - { keys.update_n_lines, desc = 'update n_lines' }, - }, - after = function() - require('mini.surround').setup({ - mappings = keys, - }) - end, -} diff --git a/nvim/lua/plugins/coding/neotab-nvim.lua b/nvim/lua/plugins/coding/neotab-nvim.lua deleted file mode 100644 index 36ae6fa..0000000 --- a/nvim/lua/plugins/coding/neotab-nvim.lua +++ /dev/null @@ -1,36 +0,0 @@ -return { - 'neotab.nvim', - event = 'InsertEnter', - after = function() - require('neotab').setup({ - behavior = 'closing', - smart_punctuators = { - enabled = true, - semicolon = { - enabled = true, - ft = { 'javascript', 'typescript', 'php', 'nix' }, - }, - escape = { - enabled = true, - triggers = { - [','] = { - pairs = { - { open = "'", close = "'" }, - { open = '"', close = '"' }, - }, - format = '%s ', -- ", " - }, - ['='] = { - pairs = { - { open = '(', close = ')' }, - }, - ft = { 'javascript', 'typescript' }, - format = ' %s> ', -- ` => ` - cond = '^$', -- match only pairs with empty content - }, - }, - }, - }, - }) - end, -} diff --git a/nvim/lua/plugins/coding/ts-comments-nvim.lua b/nvim/lua/plugins/coding/ts-comments-nvim.lua deleted file mode 100644 index 06e73cb..0000000 --- a/nvim/lua/plugins/coding/ts-comments-nvim.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - 'ts-comments.nvim', - event = 'DeferredUIEnter', - after = function() - require('ts-comments').setup({}) - end, -} diff --git a/nvim/lua/plugins/coding/yanky-nvim.lua b/nvim/lua/plugins/coding/yanky-nvim.lua deleted file mode 100644 index 6cb7217..0000000 --- a/nvim/lua/plugins/coding/yanky-nvim.lua +++ /dev/null @@ -1,104 +0,0 @@ -return { - 'yanky.nvim', - event = { 'BufReadPost', 'BufWritePost', 'BufNewFile' }, - keys = { - { - 'gp', - ' (YankyGPutAfter)', - mode = { 'n', 'x' }, - desc = 'put text after selection', - }, - { - 'gP', - ' (YankyGPutBefore', - mode = { 'n', 'x' }, - desc = 'put text before selection', - }, - { - 'p', - ' (YankyPutAfter)', - mode = { 'n', 'x' }, - desc = 'put text after cursor', - }, - { - 'P', - ' (YankyPutBefore)', - mode = { 'n', 'x' }, - desc = 'put text before cursor', - }, - { 'y', ' (YankyYank)', mode = { 'n', 'x' }, desc = 'yank text' }, - { - ' p', - function() - vim.cmd([[YankyRingHistory]]) - end, - mode = { 'n', 'x' }, - desc = 'open yank history', - }, - { - '[p', - ' (YankyPutIndentBeforeLinewise)', - desc = 'put indented before cursor (linewise)', - }, - { - '[P', - ' (YankyPutIndentBeforeLinewise)', - desc = 'put indented before cursor (linewise)', - }, - { - ']p', - ' (YankyPutIndentAfterLinewise)', - desc = 'put indented after cursor (linewise)', - }, - { - ']P', - ' (YankyPutIndentAfterLinewise)', - desc = 'put indented after cursor (linewise)', - }, - { - '[y', - ' (YankyCycleForward)', - desc = 'cycle forward through yank history', - }, - { - ']y', - ' (YankyCycleBackward)', - desc = 'cycle backword through yank history', - }, - { - ' (YankyPutIndentAfterShiftLeft)', - desc = 'put and indent left', - }, - { - '
(YankyPutIndentBeforeShiftLeft)', - desc = 'put and indent left', - }, - { - '>p', - '
(YankyPutIndentAfterShiftRight)', - desc = 'put and indent right', - }, - { - '>P', - ' (YankyPutIndentBeforeShiftRight)', - desc = 'put and indent right', - }, - { - '=p', - ' (YankyPutAfterFilter)', - desc = 'put after applying a filter', - }, - { - '=P', - ' (YankyPutBeforeFilter)', - desc = 'put before applying a filter', - }, - }, - after = function() - require('yanky').setup({ - highlight = { timer = 150 }, - }) - end, -} diff --git a/nvim/lua/plugins/colorscheme/init.lua b/nvim/lua/plugins/colorscheme/init.lua deleted file mode 100644 index e102eb7..0000000 --- a/nvim/lua/plugins/colorscheme/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -local req = MarleyVim.local_require('plugins.colorscheme') - -return { - req('rose-pine'), -} diff --git a/nvim/lua/plugins/colorscheme/rose-pine.lua b/nvim/lua/plugins/colorscheme/rose-pine.lua deleted file mode 100644 index 5b42c7e..0000000 --- a/nvim/lua/plugins/colorscheme/rose-pine.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - 'rose-pine', - colorscheme = { - 'rose-pine', - 'rose-pine-main', - 'rose-pine-moon', - 'rose-pine-dawn', - }, - after = function() - require('rose-pine').setup({ - variant = 'main', - }) - - -- Reload the colorscheme once opts are set. - vim.cmd('colorscheme rose-pine') - end, -} diff --git a/nvim/lua/plugins/editor/aerial-nvim.lua b/nvim/lua/plugins/editor/aerial-nvim.lua deleted file mode 100644 index 913c574..0000000 --- a/nvim/lua/plugins/editor/aerial-nvim.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - 'aerial.nvim', - event = { 'BufReadPost', 'BufWritePost', 'BufNewFile' }, - keys = { - { ' cs', ' AerialToggle ', desc = 'toggle aerial' }, - }, - before = function() - require('lz.n').trigger_load({ 'mini.icons' }) - end, - after = function() - require('aerial').setup({ - attach_mode = 'global', - backends = { 'lsp', 'treesitter', 'markdown', 'man' }, - show_guides = true, - layout = { - resize_to_content = false, - placement = 'edge', - win_opts = { - winhl = 'Normal:NormalFloat,FloatBorder:NormalFloat,SignColumn:SignColumnSB', - signcolumn = 'yes', - statuscolumn = ' ', - }, - }, - guides = { - mid_item = '├╴', - last_item = '└╴', - nested_top = '│ ', - whitespace = ' ', - }, - }) - end, -} diff --git a/nvim/lua/plugins/editor/flash-nvim.lua b/nvim/lua/plugins/editor/flash-nvim.lua deleted file mode 100644 index f9d9775..0000000 --- a/nvim/lua/plugins/editor/flash-nvim.lua +++ /dev/null @@ -1,61 +0,0 @@ -return { - 'flash.nvim', - event = 'DeferredUIEnter', - keys = { - { - 's', - function() - require('flash').jump() - end, - mode = { 'n', 'x', 'o' }, - desc = 'flash', - }, - { - 'S', - function() - require('flash').treesitter() - end, - mode = { 'n', 'x', 'o' }, - desc = 'flash (treesitter)', - }, - { - 'r', - function() - require('flash').remote() - end, - mode = { 'o' }, - desc = 'remote flash', - }, - { - 'R', - function() - require('flash').treesitter_search() - end, - mode = { 'x', 'o' }, - desc = 'treesitter search', - }, - { - ' ', - function() - require('flash').toggle() - end, - mode = { 'c' }, - desc = 'toggle flash search', - }, - }, - before = function() - require('lz.n').trigger_load('which-key.nvim') - end, - after = function() - require('flash').setup({}) - - local mkKey = MarleyVim.wkSpec(require('colors').search) - require('which-key').add({ - mkKey('s', nil, '', { mode = { 'n', 'x', 'o' } }), - mkKey('S', nil, '', { mode = { 'n', 'x', 'o' } }), - mkKey('r', nil, '', { mode = { 'o' } }), - mkKey('r', nil, '', { mode = { 'x', 'o' } }), - mkKey(' ', nil, '', { mode = { 'c' } }), - }) - end, -} diff --git a/nvim/lua/plugins/editor/fzf-lua.lua b/nvim/lua/plugins/editor/fzf-lua.lua deleted file mode 100644 index 4836a75..0000000 --- a/nvim/lua/plugins/editor/fzf-lua.lua +++ /dev/null @@ -1,370 +0,0 @@ ----@param picker string ----@param opts? table -local function pick(picker, opts) - opts = opts or {} - - return function() - require('fzf-lua')[picker](opts) - end -end - -local projectPick = nil - -projectPick = function() - local has_project, _ = pcall(require, 'project_nvim') - if not has_project then - return - end - - local fzf_lua = require('fzf-lua') - local project = require('project_nvim.project') - local history = require('project_nvim.utils.history') - local results = history.get_recent_projects() - local utils = require('fzf-lua.utils') - - local function hl_validate(hl) - return not utils.is_hl_cleared(hl) and hl or nil - end - - local function ansi_from_hl(hl, s) - return utils.ansi_from_hl(hl_validate(hl), s) - end - - local opts = { - fzf_opts = { - ['--header'] = string.format( - ':: <%s> to %s | <%s> to %s | <%s> to %s | <%s> to %s | <%s> to %s', - ansi_from_hl('FzfLuaHeaderBind', 'ctrl-t'), - ansi_from_hl('FzfLuaHeaderText', 'tabedit'), - ansi_from_hl('FzfLuaHeaderBind', 'ctrl-s'), - ansi_from_hl('FzfLuaHeaderText', 'live_grep'), - ansi_from_hl('FzfLuaHeaderBind', 'ctrl-r'), - ansi_from_hl('FzfLuaHeaderText', 'oldfiles'), - ansi_from_hl('FzfLuaHeaderBind', 'ctrl-w'), - ansi_from_hl('FzfLuaHeaderText', 'change_dir'), - ansi_from_hl('FzfLuaHeaderBind', 'ctrl-d'), - ansi_from_hl('FzfLuaHeaderText', 'delete') - ), - }, - fzf_colors = true, - actions = { - ['default'] = { - function(selected) - fzf_lua.files({ cwd = selected[1] }) - end, - }, - ['ctrl-t'] = { - function(selected) - vim.cmd('tabedit') - fzf_lua.files({ cwd = selected[1] }) - end, - }, - ['ctrl-s'] = { - function(selected) - fzf_lua.live_grep({ cwd = selected[1] }) - end, - }, - ['ctrl-r'] = { - function(selected) - fzf_lua.oldfiles({ cwd = selected[1] }) - end, - }, - ['ctrl-w'] = { - function(selected) - local path = selected[1] - local ok = project.set_pwd(path) - if ok then - vim.api.nvim_win_close(0, false) - vim.notify('Change project dir to ' .. path, 'info') - end - end, - }, - ['ctrl-d'] = function(selected) - local path = selected[1] - local choice = - vim.fn.confirm("Delete '" .. path .. "' project? ", '&Yes\n&No') - if choice == 1 then - history.delete_project({ value = path }) - end - ---@diagnostic disable-next-line:need-check-nil - projectPick() - end, - }, - } - - fzf_lua.fzf_exec(results, opts) -end - -return { - 'fzf-lua', - event = { 'DeferredUIEnter' }, - cmd = { 'FzfLua' }, - keys = { - -- Find. - { - ' fb', - pick('buffers', { sort_mru = true, sort_lastused = true }), - desc = 'buffers', - }, - { ' ff', pick('files'), desc = 'find files (root dir)' }, - { - ' fF', - pick('files', { root = false }), - desc = 'find files (cwd)', - }, - { ' fg', pick('git_files'), desc = 'find files (git)' }, - { ' fp', projectPick, desc = 'projects' }, - { ' fr', pick('oldfiles'), desc = 'recent' }, - { - ' fR', - pick('oldfiles', { cwd = vim.uv.cwd() }), - desc = 'recent (cwd)', - }, - - -- Git. - { ' gc', pick('git_commits'), desc = 'commits' }, - { ' gs', pick('git_status'), desc = 'status' }, - - -- Search. - { ' sa', pick('autocmds'), desc = 'auto-commands' }, - { ' sb', pick('grep_curbuf'), desc = 'buffer' }, - { ' sc', pick('command_history'), desc = 'command history' }, - { ' sC', pick('commands'), desc = 'commands' }, - { - ' sd', - pick('diagnostics_document'), - desc = 'document diagnostics', - }, - { - ' sD', - pick('diagnostics_workspace'), - desc = 'workspace diagnostics', - }, - { ' sg', pick('live_grep'), desc = 'grep (root dir)' }, - { ' sG', pick('live_grep', { root = false }), desc = 'grep (cwd)' }, - { ' sh', pick('help_tags'), desc = 'help pages' }, - { ' sH', pick('highlights'), desc = 'search highlight groups' }, - { ' sj', pick('jumps'), desc = 'jumplist' }, - { ' sk', pick('keymaps'), desc = 'keymaps' }, - { ' sl', pick('loclist'), desc = 'location list' }, - { ' sm', pick('marks'), desc = 'jump to mark' }, - { ' sM', pick('man_pages'), desc = 'man pages' }, - { ' sq', pick('quickfix'), desc = 'quickfix list' }, - { ' sR', pick('resume'), desc = 'resume last picker' }, - { ' sw', pick('grep_cword'), desc = 'word under cursor (root dir)' }, - { - ' sw', - pick('grep_visual'), - mode = 'v', - desc = 'selection (root dir)', - }, - { - ' sW', - pick('grep_cword', { root = false }), - desc = 'word under cursor (cwd)', - }, - { - ' sW', - pick('grep_visual', { root = false }), - mode = 'v', - desc = 'selection (cwd)', - }, - { ' s"', pick('registers'), desc = 'registers' }, - - -- Misc. - { ' uC', pick('colorschemes'), desc = 'colorschemes' }, - { ' ', pick('files'), desc = 'find files (root dir)' }, - { - ' ,', - pick('buffers', { sort_mru = true, sort_lastused = true }), - desc = 'switch buffer', - }, - { ' /', pick('live_grep'), desc = 'grep (root dir)' }, - { ' :', pick('command_history'), desc = 'command history' }, - }, - after = function() - local config = require('fzf-lua.config') - local actions = require('fzf-lua.actions') - - -- quickfix - config.defaults.keymap.fzf['ctrl-q'] = 'select-all+accept' - config.defaults.keymap.fzf['ctrl-u'] = 'half-page-up' - config.defaults.keymap.fzf['ctrl-d'] = 'half-page-down' - config.defaults.keymap.fzf['ctrl-x'] = 'jump' - config.defaults.keymap.fzf['ctrl-f'] = 'preview-page-down' - config.defaults.keymap.fzf['ctrl-b'] = 'preview-page-up' - config.defaults.keymap.builtin[' '] = 'preview-page-down' - config.defaults.keymap.builtin[' '] = 'preview-page-up' - - -- trouble.nvim - local has_trouble, _ = pcall(require, 'trouble') - if has_trouble then - config.defaults.actions.files['ctrl-t'] = - require('trouble.sources.fzf').actions.open - end - - local img_previewer = { 'chafa', '{file}', '--format=symbols' } - - local opts = { - -- Base profile. - 'default-title', - - fzf_colors = true, - fzf_opts = { - ['--no-scrollbar'] = true, - }, - - defaults = { - formatter = 'path.dirname_first', - }, - - previewers = { - builtin = { - extensions = { - ['png'] = img_previewer, - ['jpg'] = img_previewer, - ['jpeg'] = img_previewer, - ['gif'] = img_previewer, - ['webp'] = img_previewer, - }, - }, - }, - - winopts = { - width = 0.8, - height = 0.8, - row = 0.5, - col = 0.5, - preview = { - scrollchars = { '┃', '' }, - }, - }, - - files = { - cwd_prompt = false, - actions = { - ['alt-i'] = { actions.toggle_ignore }, - ['alt-h'] = { actions.toggle_hidden }, - }, - }, - - grep = { - actions = { - ['alt-i'] = { actions.toggle_ignore }, - ['alt-h'] = { actions.toggle_hidden }, - }, - }, - - lsp = { - symbols = { - symbol_hl = function(s) - return 'TroubleIcon' .. s - end, - symbol_fmt = function(s) - return s:lower() .. '\t' - end, - child_prefix = false, - }, - code_actions = { - previewer = 'codeaction_native', - }, - }, - } - - -- Use the same prompt for all pickers for profile 'default-title'. - local function fix(table) - table.prompt = table.prompt ~= nil and ' ' or nil - - -- Recurse into subtables. - for _, value in pairs(table) do - if type(value) == 'table' then - fix(value) - end - end - - return table - end - - opts = vim.tbl_deep_extend( - 'force', - fix(require('fzf-lua.profiles.default-title')), - opts - ) - - -- Don't let fzf-lua apply the profile as we've already done so above. - opts[1] = nil - - require('fzf-lua').setup(opts) - require('fzf-lua').register_ui_select(function(fzf_opts, items) - return vim.tbl_deep_extend('force', fzf_opts, { - prompt = ' ', - winopts = { - title = ' ' - .. vim.trim((fzf_opts.prompt or 'Select'):gsub('%s*:%s*$', '')) - .. ' ', - title_pos = 'center', - }, - }, fzf_opts.kind == 'codeaction' and { - winopts = { - layout = 'vertical', - height = math.floor( - math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5 - ) + 16, - preview = not vim.tbl_isempty( - vim.lsp.get_clients({ bufnr = 0, name = 'vtsls' }) - ) - and { - layout = 'vertical', - vertical = 'down:15,border-top', - hidden = 'hidden', - } - or { - layout = 'vertical', - vertical = 'down:15,border-top', - }, - }, - } or { - winopts = { - width = 0.5, - height = math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5), - }, - }) - end) - - -- LSP keybinds. - MarleyVim.lsp.on_attach(function(client) - local set = vim.keymap.set - - local pickOpts = - { jump_to_single_result = true, ignore_current_line = true } - - set( - 'n', - 'gI', - pick('lsp_implementations', pickOpts), - { desc = 'implementation' } - ) - set( - 'n', - 'gr', - pick('lsp_references', pickOpts), - { desc = 'references', nowait = true } - ) - set( - 'n', - 'gy', - pick('lsp_typedefs', pickOpts), - { desc = 't[y]pe definition' } - ) - - if client.supports_method('textDocument/definition') then - set( - 'n', - 'gd', - pick('lsp_definitions', pickOpts), - { desc = 'definition' } - ) - end - end) - end, -} diff --git a/nvim/lua/plugins/editor/gitsigns-nvim.lua b/nvim/lua/plugins/editor/gitsigns-nvim.lua deleted file mode 100644 index ef13329..0000000 --- a/nvim/lua/plugins/editor/gitsigns-nvim.lua +++ /dev/null @@ -1,133 +0,0 @@ -return { - 'gitsigns.nvim', - event = { 'BufReadPost', 'BufWritePost', 'BufNewFile' }, - before = function() - require('lz.n').trigger_load('which-key.nvim') - end, - after = function() - require('gitsigns').setup({ - signs = { - add = { text = '▎' }, - change = { text = '▎' }, - delete = { text = '' }, - topdelete = { text = '' }, - changedelete = { text = '▎' }, - untracked = { text = '▎' }, - }, - signs_staged = { - add = { text = '▎' }, - change = { text = '▎' }, - delete = { text = '' }, - topdelete = { text = '' }, - changedelete = { text = '▎' }, - }, - on_attach = function(buf) - local gitsigns = package.loaded.gitsigns - - local icons = require('icons') - local mkKey = MarleyVim.wkSpec(require('colors').git) - require('which-key').add({ - { - buffer = buf, - mkKey(']h', function() - if vim.wo.diff then - vim.cmd.normal({ ']c', bang = true }) - else - gitsigns.nav_hunk('next') - end - end, icons.next, { desc = 'next hunk' }), - - mkKey('[h', function() - if vim.wo.diff then - vim.cmd.normal({ '[c', bang = true }) - else - gitsigns.nav_hunk('prev') - end - end, icons.prev, { desc = 'previous hunk' }), - - mkKey(']H', function() - gitsigns.nav_hunk('last') - end, icons.last, { desc = 'last hunk' }), - - mkKey('[H', function() - gitsigns.nav_hunk('first') - end, icons.first, { desc = 'first hunk' }), - - mkKey( - ' ghs', - ' Gitsigns stage_hunk ', - icons.git.staged, - { mode = { 'n', 'v' }, desc = 'stage hunk' } - ), - - mkKey( - ' ghr', - ' Gitsigns reset_hunk ', - icons.git.unstaged, - { mode = { 'n', 'v' }, desc = 'reset hunk' } - ), - - mkKey( - ' ghS', - gitsigns.stage_buffer, - icons.git.staged, - { desc = 'stage buffer' } - ), - - mkKey( - ' ghu', - gitsigns.undo_stage_hunk, - icons.undo, - { desc = 'undo stage hunk' } - ), - - mkKey( - ' ghR', - gitsigns.reset_buffer, - icons.git.unstaged, - { desc = 'reset buffer' } - ), - - mkKey( - ' ghp', - gitsigns.preview_hunk_inline, - '', - { desc = 'preview hunk inline' } - ), - - mkKey(' ghb', function() - gitsigns.blame_line({ full = true }) - end, { cat = 'filetype', name = 'git' }, { - desc = 'blame line', - }), - - mkKey( - ' ghB', - gitsigns.blame, - { cat = 'filetype', name = 'git' }, - { desc = 'blame buffer' } - ), - - mkKey( - ' ghd', - gitsigns.diffthis, - icons.git.diff, - { desc = 'diff file' } - ), - - mkKey(' ghD', function() - gitsigns.diffthis('~') - end, icons.git.diff, { desc = 'diff file from ~' }), - - mkKey( - 'ih', - ' Gitsigns select_hunk ', - '', - { mode = { 'o', 'x' }, desc = 'select hunk' } - ), - }, - }) - end, - }) - end, -} diff --git a/nvim/lua/plugins/editor/grug-far-nvim.lua b/nvim/lua/plugins/editor/grug-far-nvim.lua deleted file mode 100644 index c142e9c..0000000 --- a/nvim/lua/plugins/editor/grug-far-nvim.lua +++ /dev/null @@ -1,25 +0,0 @@ -return { - 'grug-far.nvim', - cmd = 'GrugFar', - keys = { - { - ' sr', - function() - local grug = require('grug-far') - local ext = vim.bo.buftype == '' and vim.fn.expand('%:e') - - grug.open({ - transient = true, - prefills = { - filesFilter = ext and ext ~= '' and '*.' .. ext or nil, - }, - }) - end, - mode = { 'n', 'v' }, - desc = 'search and replace', - }, - }, - after = function() - require('grug-far').setup({ headerMaxWidth = 80 }) - end, -} diff --git a/nvim/lua/plugins/editor/init.lua b/nvim/lua/plugins/editor/init.lua deleted file mode 100644 index 1f03fc9..0000000 --- a/nvim/lua/plugins/editor/init.lua +++ /dev/null @@ -1,15 +0,0 @@ -local req = MarleyVim.local_require('plugins.editor') - -return { - req('aerial-nvim'), - req('flash-nvim'), - req('fzf-lua'), - req('gitsigns-nvim'), - req('grug-far-nvim'), - req('neo-tree-nvim'), - req('nvim-emmet'), - req('refactoring-nvim'), - req('todo-comments-nvim'), - req('trouble-nvim'), - req('which-key-nvim'), -} diff --git a/nvim/lua/plugins/editor/neo-tree-nvim.lua b/nvim/lua/plugins/editor/neo-tree-nvim.lua deleted file mode 100644 index 26304d7..0000000 --- a/nvim/lua/plugins/editor/neo-tree-nvim.lua +++ /dev/null @@ -1,140 +0,0 @@ ----@param root? boolean ----@param grouped? boolean -local function make_toggle_mapping(root, grouped) - root = root or false - grouped = grouped or false - - local lhs = grouped and ' fe' or ' e' - lhs = root and lhs or (lhs:gsub('%l$', string.upper)) - - return { - lhs, - function() - require('neo-tree.command').execute({ - toggle = true, - dir = root and (MarleyVim.root()) or (vim.uv.cwd()), - }) - end, - desc = 'explorer (' .. (root and 'root' or 'cwd') .. ')', - } -end - -return { - 'neo-tree.nvim', - cmd = 'Neotree', - keys = { - make_toggle_mapping(true, true), -- root / grouped - make_toggle_mapping(false, true), -- cwd / grouped - make_toggle_mapping(true, false), -- root / non-grouped - make_toggle_mapping(false, false), -- cwd / non-grouped - { - ' ge', - function() - require('neo-tree.command').execute({ - source = 'git_status', - toggle = true, - }) - end, - desc = 'git explorer', - }, - { - ' be', - function() - require('neo-tree.command').execute({ - source = 'buffers', - toggle = true, - }) - end, - desc = 'buffer explorer', - }, - }, - before = function() - require('lz.n').trigger_load({ - 'plenary.nvim', - 'mini.icons', - 'nui.nvim', - 'which-key.nvim', - }) - end, - after = function() - local icons = require('icons') - local events = require('neo-tree.events') - - for _, type in ipairs({ 'Error', 'Warn', 'Info', 'Hint' }) do - vim.fn.sign_define('DiagnosticSign' .. type, { - text = icons.diagnostics[type] .. ' ', - texthl = 'DiagnosticSign' .. type, - }) - end - - local function on_move(data) - Snacks.rename.on_rename_file(data.source, data.destination) - end - - require('neo-tree').setup({ - close_if_last_window = true, - sources = { 'filesystem', 'buffers', 'git_status' }, - open_files_do_not_replace_types = { - 'terminal', - 'Trouble', - 'trouble', - 'qf', - 'Outline', - }, - - filesystem = { - bind_to_cwd = false, - follow_current_file = { enabled = true }, - use_libuv_file_watcher = true, - filtered_items = { - visible = true, - hide_dotfiles = false, - hide_gitignored = false, - hide_hidden = false, - }, - }, - - window = { - width = 30, - mappings = { - ['l'] = 'open', - ['h'] = 'close_node', - [' '] = 'none', - ['Y'] = { - function(state) - local node = state.tree:get_node() - local path = node:get_id() - vim.fn.setreg('+', path, 'c') - end, - desc = 'copy path to clipboard', - }, - ['P'] = { 'toggle_preview', config = { use_float = false } }, - }, - }, - default_component_configs = { - indent = { - with_expanders = true, - expanders_collapsed = '', - expander_expanded = '', - expander_highlight = 'NeoTreeExpander', - }, - git_status = { - symbols = { - unstaged = icons.git.unstaged, - staged = icons.git.staged, - }, - }, - }, - event_handlers = { - { event = events.FILE_MOVED, handler = on_move }, - { event = events.FILE_RENAMED, handler = on_move }, - }, - }) - - local colors = require('colors') - require('which-key').add({ - { ' ge', icon = { icon = '', color = colors.git } }, - { ' be', icon = { icon = '', color = colors.buffer } }, - }) - end, -} diff --git a/nvim/lua/plugins/editor/nvim-emmet.lua b/nvim/lua/plugins/editor/nvim-emmet.lua deleted file mode 100644 index 5bb31dc..0000000 --- a/nvim/lua/plugins/editor/nvim-emmet.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - 'nvim-emmet', - keys = { - { - ' xe', - require('nvim-emmet').wrap_with_abbreviation, - mode = { 'n', 'v' }, - desc = 'wrap with emmet abbr', - }, - }, -} diff --git a/nvim/lua/plugins/editor/refactoring-nvim.lua b/nvim/lua/plugins/editor/refactoring-nvim.lua deleted file mode 100644 index 0a446cb..0000000 --- a/nvim/lua/plugins/editor/refactoring-nvim.lua +++ /dev/null @@ -1,126 +0,0 @@ -return { - 'refactoring.nvim', - event = { 'BufReadPre', 'BufNewFile' }, - keys = { - { ' r', '', desc = '+refactor', mode = { 'n', 'v' } }, - { - ' rb', - function() - require('refactoring').refactor('Extract Block') - end, - desc = 'extract block', - }, - { - ' rc', - function() - require('refactoring').debug.cleanup({}) - end, - desc = 'debug cleanup', - }, - { - ' rf', - function() - require('refactoring').refactor('Extract Block To File') - end, - desc = 'extract block to file', - }, - { - ' rf', - function() - require('refactoring').refactor('Extract Function') - end, - mode = 'v', - desc = 'extract function', - }, - { - ' rF', - function() - require('refactoring').refactor('Extract Function To File') - end, - mode = 'v', - desc = 'extract function to file', - }, - { - ' ri', - function() - require('refactoring').refactor('Inline Variable') - end, - mode = { 'n', 'v' }, - desc = 'inline variable', - }, - { - ' rp', - function() - require('refactoring').debug.print_var({ normal = true }) - end, - desc = 'debug print variable', - }, - { - ' rp', - function() - require('refactoring').debug.print_var() - end, - mode = 'v', - desc = 'debug print variable', - }, - { - ' rP', - function() - require('refactoring').debug.printf({ below = false }) - end, - desc = 'debug print', - }, - { - ' rs', - function() - require('fzf-lua').fzf_exec(require('refactoring').get_refactors(), { - fzf_opts = {}, - fzf_colors = true, - actions = { - ['default'] = function(selected) - require('refactoring').refactor(selected[1]) - end, - }, - }) - end, - mode = 'v', - desc = 'refactor', - }, - { - ' rx', - function() - require('refactoring').refactor('Extract Variable') - end, - mode = 'v', - desc = 'extract variable', - }, - }, - before = function() - require('lz.n').trigger_load({ 'plenary.nvim', 'nvim-treesitter' }) - end, - after = function() - require('refactoring').setup({ - prompt_func_param_type = { - go = false, - java = false, - cpp = false, - c = false, - h = false, - hpp = false, - cxx = false, - }, - prompt_func_return_type = { - go = false, - java = false, - cpp = false, - c = false, - h = false, - hpp = false, - cxx = false, - }, - printf_statements = {}, - print_var_statements = {}, - show_success_message = false, - }) - end, -} diff --git a/nvim/lua/plugins/editor/todo-comments-nvim.lua b/nvim/lua/plugins/editor/todo-comments-nvim.lua deleted file mode 100644 index 51ffc7c..0000000 --- a/nvim/lua/plugins/editor/todo-comments-nvim.lua +++ /dev/null @@ -1,49 +0,0 @@ -return { - 'todo-comments.nvim', - event = { 'BufReadPost', 'BufWritePost', 'BufNewFile' }, - cmd = { 'TodoTrouble', 'TodoTelescope' }, - keys = { - { - ' st', - function() - require('todo-comments.fzf').todo() - end, - desc = 'todo search', - }, - { - ' sT', - function() - require('todo-comments.fzf').todo({ - keywords = { 'TODO', 'FIX', 'FIXME' }, - }) - end, - desc = 'todo/fix/fixme search', - }, - { ' xt', ' Trouble todo toggle ', desc = 'todo' }, - { - ' xT', - ' Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}} ', - desc = 'todo/fix/fixme', - }, - { - ']t', - function() - require('todo-comments').jump_prev() - end, - desc = 'previous todo', - }, - { - ']t', - function() - require('todo-comments').jump_next() - end, - desc = 'next todo', - }, - }, - before = function() - require('lz.n').trigger_load({ 'trouble.nvim', 'fzf-lua' }) - end, - after = function() - require('todo-comments').setup({}) - end, -} diff --git a/nvim/lua/plugins/editor/trouble-nvim.lua b/nvim/lua/plugins/editor/trouble-nvim.lua deleted file mode 100644 index b5f7b7a..0000000 --- a/nvim/lua/plugins/editor/trouble-nvim.lua +++ /dev/null @@ -1,55 +0,0 @@ -return { - 'trouble.nvim', - cmd = { 'Trouble' }, - keys = { - { - ' xQ', - ' Trouble qflist toggle ', - desc = 'quickfix list (trouble)', - }, - { - ' xx', - ' Trouble diagnostics toggle ', - desc = 'diagnostics', - }, - { - ' xX', - ' Trouble diagnostics toggle filter.buf=0 ', - desc = 'buffer diagnostics', - }, - { - '[q', - function() - if require('trouble').is_open() then - require('trouble').prev({ skip_groups = true, jump = true }) - else - local ok, err = pcall(vim.cmd.cprev) - - if not ok then - vim.notify(err, vim.log.levels.ERROR) - end - end - end, - desc = 'previous trouble/quickfix item', - }, - { - ']q', - function() - if require('trouble').is_open() then - require('trouble').next({ skip_groups = true, jump = true }) - else - local ok, err = pcall(vim.cmd.cnext) - - if not ok then - vim.notify(err, vim.log.levels.ERROR) - end - end - end, - }, - }, - after = function() - require('trouble').setup({ - modes = { lsp = { win = { position = 'right' } } }, - }) - end, -} diff --git a/nvim/lua/plugins/editor/which-key-nvim.lua b/nvim/lua/plugins/editor/which-key-nvim.lua deleted file mode 100644 index 17cd877..0000000 --- a/nvim/lua/plugins/editor/which-key-nvim.lua +++ /dev/null @@ -1,240 +0,0 @@ -return { - 'which-key.nvim', - event = 'DeferredUIEnter', - keys = { - { - ' ?', - function() - require('which-key').show({ global = false }) - end, - desc = 'buffer keymaps (which key)', - }, - { - ' ', - function() - require('which-key').show({ keys = ' ', loop = true }) - end, - desc = 'window hydra mode (which key)', - }, - }, - before = function() - require('lz.n').trigger_load('mini.icons') - end, - after = function() - local i = require('icons') - local c = require('colors') - - require('which-key').setup({ - preset = 'modern', - spec = { - { - mode = { 'n', 'v' }, - { - ' ', - group = 'leader', - icon = { icon = '', color = 'green' }, - }, - { ' ', group = 'tabs' }, - { - ' b', - group = 'buffer', - expand = function() - return require('which-key.extras').expand.buf() - end, - }, - { ' c', group = 'code' }, - { ' f', group = 'file/find' }, - { ' g', group = 'git' }, - { ' gh', group = 'hunks' }, - { ' n', group = 'notifications' }, - { ' q', group = 'quit/session' }, - { ' s', group = 'search' }, - { ' u', group = 'ui', icon = { icon = i.ui, color = c.ui } }, - { ' ur', icon = { icon = '', color = c.ui } }, - { - ' w', - group = 'windows', - expand = function() - return require('which-key.extras').expand.win() - end, - }, - { - ' x', - group = 'diagnostics/quickfix', - icon = { icon = ' ', color = c.diagnostics }, - }, - { ' |', icon = '' }, - { ' -', icon = '' }, - - { '0', desc = 'start of line', icon = i.first }, - { 'b', desc = 'previous word', icon = i.word }, - { 'B', desc = 'previous WORD', icon = i.word }, - { 'c', desc = 'change' }, - { 'd', desc = 'delete' }, - { 'e', desc = 'next end of word', icon = i.word }, - { 'E', desc = 'next end of WORD', icon = i.word }, - { 'f', desc = 'find next char' }, - { 'F', desc = 'find previous char' }, - - { 'g', group = 'goto', icon = { icon = i.go_to, color = c.go_to } }, - { 'gc', group = 'toggle comment' }, - { 'ge', desc = 'previous end of word', icon = i.word }, - { 'gf', desc = 'file under cursor' }, - { 'gg', desc = 'first line', icon = i.first }, - { 'gi', desc = 'last insert' }, - { 'gn', desc = 'search forward & select' }, - { 'gN', desc = 'search backward & select' }, - { 'gO', desc = 'document symbols', icon = '' }, - { 'gt', desc = 'next tab page' }, - { 'gT', desc = 'previous tab page' }, - { 'gu', desc = 'make lowercase', icon = '' }, - { 'gU', desc = 'make uppercase', icon = '' }, - { 'gv', desc = 'last visual selection' }, - { 'w', desc = 'format' }, - { - 'gs', - group = 'surround', - icon = { icon = '', color = c.surround }, - }, - { 'gx', desc = 'open with system app', icon = '' }, - { 'g%', desc = 'cycle backward through results' }, - { 'g~', desc = 'toggle case' }, - - { 'G', desc = 'last line', icon = i.last }, - - { 'M', desc = 'middle line of window', icon = i.center }, - { 'r', desc = 'replace' }, - { 't', desc = 'find before next char' }, - { 'T', desc = 'find before previous char' }, - { 'v', desc = 'visual' }, - { 'V', desc = 'visual line' }, - { 'w', desc = 'next word', icon = i.word }, - { 'W', desc = 'next WORD', icon = i.word }, - { 'y', desc = 'yank' }, - { 'Y', desc = 'yank to end of line' }, - - { 'z', group = 'fold/scroll/spell', icon = '' }, - { 'za', desc = 'toggle fold under cursor' }, - { 'zA', desc = 'toggle all folds under cursor' }, - { 'zb', desc = 'bottom this line', icon = i.bottom }, - { 'zc', desc = 'close fold under cursor' }, - { 'zC', desc = 'close all fold under cursor' }, - { 'zd', desc = 'delete fold under cursor' }, - { 'zD', desc = 'delete all folds under cursor' }, - { 'ze', desc = 'right this line', icon = i.right }, - { 'zE', desc = 'delete all folds in file' }, - { 'zf', desc = 'create fold' }, - { 'zg', desc = 'mark word as correctly spelled' }, - { 'zH', desc = 'half screen to the left', icon = i.left }, - { 'zi', desc = 'toggle folding' }, - { 'zL', desc = 'half screen to the right', icon = i.right }, - { 'zm', desc = 'fold more' }, - { 'zM', desc = 'close all folds' }, - { 'zo', desc = 'open fold under cursor' }, - { 'zO', desc = 'open all folds under cursor' }, - { 'zr', desc = 'fold less' }, - { 'zR', desc = 'open all folds' }, - { 'zs', desc = 'left this line', icon = i.left }, - { 'zt', desc = 'top this line', icon = i.top }, - { 'zv', desc = 'show cursor line' }, - { 'zw', desc = 'mark word as mispelled' }, - { 'zx', desc = 'update folds' }, - { 'zz', desc = 'center this line', icon = i.center }, - { 'z ', desc = 'top this line', icon = i.top }, - { 'z=', group = 'spelling suggestions' }, - - { '[', group = 'previous', icon = i.prev }, - { ']', group = 'next', icon = i.next }, - { '!', desc = 'run program', icon = '' }, - { '$', desc = 'end of line', icon = i.last }, - { '%', desc = 'matching (){}[]', icon = '' }, - { '&', desc = 'repeat last subsitute' }, - { ',', desc = 'repeat last char search (backwards)' }, - { '/', desc = 'search forward' }, - { ';', desc = 'repeat last char search' }, - { '<', desc = 'indent decrease', icon = i.indent.decrease }, - { '>', desc = 'indent increase', icon = i.indent.increase }, - { '?', desc = 'search backwards' }, - { '^', desc = 'first char of line', icon = i.first }, - { '_', desc = 'first char of line', icon = i.first }, - { '{', desc = 'previous empty line', icon = i.prev }, - { '}', desc = 'next empty line', icon = i.next }, - { '~', desc = 'toggle case' }, - - { - ' ', - desc = 'clear & redraw', - icon = { icon = '', color = 'red' }, - }, - }, - { - mode = { 'n', 'i' }, - hidden = true, - { ' ' }, - { ' ' }, - { ' ' }, - { ' ' }, - }, - { - mode = { 'n', 'x' }, - hidden = true, - { 'j' }, - { 'k' }, - { 'h' }, - { 'l' }, - { ' ' }, - }, - }, - icons = { - rules = { - { pattern = 'fold', icon = i.fold, color = c.fold }, - - { pattern = 'buffer', color = c.buffer }, - { pattern = 'change', icon = i.change, color = c.change }, - { pattern = 'comment', icon = i.comment }, - { pattern = 'delete', icon = i.delete, color = c.delete }, - { - pattern = 'diagnostic', - icon = i.diagnostics.Info, - hl = 'DiagnosticInfo', - }, - { - pattern = 'error', - icon = i.diagnostics.Error, - hl = 'DiagnosticError', - }, - { - pattern = 'explorer', - icon = i.explorer, - color = c.explorer, - }, - { pattern = 'format', icon = i.format, color = c.format }, - { pattern = 'hunk', color = c.git }, - { pattern = 'lazygit', icon = i.git, color = c.git }, - { - pattern = 'message', - icon = i.notifications, - color = c.notifications, - }, - { - pattern = 'notification', - icon = i.notifications, - color = c.notifications, - }, - { pattern = 'registers', icon = i.registers, color = c.yank }, - { pattern = 'replace', icon = i.replace, colors = c.replace }, - { pattern = 'session', icon = i.sessions, color = c.sessions }, - { pattern = 'spell', icon = i.spell, color = c.spell }, - { pattern = 'subsitute', icon = i.search, color = c.search }, - { pattern = 'visual', icon = i.visual, color = c.visual }, - { - pattern = ' warning', - icon = i.diagnostics.Warning, - hl = 'DiagnosticWarn', - }, - { pattern = 'yank', icon = i.yank, color = c.yank }, - }, - }, - }) - end, -} diff --git a/nvim/lua/plugins/formatting/conform-nvim.lua b/nvim/lua/plugins/formatting/conform-nvim.lua deleted file mode 100644 index cfbf7db..0000000 --- a/nvim/lua/plugins/formatting/conform-nvim.lua +++ /dev/null @@ -1,96 +0,0 @@ -return { - 'conform.nvim', - event = { 'BufWritePre' }, - cmd = { 'ConformInfo' }, - keys = { - { - ' cf', - function() - require('conform').format() - end, - desc = 'format', - }, - { - ' cF', - function() - require('conform').format({ - formatters = { 'injected' }, - timeout_ms = 3000, - }) - end, - mode = { 'n', 'v' }, - desc = 'format injected langs', - }, - }, - after = function() - require('conform').setup({ - format_on_save = function(buf) - if (vim.g.autoformat == false) or (vim.b[buf].autoformat == false) then - return - end - - return { timeout_ms = 3000, lsp_format = 'fallback' } - end, - - -- Prettier is last but only activated if there is a config available, - -- thereby giving it priority only when it is wanted. - formatters_by_ft = { - blade = { 'blade-formatter', 'rustywind' }, - css = { 'stylelint', 'biome', 'prettier' }, - fish = { 'fish_indent' }, - graphql = { 'biome', 'prettier' }, - handlebars = { 'prettier' }, - html = { 'prettier' }, - javascript = { 'biome', 'prettier' }, - javascriptreact = { 'biome', 'prettier' }, - json = { 'biome', 'prettier' }, - jsonc = { 'biome', 'prettier' }, - liquid = { 'prettier' }, - lua = { 'stylua' }, - less = { 'prettier' }, - markdown = { 'prettier' }, - ['markdown.mdx'] = { 'prettier' }, - nix = { 'alejandra' }, - php = { 'pint', 'php_cs_fixer', stop_after_first = true }, - ruby = { 'prettier' }, - scss = { 'stylelint', 'prettier' }, - sh = { 'shfmt' }, - toml = { 'taplo' }, - typescript = { 'biome', 'prettier' }, - typescriptreact = { 'biome', 'prettier' }, - vue = { 'biome', 'prettier' }, - yaml = { 'prettier' }, - }, - - formatters = { - biome = { - require_cwd = true, - }, - pint = { - meta = { url = 'https://github.com/laravel/pint' }, - command = require('conform.util').find_executable({ - 'vendor/bin/pint', - }, 'pint'), - args = { '$FILENAME' }, - stdin = false, - }, - prettier = { - condition = function(_, ctx) - return MarleyVim.prettier.has_parser(ctx) - and MarleyVim.prettier.has_config(ctx) - end, - }, - shfmt = { - prepend_args = { - '--indent=2', - '--case-indent', - '--binary-next-line', - '--func-next-line', - }, - }, - }, - }) - - vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" - end, -} diff --git a/nvim/lua/plugins/formatting/init.lua b/nvim/lua/plugins/formatting/init.lua deleted file mode 100644 index 4b2a62b..0000000 --- a/nvim/lua/plugins/formatting/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -local req = MarleyVim.local_require('plugins.formatting') - -return { - req('conform-nvim'), -} diff --git a/nvim/lua/plugins/languages/init.lua b/nvim/lua/plugins/languages/init.lua deleted file mode 100644 index f8bfa4a..0000000 --- a/nvim/lua/plugins/languages/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -local req = MarleyVim.local_require('plugins.languages') - -return { - req('vim-caddyfile'), -} diff --git a/nvim/lua/plugins/languages/vim-caddyfile.lua b/nvim/lua/plugins/languages/vim-caddyfile.lua deleted file mode 100644 index f897ef5..0000000 --- a/nvim/lua/plugins/languages/vim-caddyfile.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - 'vim-caddyfile', - lazy = false, -} diff --git a/nvim/lua/plugins/linting/init.lua b/nvim/lua/plugins/linting/init.lua deleted file mode 100644 index e396bd7..0000000 --- a/nvim/lua/plugins/linting/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -local req = MarleyVim.local_require('plugins.linting') - -return { - req('nvim-lint'), -} diff --git a/nvim/lua/plugins/linting/nvim-lint.lua b/nvim/lua/plugins/linting/nvim-lint.lua deleted file mode 100644 index 90d01fd..0000000 --- a/nvim/lua/plugins/linting/nvim-lint.lua +++ /dev/null @@ -1,48 +0,0 @@ -return { - 'nvim-lint', - event = { 'BufReadPost', 'BufWritePost', 'BufNewFile' }, - after = function() - local lint = require('lint') - - lint.linters_by_ft = { - bash = { 'shellcheck' }, - fish = { 'fish' }, - nix = { 'statix' }, - scss = { 'stylelint' }, - sh = { 'shellcheck' }, - yaml = { 'yamllint' }, - } - - local linters = { - shellcheck = { - args = { - '-x', - }, - }, - } - - for name, linter in pairs(linters) do - if type(linter) == 'table' and type(lint.linters[name]) == 'table' then - lint.linters[name] = - vim.tbl_deep_extend('force', lint.linters[name], linter) - - if type(linter.prepend_args) == 'table' then - lint.linters[name].args = lint.linters[name].args or {} - vim.list_extend(lint.linters[name].args, linter.prepend_args) - end - else - lint.linters[name] = linter - end - end - - vim.api.nvim_create_autocmd( - { 'BufWritePost', 'BufReadPost', 'InsertLeave' }, - { - group = vim.api.nvim_create_augroup('nvim-lint', { clear = true }), - callback = function() - require('lint').try_lint() - end, - } - ) - end, -} diff --git a/nvim/lua/plugins/test/init.lua b/nvim/lua/plugins/test/init.lua deleted file mode 100644 index a8ee21c..0000000 --- a/nvim/lua/plugins/test/init.lua +++ /dev/null @@ -1,6 +0,0 @@ -local req = MarleyVim.local_require('plugins.test') - -return { - req('neotest'), - req('nvim-nio'), -} diff --git a/nvim/lua/plugins/test/neotest.lua b/nvim/lua/plugins/test/neotest.lua deleted file mode 100644 index 979b098..0000000 --- a/nvim/lua/plugins/test/neotest.lua +++ /dev/null @@ -1,146 +0,0 @@ -return { - 'neotest', - keys = { - { ' t', '', desc = '+test' }, - { - ' tl', - function() - require('neotest').run.run_last() - end, - desc = 'run last', - }, - { - ' to', - function() - require('neotest').output.open({ enter = true, auto_close = true }) - end, - desc = 'show output', - }, - { - ' tO', - function() - require('neotest').output_panel.toggle() - end, - desc = 'toggle output panel', - }, - { - ' tr', - function() - require('neotest').run.run() - end, - desc = 'run nearest', - }, - { - ' ts', - function() - require('neotest').summary.toggle() - end, - desc = 'toggle summary', - }, - { - ' tS', - function() - require('neotest').run.stop() - end, - desc = 'stop tests', - }, - { - ' tt', - function() - require('neotest').run.run(vim.fn.expand('%')) - end, - desc = 'run file tests', - }, - { - ' tT', - function() - require('neotest').run.run(vim.uv.cwd()) - end, - desc = 'run all tests', - }, - { - ' tw', - function() - require('neotest').watch.toggle(vim.fn.expand('%')) - end, - desc = 'toggle watch', - }, - }, - before = function() - require('lz.n').trigger_load({ - 'nvim-nio', - 'plenary.nvim', - 'nvim-treesitter', - }) - end, - after = function() - local neotest_ns = vim.api.nvim_create_namespace('neotest') - vim.diagnostic.config({ - virtual_text = { - format = function(diagnostic) - -- Replace newline/tab chars with spaces. - return diagnostic.message - :gsub('\n', ' ') - :gsub('\t', ' ') - :gsub('%s+', ' ') - :gsub('^%s+', ' ') - end, - }, - }, neotest_ns) - - local consumers = {} - -- Refresh and auto-close trouble after running tests. - local has_trouble, _ = pcall(require, 'trouble') - if has_trouble then - ---@type neotest.Consumer - consumers.trouble = function(client) - client.listeners.results = function(adapter_id, results, partial) - if partial then - return - end - - local tree = - assert(client:get_position(nil, { adapter = adapter_id })) - - local failed = 0 - for pos_id, result in pairs(results) do - if result.status == 'failed' and tree:get_key(pos_id) then - failed = failed + 1 - end - end - - vim.schedule(function() - local trouble = require('trouble') - - if trouble.is_open() then - trouble.refresh() - - if failed == 0 then - trouble.close() - end - end - end) - end - - return {} - end - end - - require('neotest').setup({ - status = { virtual_text = true }, - output = { virtual_text = true }, - - quickfix = { - open = function() - if has_trouble then - require('trouble').open({ mode = 'quickfix', focus = false }) - else - vim.cmd('copen') - end - end, - }, - - consumers = consumers, - }) - end, -} diff --git a/nvim/lua/plugins/test/nvim-nio.lua b/nvim/lua/plugins/test/nvim-nio.lua deleted file mode 100644 index 3c3cb59..0000000 --- a/nvim/lua/plugins/test/nvim-nio.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - 'nvim-nio', - lazy = true, -} diff --git a/nvim/lua/plugins/treesitter/init.lua b/nvim/lua/plugins/treesitter/init.lua deleted file mode 100644 index d87817b..0000000 --- a/nvim/lua/plugins/treesitter/init.lua +++ /dev/null @@ -1,7 +0,0 @@ -local req = MarleyVim.local_require('plugins.treesitter') - -return { - req('nvim-treesitter-textobjects'), - req('nvim-treesitter'), - req('nvim-ts-autotag'), -} diff --git a/nvim/lua/plugins/treesitter/nvim-treesitter-textobjects.lua b/nvim/lua/plugins/treesitter/nvim-treesitter-textobjects.lua deleted file mode 100644 index 8deffdf..0000000 --- a/nvim/lua/plugins/treesitter/nvim-treesitter-textobjects.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - 'nvim-treesitter-textobjects', - event = 'DeferredUIEnter', - before = function() - require('lz.n').trigger_load('nvim-treesitter') - end, -} diff --git a/nvim/lua/plugins/treesitter/nvim-treesitter.lua b/nvim/lua/plugins/treesitter/nvim-treesitter.lua deleted file mode 100644 index dbe94ec..0000000 --- a/nvim/lua/plugins/treesitter/nvim-treesitter.lua +++ /dev/null @@ -1,73 +0,0 @@ -return { - 'nvim-treesitter', - event = { 'BufReadPost', 'BufWritePost', 'BufNewFile', 'DeferredUIEnter' }, - keys = { - { ' ', desc = 'increment selection' }, - { ' ', desc = 'decrement selection', mode = 'x' }, - }, - before = function() - require('lz.n').trigger_load('which-key.nvim') - end, - after = function() - vim.filetype.add({ - extension = { rasi = 'rasi', rofi = 'rasi', wofi = 'rasi', env = 'conf' }, - filename = { ['.env'] = 'conf' }, - pattern = { - ['.*/waybar/config'] = 'jsonc', - ['.*/mako/config'] = 'dosini', - ['.*/kitty/.+%.conf'] = 'kitty', - ['.*/hypr/.+*.conf'] = 'hyprlang', - ['%.env%.[%w_.-]+'] = 'conf', - }, - }) - - -- Use the bash parser for kitty files. - vim.treesitter.language.register('bash', 'kitty') - - ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup({ - auto_install = false, - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = ' ', - node_incremental = '