Compare commits
48
Commits
b8ab1caf20
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf28a408eb | ||
|
|
0feb2c324e
|
||
|
|
3b18b6c7c0
|
||
|
|
1203d6be6c
|
||
|
|
9853ec0dbb
|
||
|
|
987a52e779
|
||
|
|
f6ed9c992c
|
||
|
|
10406758d8
|
||
|
|
2616b14b9f
|
||
|
|
1cf3eef5e9
|
||
|
|
8292ff741d
|
||
|
|
6dadd015bf
|
||
|
|
887ade2cd7
|
||
|
|
88467bfe52 | ||
|
|
3b27bbca7b
|
||
|
|
d8b6f1515f
|
||
|
|
2b6c4bc548
|
||
|
|
76ffa507c0 | ||
|
|
a28d4d2d8d
|
||
|
|
1960b27077
|
||
|
|
1d514baa0a
|
||
|
|
9af07644cd | ||
|
|
72a7ff5949 | ||
|
|
5becb7c8b5
|
||
|
|
37440d88e1
|
||
|
|
4e03b0e297
|
||
|
|
0fffee1c1a
|
||
|
|
51b5279d2e
|
||
|
|
098457b5d4 | ||
|
|
d1cd00d93b
|
||
|
|
60f2639971
|
||
|
|
53893986ec
|
||
|
|
5eb228750d
|
||
|
|
71434f947b
|
||
|
|
29d7fd98c8
|
||
|
|
11edf1e7d1
|
||
|
|
b26c0b1390
|
||
|
|
b78d3bafb7
|
||
|
|
6f427d791c
|
||
|
|
097e8d194b
|
||
|
|
1446912895
|
||
|
|
13a6236164
|
||
|
|
91107348ad
|
||
|
|
f097f4d3e0
|
||
|
|
1e4d97df8f | ||
|
|
d7c6096095 | ||
|
|
2c429163b8 | ||
|
|
241c2074d3 |
@@ -1,21 +1,30 @@
|
|||||||
-- Modules =====================================================================
|
-- Modules
|
||||||
vim.loader.enable()
|
vim.loader.enable()
|
||||||
vim.opt.runtimepath:remove("/usr/share/nvim/site")
|
vim.opt.runtimepath:remove('/usr/share/nvim/site')
|
||||||
vim.opt.runtimepath:remove("/usr/share/nvim/site/after")
|
for _, m in ipairs({
|
||||||
for _, m in ipairs({ "netrw", "netrwPlugin", "gzip", "tarPlugin", "zipPlugin", "tutor_mode_plugin" }) do
|
'netrw', 'netrwPlugin',
|
||||||
vim.g["loaded_" .. m] = 1 -- Block unused built-in modules
|
'gzip', 'tarPlugin',
|
||||||
|
'tutor_mode_plugin',
|
||||||
|
'remote_plugins',
|
||||||
|
'nvim_zip_plugin',
|
||||||
|
'nvim_net_plugin',
|
||||||
|
'spellfile_plugin',
|
||||||
|
}) do
|
||||||
|
vim.g['loaded_' .. m] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Config Global ===============================================================
|
for _, p in ipairs({ 'node', 'python3', 'perl', 'ruby' }) do
|
||||||
vim.pack.add({ "https://github.com/nvim-mini/mini.nvim" })
|
vim.g['loaded_' .. p .. '_provider'] = 0
|
||||||
local misc = require("mini.misc")
|
end
|
||||||
local gr = vim.api.nvim_create_augroup("custom-config", {})
|
|
||||||
|
-- Config Global
|
||||||
|
vim.pack.add({ 'https://github.com/nvim-mini/mini.nvim' })
|
||||||
|
local misc = require('mini.misc')
|
||||||
|
local gr = vim.api.nvim_create_augroup('custom-config', {})
|
||||||
|
|
||||||
_G.Config = {
|
_G.Config = {
|
||||||
now = function(f) misc.safely("now", f) end,
|
now = function(f) misc.safely('now', f) end,
|
||||||
later = function(f) misc.safely("later", f) end,
|
later = function(f) misc.safely('later', f) end,
|
||||||
on_event = function(ev, f) misc.safely("event:" .. ev, f) end,
|
|
||||||
on_filetype = function(ft, f) misc.safely("filetype:" .. ft, f) end,
|
|
||||||
autocmd = function(event, pattern, callback, desc, once)
|
autocmd = function(event, pattern, callback, desc, once)
|
||||||
vim.api.nvim_create_autocmd(event, { group = gr, pattern = pattern, callback = callback, desc = desc, once = once })
|
vim.api.nvim_create_autocmd(event, { group = gr, pattern = pattern, callback = callback, desc = desc, once = once })
|
||||||
end
|
end
|
||||||
|
|||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
local ns = vim.api.nvim_create_namespace('git_status')
|
||||||
|
local hls = { M = 'DiagnosticWarn', ['?'] = 'DiagnosticInfo', A = 'DiagnosticOk', D = 'DiagnosticError', R = 'DiagnosticWarn' }
|
||||||
|
|
||||||
|
local function show(buf_id, items, query)
|
||||||
|
MiniPick.default_show(buf_id, items, query)
|
||||||
|
vim.api.nvim_buf_clear_namespace(buf_id, ns, 0, -1)
|
||||||
|
for i, item in ipairs(items) do
|
||||||
|
if item.hl then
|
||||||
|
vim.api.nvim_buf_set_extmark(buf_id, ns, i - 1, 1, { end_col = 3, hl_group = item.hl, priority = 202, hl_mode = 'combine' })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
status = function()
|
||||||
|
local lines = vim.fn.systemlist('git status -s -u')
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
return vim.notify('Not a git repository', vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
|
||||||
|
local items = {}
|
||||||
|
for _, l in ipairs(lines) do
|
||||||
|
local s = l:sub(1, 2):match('%S+')
|
||||||
|
local p = l:sub(4):gsub('.* %-> ', ''):gsub('^"(.*)"$', '%1')
|
||||||
|
local hl = l:sub(1, 1) ~= ' ' and l:sub(1, 1) ~= '?' and 'DiagnosticOk' or hls[s:sub(1, 1)]
|
||||||
|
items[#items + 1] = {
|
||||||
|
text = string.format(' %-2s %s', s == '??' and '?' or s, p),
|
||||||
|
path = p,
|
||||||
|
hl = hl,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
if #items == 0 then return vim.notify('No changes', vim.log.levels.INFO) end
|
||||||
|
|
||||||
|
MiniPick.start({
|
||||||
|
source = { items = items, name = 'Git Status', show = show },
|
||||||
|
mappings = {
|
||||||
|
quickfix = {
|
||||||
|
char = '<C-q>',
|
||||||
|
func = function()
|
||||||
|
local m = MiniPick.get_picker_matches()
|
||||||
|
MiniPick.default_choose_marked(#m.marked > 0 and m.marked or m.all)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
local function run_task(cmd)
|
|
||||||
vim.notify(" Running: " .. cmd)
|
|
||||||
vim.cmd("enew")
|
|
||||||
|
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
|
||||||
pcall(vim.api.nvim_buf_set_name, buf, "just://" .. cmd)
|
|
||||||
|
|
||||||
vim.fn.termopen(cmd, {
|
|
||||||
on_exit = function(_, code)
|
|
||||||
if code == 0 then
|
|
||||||
vim.notify(" " .. cmd .. " success")
|
|
||||||
pcall(vim.cmd, "bdelete!")
|
|
||||||
else
|
|
||||||
vim.notify(" " .. cmd .. " failed (" .. code .. ")", vim.log.levels.ERROR)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Interactive picker for selecting and running tasks defined in a Justfile.
|
|
||||||
function M.pick_just_task()
|
|
||||||
local obj = vim.system({ "just", "--summary" }, { text = true }):wait()
|
|
||||||
if obj.code ~= 0 or not obj.stdout or obj.stdout == "" then
|
|
||||||
return vim.notify("No recipes or justfile found", vim.log.levels.WARN)
|
|
||||||
end
|
|
||||||
|
|
||||||
local recipes = vim.split(vim.trim(obj.stdout), "%s+")
|
|
||||||
require("mini.pick").start({
|
|
||||||
source = {
|
|
||||||
items = recipes,
|
|
||||||
name = " Just Tasks",
|
|
||||||
choose = function(choice)
|
|
||||||
run_task("just " .. choice)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
+15
-9
@@ -1,13 +1,19 @@
|
|||||||
local M = {}
|
local function open(cmd)
|
||||||
|
local lines = vim.o.lines - vim.o.cmdheight - (vim.o.laststatus > 0 and 1 or 0)
|
||||||
|
local w, h = math.floor(vim.o.columns * 0.95), math.floor(lines * 0.95)
|
||||||
|
local buf = vim.api.nvim_create_buf(false, true)
|
||||||
|
vim.bo[buf].bufhidden = 'wipe'
|
||||||
|
|
||||||
--- Opens a TUI application in a new scratch buffer and deletes the buffer on exit.
|
local win = vim.api.nvim_open_win(buf, true, {
|
||||||
function M.open_terminal_app(cmd)
|
relative = 'editor',
|
||||||
vim.cmd("enew")
|
width = w,
|
||||||
vim.fn.termopen(cmd, {
|
height = h,
|
||||||
on_exit = function()
|
row = math.floor((lines - h) / 2),
|
||||||
pcall(vim.cmd, "bdelete!")
|
col = math.floor((vim.o.columns - w) / 2),
|
||||||
end,
|
border = 'rounded',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.fn.termopen(cmd, { on_exit = function() pcall(vim.api.nvim_win_close, win, true) end })
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return { open = open }
|
||||||
|
|||||||
+9
-13
@@ -4,29 +4,25 @@
|
|||||||
"rev": "016802de402556da54c36bd7359b441266b01cdd",
|
"rev": "016802de402556da54c36bd7359b441266b01cdd",
|
||||||
"src": "https://github.com/stevearc/conform.nvim"
|
"src": "https://github.com/stevearc/conform.nvim"
|
||||||
},
|
},
|
||||||
"mason.nvim": {
|
|
||||||
"rev": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d",
|
|
||||||
"src": "https://github.com/mason-org/mason.nvim"
|
|
||||||
},
|
|
||||||
"mini.nvim": {
|
"mini.nvim": {
|
||||||
"rev": "fb2bbae327f3c306f3c825031345b89dd176ce60",
|
"rev": "ac5dffcc52b8378fbb15efeb0497a83e57a0b01c",
|
||||||
"src": "https://github.com/nvim-mini/mini.nvim"
|
"src": "https://github.com/nvim-mini/mini.nvim"
|
||||||
},
|
},
|
||||||
"neovim": {
|
"nvim-dap": {
|
||||||
"rev": "ff483051a47e27d84bdef47703538df1ed9f4a47",
|
"rev": "cfa2d58f4537aca6ca83e2de1a0d9f1491121264",
|
||||||
"src": "https://github.com/rose-pine/neovim"
|
"src": "https://github.com/mfussenegger/nvim-dap"
|
||||||
},
|
},
|
||||||
"nvim-lspconfig": {
|
"nvim-lspconfig": {
|
||||||
"rev": "684cb45c2faa24ce463b4fe9aaf011bfe1e0fb26",
|
"rev": "ac9d2f7c4757db6320cab6697fe73e5e8adb2457",
|
||||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||||
},
|
},
|
||||||
"nvim-treesitter": {
|
"nvim-treesitter": {
|
||||||
"rev": "857651fce37eba032ebe28f3a206283cdc65c45a",
|
"rev": "9a168f6357ed21c3a636e1727bc7d382abc451b8",
|
||||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
},
|
},
|
||||||
"nvim-treesitter-textobjects": {
|
"rose-pine": {
|
||||||
"rev": "898ee307df58f854d11cd7edd06472574d48014e",
|
"rev": "ff483051a47e27d84bdef47703538df1ed9f4a47",
|
||||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
|
"src": "https://github.com/rose-pine/neovim"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+44
-64
@@ -1,84 +1,64 @@
|
|||||||
-- General =====================================================================
|
-- General
|
||||||
vim.g.mapleader = ' ' -- Use `<Space>` as <Leader> key
|
vim.g.mapleader = ' ' -- Use `<Space>` as <Leader> key
|
||||||
vim.o.undofile = true -- Enable persistent undo
|
vim.o.undofile = true -- Enable persistent undo
|
||||||
vim.o.shada = "'100,<50,s10,:1000,/100,@100,h" -- Limit ShaDa file (for startup)
|
vim.o.shada = "'50,<20,s10,:100,/50,@50,h" -- Limit ShaDa file (for startup)
|
||||||
|
|
||||||
-- UI ==========================================================================
|
-- UI
|
||||||
vim.o.breakindent = true -- Indent wrapped lines to match line start
|
vim.o.breakindent = true -- Indent wrapped lines to match line start
|
||||||
vim.o.breakindentopt = 'list:-1' -- Add padding for lists (if 'wrap' is set)
|
vim.o.breakindentopt = 'list:-1' -- Add padding for lists (if 'wrap' is set)
|
||||||
vim.o.cursorline = true -- Enable current line highlighting
|
vim.o.cursorline = true -- Enable current line highlighting
|
||||||
vim.o.linebreak = true -- Wrap lines at 'breakat' (if 'wrap' is set)
|
vim.o.linebreak = true -- Wrap lines at 'breakat' (if 'wrap' is set)
|
||||||
vim.o.list = true -- Show helpful text indicators
|
vim.o.list = true -- Show helpful text indicators
|
||||||
vim.o.number = true -- Show line numbers
|
vim.o.listchars = 'tab:→ ,trail:·,nbsp:␣' -- Characters for list mode
|
||||||
vim.o.pumheight = 10 -- Make popup menu smaller
|
vim.o.number = true -- Show line numbers
|
||||||
vim.o.pummaxwidth = 100 -- Make popup menu not too wide
|
vim.o.pumheight = 10 -- Make popup menu smaller
|
||||||
vim.o.shortmess = 'CFOSWaco' -- Disable some built-in completion messages
|
vim.o.pummaxwidth = 80 -- Make popup menu not too wide
|
||||||
vim.o.signcolumn = 'yes' -- Always show signcolumn (less flicker)
|
vim.o.shortmess = 'CFOSWacou' -- Disable some built-in completion messages
|
||||||
vim.o.splitbelow = true -- Horizontal splits will be below
|
vim.o.signcolumn = 'yes' -- Always show signcolumn (less flicker)
|
||||||
vim.o.splitkeep = 'screen' -- Reduce scroll during window split
|
vim.o.splitbelow = true -- Horizontal splits will be below
|
||||||
vim.o.splitright = true -- Vertical splits will be to the right
|
vim.o.splitkeep = 'screen' -- Reduce scroll during window split
|
||||||
vim.o.wrap = false -- Don't visually wrap lines (toggle with \w)
|
vim.o.splitright = true -- Vertical splits will be to the right
|
||||||
vim.o.cmdheight = 0 -- Hide the command line when not in use
|
vim.o.wrap = false -- Don't visually wrap lines
|
||||||
vim.cmd('syntax off') -- Disable legacy syntax highlighting
|
vim.o.winborder = 'rounded' -- Use border in floating windows
|
||||||
require("vim._core.ui2").enable({ -- Enable new ui (requires nightly)
|
vim.o.pumborder = 'rounded' -- Use border in popup menu
|
||||||
msg = { targets = "msg" }
|
vim.o.cmdheight = 0 -- Hide the command line when not in use
|
||||||
|
vim.cmd('syntax off') -- Disable legacy syntax highlighting
|
||||||
|
require('vim._core.ui2').enable({ -- Enable new ui (requires nightly)
|
||||||
|
msg = { targets = 'msg' }
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Editing =====================================================================
|
-- Editing
|
||||||
vim.o.expandtab = true -- Convert tabs to spaces
|
vim.o.expandtab = true -- Convert tabs to spaces
|
||||||
vim.o.formatoptions = 'rqnl1j' -- Improve comment editing
|
vim.o.formatoptions = 'rqnl1j' -- Improve comment editing
|
||||||
vim.o.ignorecase = true -- Ignore case during search
|
vim.o.ignorecase = true -- Ignore case during search
|
||||||
vim.o.infercase = true -- Infer case in built-in completion
|
vim.o.infercase = true -- Infer case in built-in completion
|
||||||
vim.o.shiftwidth = 2 -- Use this number of spaces for indentation
|
vim.o.shiftwidth = 2 -- Use this number of spaces for indentation
|
||||||
vim.o.smartcase = true -- Respect case if search pattern has upper case
|
vim.o.smartcase = true -- Respect case if search pattern has upper case
|
||||||
vim.o.spelloptions = 'camel' -- Treat camelCase word parts as separate words
|
vim.o.spelloptions = 'camel' -- Treat camelCase word parts as separate words
|
||||||
vim.o.tabstop = 2 -- Show tab as this number of spaces
|
vim.o.tabstop = 2 -- Show tab as this number of spaces
|
||||||
vim.o.virtualedit = 'block' -- Allow going past end of line in blockwise mode
|
vim.o.virtualedit = 'block' -- Allow going past end of line in blockwise mode
|
||||||
vim.opt.autoread = true -- Do not prompt to reread files on update
|
|
||||||
|
|
||||||
-- Pattern for a start of numbered list (used in `gw`).
|
vim.o.complete = '.,w,b,kspell' -- Use less sources
|
||||||
vim.o.formatlistpat = [[^\s*[0-9\-\+\*]\+[\.\)]*\s\+]]
|
vim.o.completeopt = 'menuone,noselect,fuzzy' -- Use custom behavior
|
||||||
|
|
||||||
-- Built-in completion
|
-- Autocommands
|
||||||
vim.o.complete = '.,w,b,kspell' -- Use less sources
|
|
||||||
vim.o.completeopt = 'menuone,noselect,fuzzy,nosort' -- Use custom behavior
|
|
||||||
vim.o.completetimeout = 100 -- Limit sources delay
|
|
||||||
|
|
||||||
-- Autocommands ================================================================
|
|
||||||
Config.autocmd('TextYankPost', '*', function() vim.hl.hl_op() end, 'Highlight yanked text')
|
Config.autocmd('TextYankPost', '*', function() vim.hl.hl_op() end, 'Highlight yanked text')
|
||||||
Config.autocmd('TermOpen', '*', function() vim.cmd('startinsert') end, 'Start insert mode when terminal opens')
|
Config.autocmd('TermOpen', '*', function() vim.cmd('startinsert') end, 'Start insert mode when terminal opens')
|
||||||
|
Config.autocmd('LspAttach', '*', function(ev) vim.bo[ev.buf].complete = 'o' end, 'Use lsp completions')
|
||||||
|
|
||||||
-- Diagnostics =================================================================
|
-- Diagnostics
|
||||||
Config.later(function()
|
Config.later(function()
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
|
jump = { on_jump = vim.diagnostic.open_float },
|
||||||
signs = {
|
signs = {
|
||||||
priority = 9999,
|
priority = 9999,
|
||||||
severity = { min = 'WARN', max = 'ERROR' },
|
severity = { min = vim.diagnostic.severity.INFO },
|
||||||
text = {
|
text = {
|
||||||
[vim.diagnostic.severity.ERROR] = '',
|
[vim.diagnostic.severity.ERROR] = '',
|
||||||
[vim.diagnostic.severity.WARN] = '',
|
[vim.diagnostic.severity.WARN] = '',
|
||||||
[vim.diagnostic.severity.INFO] = '',
|
[vim.diagnostic.severity.INFO] = '',
|
||||||
[vim.diagnostic.severity.HINT] = '',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
underline = { severity = { min = 'HINT', max = 'ERROR' } },
|
virtual_text = false,
|
||||||
virtual_lines = false,
|
|
||||||
virtual_text = {
|
|
||||||
current_line = true,
|
|
||||||
severity = { min = 'ERROR', max = 'ERROR' },
|
|
||||||
},
|
|
||||||
update_in_insert = false,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local dap_signs = {
|
|
||||||
DapBreakpoint = { text = '', texthl = 'DapBreakpoint', linehl = '', numhl = '' },
|
|
||||||
DapBreakpointCondition = { text = '', texthl = 'DapBreakpointCondition', linehl = '', numhl = '' },
|
|
||||||
DapLogPoint = { text = '', texthl = 'DapLogPoint', linehl = '', numhl = '' },
|
|
||||||
DapStopped = { text = '', texthl = 'DapStopped', linehl = 'DapStoppedLine', numhl = '' },
|
|
||||||
DapBreakpointRejected = { text = '', texthl = 'DapBreakpointRejected', linehl = '', numhl = '' },
|
|
||||||
}
|
|
||||||
|
|
||||||
for name, sign in pairs(dap_signs) do
|
|
||||||
vim.fn.sign_define(name, sign)
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|||||||
+113
-112
@@ -1,133 +1,134 @@
|
|||||||
-- Clues =======================================================================
|
-- Clues
|
||||||
Config.leader_group_clues = {
|
Config.leader_group_clues = {
|
||||||
{ mode = "n", keys = "<Leader>b", desc = "+Buffer" },
|
{ mode = 'n', keys = '<Leader>b', desc = '+Buffer' },
|
||||||
{ mode = "n", keys = "<Leader>d", desc = "+Debug" },
|
{ mode = 'n', keys = '<Leader>d', desc = '+Debug' },
|
||||||
{ mode = "n", keys = "<Leader>e", desc = "+Explore" },
|
{ mode = 'n', keys = '<Leader>e', desc = '+Explore' },
|
||||||
{ mode = "n", keys = "<Leader>f", desc = "+Find" },
|
{ mode = 'n', keys = '<Leader>f', desc = '+Find' },
|
||||||
{ mode = "n", keys = "<Leader>g", desc = "+Git" },
|
{ mode = 'n', keys = '<Leader>g', desc = '+Git' },
|
||||||
{ mode = "n", keys = "<Leader>h", desc = "+Http" },
|
{ mode = 'n', keys = '<Leader>l', desc = '+Language' },
|
||||||
{ mode = "n", keys = "<Leader>l", desc = "+Language" },
|
{ mode = 'n', keys = '<Leader>r', desc = '+Request' },
|
||||||
{ mode = "n", keys = "<Leader>r", desc = "+Run" },
|
{ mode = 'n', keys = '<Leader>t', desc = '+Terminal' },
|
||||||
{ mode = "n", keys = "<Leader>s", desc = "+Session" },
|
{ mode = 'n', keys = '<Leader><Tab>', desc = '+Tab' },
|
||||||
{ mode = "n", keys = "<Leader>t", desc = "+Terminal" },
|
{ mode = 'x', keys = '<Leader>g', desc = '+Git' },
|
||||||
{ mode = "x", keys = "<Leader>g", desc = "+Git" },
|
{ mode = 'x', keys = '<Leader>l', desc = '+Language' },
|
||||||
{ mode = "x", keys = "<Leader>l", desc = "+Language" },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Helpers =====================================================================
|
-- Keymap Helpers
|
||||||
local function lazy_wrap(name, action)
|
local nmap_leader = function(suffix, rhs, desc)
|
||||||
return function()
|
vim.keymap.set('n', '<Leader>' .. suffix, rhs, { desc = desc, silent = true })
|
||||||
if Config["setup_" .. name] then Config["setup_" .. name]() end
|
|
||||||
action()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local nmap = function(lhs, rhs, desc, plugin)
|
local xmap_leader = function(suffix, rhs, desc)
|
||||||
local final_rhs = plugin and lazy_wrap(plugin, rhs) or rhs
|
vim.keymap.set('x', '<Leader>' .. suffix, rhs, { desc = desc, silent = true })
|
||||||
vim.keymap.set("n", lhs, final_rhs, { desc = desc })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local tmap = function(lhs, rhs, desc, plugin)
|
-- Buffers
|
||||||
local final_rhs = plugin and lazy_wrap(plugin, rhs) or rhs
|
local new_scratch_buffer = function()
|
||||||
vim.keymap.set("t", lhs, final_rhs, { desc = desc })
|
vim.api.nvim_win_set_buf(0, vim.api.nvim_create_buf(true, true))
|
||||||
end
|
end
|
||||||
|
|
||||||
local nmap_leader = function(suffix, rhs, desc, plugin)
|
local close_invisible_buffers = function()
|
||||||
local final_rhs = plugin and lazy_wrap(plugin, rhs) or rhs
|
|
||||||
vim.keymap.set("n", "<Leader>" .. suffix, final_rhs, { desc = desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
local xmap_leader = function(suffix, rhs, desc, plugin)
|
|
||||||
local final_rhs = plugin and lazy_wrap(plugin, rhs) or rhs
|
|
||||||
vim.keymap.set("x", "<Leader>" .. suffix, final_rhs, { desc = desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Buffers =====================================================================
|
|
||||||
nmap_leader("bd", function() pcall(vim.cmd, "bdelete") end, "Delete")
|
|
||||||
nmap_leader("bD", function() pcall(vim.cmd, "bdelete!") end, "Delete!")
|
|
||||||
nmap_leader("bw", function() pcall(vim.cmd, "bwipeout") end, "Wipeout")
|
|
||||||
nmap_leader("bW", function() pcall(vim.cmd, "bwipeout!") end, "Wipeout!")
|
|
||||||
nmap_leader("bo", function()
|
|
||||||
local visible = vim.iter(vim.api.nvim_list_wins()):map(vim.api.nvim_win_get_buf):totable()
|
local visible = vim.iter(vim.api.nvim_list_wins()):map(vim.api.nvim_win_get_buf):totable()
|
||||||
|
vim.iter(vim.api.nvim_list_bufs())
|
||||||
|
:filter(function(buf) return not vim.list_contains(visible, buf) end)
|
||||||
|
:each(function(buf) pcall(vim.api.nvim_buf_delete, buf, { force = false }) end)
|
||||||
|
end
|
||||||
|
|
||||||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
nmap_leader('bd', vim.cmd.bdelete, 'Delete')
|
||||||
if not vim.list_contains(visible, buf) then
|
nmap_leader('bs', new_scratch_buffer, 'Scratch')
|
||||||
pcall(vim.api.nvim_buf_delete, buf, { force = false })
|
nmap_leader('bw', vim.cmd.bwipeout, 'Wipeout')
|
||||||
end
|
nmap_leader('bo', close_invisible_buffers, 'Close invisible buffers')
|
||||||
end
|
|
||||||
end, "Close all invisible buffers")
|
|
||||||
|
|
||||||
-- Debug =======================================================================
|
-- Debug
|
||||||
nmap_leader("db", function() require("dap").toggle_breakpoint() end, "Toggle Breakpoint", "dap")
|
nmap_leader('db', function() require('dap').toggle_breakpoint() end, 'Toggle Breakpoint')
|
||||||
nmap_leader("dl", function() require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: ")) end,
|
nmap_leader('dl', function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point: ')) end, 'Log point')
|
||||||
"log point", "dap")
|
nmap_leader('dc', function() require('dap').continue() end, 'Run/Continue')
|
||||||
nmap_leader("dc", function() require("dap").continue() end, "Run/Continue", "dap")
|
nmap_leader('dC', function() require('dap').run_to_cursor() end, 'Run to Cursor')
|
||||||
nmap_leader("dC", function() require("dap").run_to_cursor() end, "Run to Cursor", "dap")
|
nmap_leader('de', function() require('dap.ui.widgets').hover() end, 'Inspect')
|
||||||
nmap_leader("de", function() require("dap.ui.widgets").hover() end, "Inspect", "dap")
|
nmap_leader('dr', function() require('dap').repl.open() end, 'Open REPL')
|
||||||
nmap_leader("dr", function() require("dap").repl.open() end, "Open repl", "dap")
|
nmap_leader('dt', function() require('dap').terminate() end, 'Terminate')
|
||||||
nmap_leader("dt", function() require("dap").terminate() end, "Terminate", "dap")
|
|
||||||
|
|
||||||
-- Explore =====================================================================
|
-- Explore
|
||||||
nmap_leader("ed", function() MiniFiles.open() end, "Directory")
|
local explore_at_file = function()
|
||||||
nmap_leader("ef",
|
local file = vim.api.nvim_buf_get_name(0)
|
||||||
function() MiniFiles.open(vim.uv.fs_stat(vim.api.nvim_buf_get_name(0)) and vim.api.nvim_buf_get_name(0) or nil) end,
|
MiniFiles.open(vim.uv.fs_stat(file) and file or nil)
|
||||||
"File directory")
|
end
|
||||||
|
|
||||||
-- Find ========================================================================
|
nmap_leader('ed', function() MiniFiles.open() end, 'Directory')
|
||||||
nmap_leader("fb", function() MiniPick.builtin.buffers() end, "Buffers")
|
nmap_leader('ef', explore_at_file, 'File directory')
|
||||||
nmap_leader("fc", function() MiniExtra.pickers.git_commits() end, "Commits (all)")
|
nmap_leader('ey', function() vim.fn.setreg('+', vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':.')) end, 'Yank relative path')
|
||||||
nmap_leader("fC", function() MiniExtra.pickers.git_commits({ path = "%" }) end, "Commits (buf)")
|
nmap_leader('eY', function() vim.fn.setreg('+', vim.api.nvim_buf_get_name(0)) end, 'Yank absolute path')
|
||||||
nmap_leader("fd", function() MiniExtra.pickers.diagnostic({ scope = "all" }) end, "Diagnostic workspace")
|
nmap_leader('en', vim.cmd.messages, 'Notifications')
|
||||||
nmap_leader("fD", function() MiniExtra.pickers.diagnostic({ scope = "current" }) end, "Diagnostic buffer")
|
|
||||||
nmap_leader("ff", function() MiniPick.builtin.files() end, "Files")
|
|
||||||
nmap_leader("fg", function() MiniPick.builtin.grep_live() end, "Grep live")
|
|
||||||
nmap_leader("fG", function() MiniPick.builtin.grep({ pattern = vim.fn.expand("<cword>") }) end, "Grep current word")
|
|
||||||
nmap_leader("fh", function() MiniPick.builtin.help() end, "Help tags")
|
|
||||||
nmap_leader("fl", function() MiniPick.builtin.buf_lines({ scope = "all" }) end, "Lines (all)")
|
|
||||||
nmap_leader("fL", function() MiniPick.builtin.buf_lines({ scope = "current" }) end, "Lines (buf)")
|
|
||||||
nmap_leader("fr", function() MiniPick.builtin.resume() end, "Resume")
|
|
||||||
nmap_leader("fs", function() MiniExtra.pickers.lsp({ scope = "workspace_symbol_live" }) end, "Symbols workspace (live)")
|
|
||||||
nmap_leader("fS", function() MiniExtra.pickers.lsp({ scope = "document_symbol" }) end, "Symbols document")
|
|
||||||
nmap_leader("f:", function() MiniExtra.pickers.history({ scope = ":" }) end, '":" history')
|
|
||||||
nmap_leader("f;", function() MiniExtra.pickers.history({ scope = ":" }) end, "Command history")
|
|
||||||
|
|
||||||
-- Git =========================================================================
|
-- Find
|
||||||
nmap_leader("go", function() MiniDiff.toggle_overlay() end, "Toggle overlay")
|
nmap_leader('fb', function() MiniPick.builtin.buffers() end, 'Buffers')
|
||||||
nmap_leader("gs", function() MiniGit.show_at_cursor() end, "Show at cursor")
|
nmap_leader('fc', function() MiniExtra.pickers.git_commits() end, 'Commits (all)')
|
||||||
xmap_leader("gs", function() MiniGit.show_at_cursor() end, "Show at selection")
|
nmap_leader('fC', function() MiniExtra.pickers.git_commits({ path = vim.fn.expand('%') }) end, 'Commits (buf)')
|
||||||
|
nmap_leader('fd', function() MiniExtra.pickers.diagnostic({ scope = 'all' }) end, 'Diagnostic workspace')
|
||||||
|
nmap_leader('fD', function() MiniExtra.pickers.diagnostic({ scope = 'current' }) end, 'Diagnostic buffer')
|
||||||
|
nmap_leader('ff', function() MiniPick.builtin.files() end, 'Files')
|
||||||
|
nmap_leader('fg', function() MiniPick.builtin.grep_live() end, 'Grep live')
|
||||||
|
nmap_leader('fG', function() MiniPick.builtin.grep({ pattern = vim.fn.expand('<cword>') }) end, 'Grep word')
|
||||||
|
nmap_leader('fh', function() MiniPick.builtin.help() end, 'Help tags')
|
||||||
|
nmap_leader('fl', function() MiniExtra.pickers.buf_lines({ scope = 'all' }) end, 'Lines (all)')
|
||||||
|
nmap_leader('fL', function() MiniExtra.pickers.buf_lines({ scope = 'current' }) end, 'Lines (buf)')
|
||||||
|
nmap_leader('fm', function() require('git').status() end, 'Modified / changed files')
|
||||||
|
nmap_leader('fo', function() MiniExtra.pickers.oldfiles() end, 'Old / recent files')
|
||||||
|
nmap_leader('fr', function() MiniPick.builtin.resume() end, 'Resume')
|
||||||
|
nmap_leader('fs', function() MiniExtra.pickers.lsp({ scope = 'workspace_symbol_live' }) end, 'Symbols workspace')
|
||||||
|
nmap_leader('fS', function() MiniExtra.pickers.lsp({ scope = 'document_symbol' }) end, 'Symbols document')
|
||||||
|
nmap_leader('f:', function() MiniExtra.pickers.history({ scope = ':' }) end, 'Command history')
|
||||||
|
|
||||||
-- HTTP ========================================================================
|
-- Git
|
||||||
nmap_leader("hr", function() require("kulala").run() end, "Send HTTP request", "kulala")
|
local diff_unstaged = function()
|
||||||
|
vim.cmd.diffthis()
|
||||||
|
vim.cmd('vert Git show :./%')
|
||||||
|
vim.cmd.diffthis()
|
||||||
|
end
|
||||||
|
|
||||||
-- Language ====================================================================
|
nmap_leader('ga', function() vim.cmd('Git add %') end, 'Add current file')
|
||||||
nmap_leader("la", function() vim.lsp.buf.code_action() end, "Actions")
|
nmap_leader('gd', diff_unstaged, 'Diff unstaged')
|
||||||
nmap_leader("ld", function() vim.diagnostic.open_float() end, "Diagnostic popup")
|
nmap_leader('gs', function() MiniGit.show_at_cursor() end, 'Show at cursor')
|
||||||
nmap_leader("lf", function() require("conform").format({ async = true }) end, "Format")
|
xmap_leader('gs', function() MiniGit.show_at_cursor() end, 'Show at selection')
|
||||||
nmap_leader("li", function() vim.lsp.buf.implementation() end, "Implementation")
|
|
||||||
nmap_leader("lh", function() vim.lsp.buf.hover() end, "Hover")
|
|
||||||
nmap_leader("ll", function() vim.lsp.codelens.run() end, "Lens")
|
|
||||||
nmap_leader("lr", function() vim.lsp.buf.rename() end, "Rename")
|
|
||||||
nmap_leader("lR", function() vim.lsp.buf.references() end, "References")
|
|
||||||
nmap_leader("ls", function() vim.lsp.buf.definition() end, "Source definition")
|
|
||||||
nmap_leader("lt", function() vim.lsp.buf.type_definition() end, "Type definition")
|
|
||||||
xmap_leader("lf", function() require("conform").format({ async = true }) end, "Format selection")
|
|
||||||
|
|
||||||
-- Run =========================================================================
|
-- Language
|
||||||
nmap_leader("r", function() require("just").pick_just_task() end, "Run Just Task")
|
nmap_leader('la', function() vim.lsp.buf.code_action() end, 'Actions')
|
||||||
|
nmap_leader('ld', function() vim.diagnostic.open_float() end, 'Diagnostic popup')
|
||||||
|
nmap_leader('lf', function() require('conform').format({ async = true }) end, 'Format')
|
||||||
|
xmap_leader('lf', function() require('conform').format({ async = true }) end, 'Format selection')
|
||||||
|
nmap_leader('li', function() vim.lsp.buf.implementation() end, 'Implementation')
|
||||||
|
nmap_leader('lh', function() vim.lsp.buf.hover() end, 'Hover')
|
||||||
|
nmap_leader('ll', function() vim.lsp.codelens.run() end, 'Lens')
|
||||||
|
nmap_leader('lr', function() vim.lsp.buf.rename() end, 'Rename')
|
||||||
|
nmap_leader('lR', function() vim.lsp.buf.references() end, 'References')
|
||||||
|
nmap_leader('ls', function() vim.lsp.buf.definition() end, 'Source definition')
|
||||||
|
nmap_leader('lt', function() vim.lsp.buf.type_definition() end, 'Type definition')
|
||||||
|
|
||||||
-- Session =====================================================================
|
-- Request
|
||||||
nmap_leader("sd", function() MiniSessions.select("delete") end, "Delete")
|
nmap_leader('rs', function() require('kulala').run() end, 'Send HTTP request')
|
||||||
nmap_leader("sn", function() vim.ui.input({ prompt = "Session name: " }, MiniSessions.write) end, "New")
|
|
||||||
nmap_leader("sr", function() MiniSessions.select("read") end, "Read")
|
|
||||||
nmap_leader("sR", function() MiniSessions.restart() end, "Restart")
|
|
||||||
nmap_leader("sw", function() MiniSessions.write() end, "Write current")
|
|
||||||
|
|
||||||
-- Terminal ====================================================================
|
-- Terminal
|
||||||
nmap_leader("tT", function() vim.cmd("horizontal term") end, "Terminal (horizontal)")
|
local open_ai = function()
|
||||||
nmap_leader("tt", function() vim.cmd("vertical term") end, "Terminal (vertical)")
|
vim.cmd('vertical term ' .. (vim.fn.executable('pi') == 1 and 'pi' or 'claude'))
|
||||||
nmap_leader("tg", function() require("terminal").open_terminal_app("lazygit") end, "LazyGit")
|
end
|
||||||
nmap_leader("ts", function() require("terminal").open_terminal_app("lazysql") end, "LazySQL")
|
|
||||||
|
|
||||||
-- Overwrites ==================================================================
|
nmap_leader('tT', function() vim.cmd('horizontal term') end, 'Terminal (horizontal)')
|
||||||
nmap("<Esc>", function() vim.cmd("nohlsearch") end, "Clear search highlights")
|
nmap_leader('tt', function() vim.cmd('vertical term') end, 'Terminal (vertical)')
|
||||||
tmap("<C-w>", "<C-\\><C-n><C-w>", "Terminal window navigation")
|
nmap_leader('ta', open_ai, 'AI')
|
||||||
|
nmap_leader('tf', function() require('terminal').open(vim.o.shell) end, 'Terminal (popup)')
|
||||||
|
nmap_leader('tg', function() require('terminal').open('lazygit') end, 'LazyGit')
|
||||||
|
nmap_leader('ts', function() require('terminal').open('lazysql') end, 'LazySQL')
|
||||||
|
|
||||||
|
-- Tabs
|
||||||
|
nmap_leader('<Tab><Tab>', vim.cmd.tabnew, 'New tab')
|
||||||
|
nmap_leader('<Tab>d', vim.cmd.tabclose, 'Close tab')
|
||||||
|
nmap_leader('<Tab>]', vim.cmd.tabnext, 'Next tab')
|
||||||
|
nmap_leader('<Tab>[', vim.cmd.tabprevious, 'Previous tab')
|
||||||
|
|
||||||
|
-- Brackets
|
||||||
|
vim.keymap.set('n', ']d', function() vim.diagnostic.jump({ count = 1 }) end, { desc = 'Next diagnostic' })
|
||||||
|
vim.keymap.set('n', '[d', function() vim.diagnostic.jump({ count = -1 }) end, { desc = 'Previous diagnostic' })
|
||||||
|
|
||||||
|
-- Overwrites
|
||||||
|
vim.keymap.set('n', '<Esc>', vim.cmd.nohlsearch, { desc = 'Clear highlights', silent = true })
|
||||||
|
vim.keymap.set('t', '<C-w>', '<C-\\><C-n><C-w>', { desc = 'Terminal window navigation', silent = true })
|
||||||
|
|||||||
+46
-74
@@ -1,25 +1,41 @@
|
|||||||
-- UI ==========================================================================
|
-- UI
|
||||||
Config.now(function()
|
Config.now(function()
|
||||||
-- Global icon provider.
|
-- Global icon provider
|
||||||
require('mini.icons').setup()
|
require('mini.icons').setup()
|
||||||
Config.later(MiniIcons.tweak_lsp_kind)
|
Config.later(MiniIcons.tweak_lsp_kind)
|
||||||
|
|
||||||
-- Start screen.
|
|
||||||
require('mini.starter').setup()
|
|
||||||
|
|
||||||
-- Statusline.
|
|
||||||
require('mini.statusline').setup()
|
require('mini.statusline').setup()
|
||||||
|
|
||||||
-- Session management.
|
local starter = require('mini.starter')
|
||||||
require('mini.sessions').setup()
|
starter.setup({
|
||||||
|
items = {
|
||||||
|
function()
|
||||||
|
return vim.iter({ vim.fn.glob('~/Code/*', 0, 1), vim.fn.glob('~/Documents/*/*', 0, 1) })
|
||||||
|
:flatten()
|
||||||
|
:filter(function(p) return vim.fn.isdirectory(p) == 1 end)
|
||||||
|
:map(function(p)
|
||||||
|
return {
|
||||||
|
name = vim.fn.fnamemodify(p, ':t'),
|
||||||
|
action = function()
|
||||||
|
vim.fn.chdir(p)
|
||||||
|
require('mini.files').open(p)
|
||||||
|
end,
|
||||||
|
section = 'Projects',
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
:totable()
|
||||||
|
end,
|
||||||
|
|
||||||
|
starter.sections.builtin_actions(),
|
||||||
|
},
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Config.later(function()
|
Config.later(function()
|
||||||
-- Git diff indicators.
|
-- Git diff indicators
|
||||||
require('mini.diff').setup()
|
require('mini.diff').setup()
|
||||||
require('mini.git').setup()
|
require('mini.git').setup()
|
||||||
|
|
||||||
-- Keymap hints.
|
-- Keymap hints
|
||||||
local miniclue = require('mini.clue')
|
local miniclue = require('mini.clue')
|
||||||
miniclue.setup({
|
miniclue.setup({
|
||||||
clues = {
|
clues = {
|
||||||
@@ -33,86 +49,42 @@ Config.later(function()
|
|||||||
miniclue.gen_clues.z(),
|
miniclue.gen_clues.z(),
|
||||||
},
|
},
|
||||||
triggers = {
|
triggers = {
|
||||||
{ mode = { 'n', 'x' }, keys = '<Leader>' }, -- Leader triggers
|
{ mode = { 'n', 'x' }, keys = '<Leader>' },
|
||||||
{ mode = 'n', keys = '\\' }, -- mini.basics
|
{ mode = { 'n', 'x' }, keys = '[' },
|
||||||
{ mode = { 'n', 'x' }, keys = '[' }, -- mini.bracketed
|
|
||||||
{ mode = { 'n', 'x' }, keys = ']' },
|
{ mode = { 'n', 'x' }, keys = ']' },
|
||||||
{ mode = 'i', keys = '<C-x>' }, -- Built-in completion
|
{ mode = 'i', keys = '<C-x>' },
|
||||||
{ mode = { 'n', 'x' }, keys = 'g' }, -- `g` key
|
{ mode = { 'n', 'x' }, keys = 'g' },
|
||||||
{ mode = { 'n', 'x' }, keys = "'" }, -- Marks
|
{ mode = { 'n', 'x' }, keys = "'" },
|
||||||
{ mode = { 'n', 'x' }, keys = '`' },
|
{ mode = { 'n', 'x' }, keys = '`' },
|
||||||
{ mode = { 'n', 'x' }, keys = '"' }, -- Registers
|
{ mode = { 'n', 'x' }, keys = '"' },
|
||||||
{ mode = { 'i', 'c' }, keys = '<C-r>' },
|
{ mode = { 'i', 'c' }, keys = '<C-r>' },
|
||||||
{ mode = 'n', keys = '<C-w>' }, -- Window commands
|
{ mode = 'n', keys = '<C-w>' },
|
||||||
{ mode = { 'n', 'x' }, keys = 's' }, -- `s` key (mini.surround, etc.)
|
{ mode = { 'n', 'x' }, keys = 's' },
|
||||||
{ mode = { 'n', 'x' }, keys = 'z' }, -- `z` key
|
{ mode = { 'n', 'x' }, keys = 'z' },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Editing =====================================================================
|
-- Editing & Navigation
|
||||||
Config.later(function()
|
Config.later(function()
|
||||||
-- Enhanced text objects (a/i).
|
|
||||||
require('mini.ai').setup()
|
require('mini.ai').setup()
|
||||||
|
|
||||||
-- Auto-close brackets and quotes.
|
|
||||||
require('mini.pairs').setup()
|
require('mini.pairs').setup()
|
||||||
|
|
||||||
-- Surround functionality (add/delete/replace).
|
|
||||||
require('mini.surround').setup()
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Navigation ==================================================================
|
|
||||||
Config.now_if_args(function()
|
|
||||||
-- File system explorer.
|
|
||||||
require('mini.files').setup()
|
|
||||||
local add_marks = function()
|
|
||||||
MiniFiles.set_bookmark('c', vim.fn.stdpath('config'), { desc = 'Config' })
|
|
||||||
MiniFiles.set_bookmark('d', vim.fn.expand('~/Documents'), { desc = 'Documents' })
|
|
||||||
MiniFiles.set_bookmark('w', vim.fn.getcwd, { desc = 'Working directory' })
|
|
||||||
end
|
|
||||||
Config.autocmd('User', 'MiniFilesExplorerOpen', add_marks, 'Add default marks')
|
|
||||||
end)
|
|
||||||
|
|
||||||
Config.later(function()
|
|
||||||
-- Fuzzy picker.
|
|
||||||
require('mini.pick').setup()
|
require('mini.pick').setup()
|
||||||
|
require('mini.extra').setup()
|
||||||
-- Square bracket navigation.
|
MiniPick.registry.git_status = function() require('git').status() end
|
||||||
require('mini.bracketed').setup()
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Completion ==================================================================
|
-- File Explorer
|
||||||
Config.now_if_args(function()
|
Config.now_if_args(function()
|
||||||
-- Autocompletion and signature help.
|
require('mini.files').setup()
|
||||||
require('mini.completion').setup({
|
Config.autocmd('User', 'MiniFilesExplorerOpen', function()
|
||||||
lsp_completion = {
|
MiniFiles.set_bookmark('c', vim.fn.stdpath('config'), { desc = 'Config' })
|
||||||
source_func = 'omnifunc',
|
MiniFiles.set_bookmark('w', vim.fn.getcwd, { desc = 'Working directory' })
|
||||||
auto_setup = false,
|
end, 'Add default marks')
|
||||||
process_items = function(items, base)
|
|
||||||
return MiniCompletion.default_process_items(items, base, { kind_priority = { Text = -1 } })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Set 'omnifunc' for LSP completion only when needed.
|
|
||||||
local on_attach = function(ev)
|
|
||||||
vim.bo[ev.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp'
|
|
||||||
end
|
|
||||||
Config.autocmd('LspAttach', nil, on_attach, "Set 'omnifunc'")
|
|
||||||
|
|
||||||
-- Advertise to servers that Neovim supports certain set of completion features.
|
|
||||||
vim.lsp.config('*', { capabilities = MiniCompletion.get_lsp_capabilities() })
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Utilities ===================================================================
|
-- Utilities
|
||||||
Config.now_if_args(function()
|
Config.now_if_args(function()
|
||||||
-- Miscellaneous utility functions.
|
|
||||||
require('mini.misc').setup()
|
require('mini.misc').setup()
|
||||||
MiniMisc.setup_auto_root()
|
MiniMisc.setup_auto_root()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Config.later(function()
|
|
||||||
-- Extra functionality (pickers, clues).
|
|
||||||
require('mini.extra').setup()
|
|
||||||
end)
|
|
||||||
|
|||||||
+73
-99
@@ -1,132 +1,106 @@
|
|||||||
-- Colortheme ==================================================================
|
-- Colortheme
|
||||||
Config.now(function()
|
Config.now(function()
|
||||||
vim.pack.add({ "https://github.com/rose-pine/neovim" })
|
vim.pack.add({ { src = 'https://github.com/rose-pine/neovim', name = 'rose-pine' } })
|
||||||
require("rose-pine").setup({
|
require('rose-pine').setup({
|
||||||
enable = {
|
enable = { terminal = false, legacy_highlights = false, migrations = false, },
|
||||||
legacy_highlights = false,
|
styles = { italic = false },
|
||||||
migrations = false,
|
highlight_groups = {
|
||||||
|
MiniDiffOverAdd = { fg = 'NONE', bg = 'foam', blend = 20 },
|
||||||
|
MiniDiffOverChangeBuf = { bg = 'rose', blend = 20 },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
vim.cmd("colorscheme rose-pine")
|
|
||||||
|
vim.cmd.colorscheme('rose-pine')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Treesitter ==================================================================
|
-- Treesitter
|
||||||
Config.now_if_args(function()
|
Config.now_if_args(function()
|
||||||
vim.pack.add({
|
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
||||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
vim.treesitter.language.register('bash', 'sh')
|
||||||
'https://github.com/nvim-treesitter/nvim-treesitter-textobjects',
|
vim.treesitter.language.register('tsx', 'typescriptreact')
|
||||||
})
|
|
||||||
|
|
||||||
vim.treesitter.language.register('tsx', { 'typescriptreact' })
|
|
||||||
|
|
||||||
local filetypes = {
|
local filetypes = {
|
||||||
'html', 'css', 'lua', 'go', 'php', 'blade', 'sql', 'javascript',
|
'html', 'css', 'lua', 'go', 'php', 'blade', 'sql', 'javascript',
|
||||||
'typescript', 'typescriptreact', 'dockerfile', 'yaml', 'markdown', 'dart',
|
'typescript', 'typescriptreact', 'svelte', 'dockerfile', 'yaml', 'markdown', 'dart',
|
||||||
'json', 'xml', 'toml', 'sh', 'bash', 'zsh', 'gitcommit', 'diff', 'regex', 'http'
|
'json', 'xml', 'toml', 'sh', 'zsh', 'just', 'gitcommit', 'diff', 'regex', 'http'
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.autocmd('FileType', filetypes, function(ev)
|
Config.autocmd('FileType', filetypes, function(ev)
|
||||||
if pcall(vim.treesitter.start, ev.buf) then
|
if pcall(vim.treesitter.start, ev.buf) and vim.bo[ev.buf].filetype == 'php' then
|
||||||
if vim.bo[ev.buf].filetype == 'php' then
|
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
-- fixes broken indentation on `o` in php buffers
|
|
||||||
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end, 'Start tree-sitter')
|
end, 'Start tree-sitter')
|
||||||
|
|
||||||
Config.later(function()
|
Config.later(function()
|
||||||
require('nvim-treesitter').install(vim.tbl_map(function(ft)
|
local missing = {}
|
||||||
return vim.treesitter.language.get_lang(ft) or ft
|
|
||||||
end, filetypes))
|
for _, ft in ipairs(filetypes) do
|
||||||
|
local lang = vim.treesitter.language.get_lang(ft) or ft
|
||||||
|
if #vim.api.nvim_get_runtime_file('parser/' .. lang .. '.so', false) == 0 then
|
||||||
|
table.insert(missing, lang)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #missing > 0 then
|
||||||
|
require('nvim-treesitter').install(missing)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Mason =======================================================================
|
-- LSP
|
||||||
Config.now_if_args(function()
|
Config.now_if_args(function()
|
||||||
vim.pack.add({ "https://github.com/mason-org/mason.nvim" })
|
vim.pack.add({ 'https://github.com/neovim/nvim-lspconfig' })
|
||||||
require("mason").setup()
|
vim.lsp.enable({ 'ansiblels', 'gopls', 'phpantom_lsp', 'svelte', 'tailwindcss', 'tsc', 'biome' })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- LSP =========================================================================
|
-- Formatting
|
||||||
Config.now_if_args(function()
|
Config.later(function()
|
||||||
vim.pack.add({ "https://github.com/neovim/nvim-lspconfig" })
|
vim.pack.add({ 'https://github.com/stevearc/conform.nvim' })
|
||||||
|
require('conform').setup({
|
||||||
vim.lsp.enable({
|
default_format_opts = { lsp_format = 'fallback' },
|
||||||
"ansiblels",
|
format_on_save = { lsp_format = 'fallback', timeout_ms = 1000 },
|
||||||
"gopls",
|
|
||||||
"intelephense",
|
|
||||||
"lua_ls",
|
|
||||||
"tailwindcss",
|
|
||||||
"tsc",
|
|
||||||
"dartls"
|
|
||||||
})
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Formatting ==================================================================
|
|
||||||
Config.now_if_args(function()
|
|
||||||
vim.pack.add({ "https://github.com/stevearc/conform.nvim" })
|
|
||||||
|
|
||||||
require("conform").setup({
|
|
||||||
default_format_opts = { lsp_format = "fallback" },
|
|
||||||
format_on_save = {
|
|
||||||
lsp_format = "fallback",
|
|
||||||
timeout_ms = 1000,
|
|
||||||
},
|
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
go = { "gofumpt", "goimports" },
|
go = { 'gofumpt', 'goimports' },
|
||||||
php = { "php_cs_fixer" },
|
php = { 'php_cs_fixer' },
|
||||||
|
json = { 'jq' },
|
||||||
|
javascript = { 'biome' },
|
||||||
|
typescript = { 'biome' },
|
||||||
|
javascriptreact = { 'biome' },
|
||||||
|
typescriptreact = { 'biome' },
|
||||||
|
svelte = { 'biome' },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- DAP =========================================================================
|
-- DAP
|
||||||
function Config.setup_dap()
|
Config.later(function()
|
||||||
Config.setup_dap = nil
|
vim.pack.add({ 'https://github.com/mfussenegger/nvim-dap' })
|
||||||
vim.pack.add({ "https://github.com/mfussenegger/nvim-dap" })
|
|
||||||
|
|
||||||
local dap = require("dap")
|
local dap_signs = {
|
||||||
dap.adapters.php = {
|
DapBreakpoint = { text = '', texthl = 'DapBreakpoint' },
|
||||||
type = "executable",
|
DapBreakpointCondition = { text = '', texthl = 'DapBreakpointCondition' },
|
||||||
command = "node",
|
DapLogPoint = { text = '', texthl = 'DapLogPoint' },
|
||||||
args = { vim.fn.stdpath("data") .. "/mason/packages/php-debug-adapter/extension/out/phpDebug.js" },
|
DapStopped = { text = '', texthl = 'DapStopped', linehl = 'DapStoppedLine' },
|
||||||
|
DapBreakpointRejected = { text = '', texthl = 'DapBreakpointRejected' },
|
||||||
}
|
}
|
||||||
dap.adapters.go = {
|
for name, sign in pairs(dap_signs) do
|
||||||
type = "server",
|
vim.fn.sign_define(name, sign)
|
||||||
host = "127.0.0.1",
|
end
|
||||||
port = "${port}",
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Kulala ======================================================================
|
require('dap').adapters.go = { type = 'server', host = '127.0.0.1', port = '${port}' }
|
||||||
function Config.setup_kulala()
|
end)
|
||||||
Config.setup_kulala = nil
|
|
||||||
vim.pack.add({ "https://github.com/mistweaverco/kulala.nvim" })
|
|
||||||
require("kulala").setup({ default_env = "dev" })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Laravel =====================================================================
|
-- Kulala
|
||||||
function Config.setup_laravel()
|
Config.autocmd('FileType', 'http', function()
|
||||||
Config.setup_laravel = nil
|
vim.pack.add({ 'https://github.com/mistweaverco/kulala.nvim' })
|
||||||
|
require('kulala').setup({ default_env = 'dev' })
|
||||||
|
end, 'Setup Kulala', true)
|
||||||
|
|
||||||
|
-- Flutter
|
||||||
|
Config.autocmd('FileType', 'dart', function()
|
||||||
vim.pack.add({
|
vim.pack.add({
|
||||||
"https://github.com/MunifTanjim/nui.nvim",
|
'https://github.com/nvim-lua/plenary.nvim',
|
||||||
"https://github.com/nvim-lua/plenary.nvim",
|
'https://github.com/nvim-flutter/flutter-tools.nvim',
|
||||||
"https://github.com/nvim-neotest/nvim-nio",
|
|
||||||
"https://github.com/adalessa/laravel.nvim",
|
|
||||||
})
|
})
|
||||||
|
require('flutter-tools').setup({ lsp = { color_capabilities = true } })
|
||||||
require("laravel").setup({})
|
end, 'Setup flutter', true)
|
||||||
end
|
|
||||||
|
|
||||||
-- Flutter =====================================================================
|
|
||||||
function Config.setup_flutter()
|
|
||||||
Config.setup_flutter = nil
|
|
||||||
vim.pack.add({
|
|
||||||
"https://github.com/nvim-lua/plenary.nvim",
|
|
||||||
"https://github.com/nvim-flutter/flutter-tools.nvim",
|
|
||||||
})
|
|
||||||
|
|
||||||
require("flutter-tools").setup({ lsp = { color_capabilities = true } })
|
|
||||||
end
|
|
||||||
|
|
||||||
Config.autocmd('FileType', 'php', Config.setup_laravel, "Setup laravel", true)
|
|
||||||
Config.autocmd('FileType', 'dart', Config.setup_flutter, "Setup flutter", true)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user