Compare commits
1
Commits
main
..
2eb0dca693
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2eb0dca693
|
No files matched your search
@@ -0,0 +1,8 @@
|
||||
tt.*
|
||||
.tests
|
||||
doc/tags
|
||||
debug
|
||||
.repro
|
||||
foo.*
|
||||
*.log
|
||||
data
|
||||
@@ -1,20 +1 @@
|
||||
-- Modules
|
||||
vim.loader.enable()
|
||||
vim.opt.runtimepath:remove('/usr/share/nvim/site')
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- 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 = {
|
||||
now = function(f) misc.safely('now', f) end,
|
||||
later = function(f) misc.safely('later', f) end,
|
||||
autocmd = function(event, pattern, callback, desc, once)
|
||||
vim.api.nvim_create_autocmd(event, { group = gr, pattern = pattern, callback = callback, desc = desc, once = once })
|
||||
end,
|
||||
command = function(name, callback, desc, opts)
|
||||
vim.api.nvim_create_user_command(name, callback, vim.tbl_extend('force', { desc = desc }, opts or {}))
|
||||
end,
|
||||
}
|
||||
require("config.lazy")
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"LazyVim": { "branch": "main", "commit": "fca0af57cc3851b14f96a795a9c9bfafc5096dd1" },
|
||||
"blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" },
|
||||
"catppuccin": { "branch": "main", "commit": "c4d475e4b5684747cde9b3f849186af7837d4397" },
|
||||
"conform.nvim": { "branch": "master", "commit": "40dcec5555f960b0a04340d76eabdf4efe78599d" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3" },
|
||||
"laravel.nvim": { "branch": "main", "commit": "4e48d7a5783155475f578da2ec85451c50f41fe7" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a324581a3c83fdacdb9804b79de1cbe00ce18550" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"mini.ai": { "branch": "main", "commit": "4b0a6207341d895b6cfe9bcb1e4d3e8607bfe4f4" },
|
||||
"mini.icons": { "branch": "main", "commit": "5b9076dae1bfbe47ba4a14bc8b967cde0ab5d77e" },
|
||||
"mini.pairs": { "branch": "main", "commit": "b7fde3719340946feb75017ef9d75edebdeb0566" },
|
||||
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-lint": { "branch": "master", "commit": "606b823a57b027502a9ae00978ebf4f5d5158098" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "2163c54bb6cfec53e3e555665ada945b8c8331b9" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "ebe76eb800d4e8df754fc96f8a7b84f578224a97" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "0bc4ef0a34d80fd6e67b59bd71fcbb0ef9ef4756" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"rose-pine": { "branch": "main", "commit": "cf2a288696b03d0934da713d66c6d71557b5c997" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "9912042fc8bca2209105526ac7534e9a0c2071b2" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
||||
"ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extras": [
|
||||
"lazyvim.plugins.extras.editor.snacks_explorer",
|
||||
"lazyvim.plugins.extras.editor.snacks_picker"
|
||||
],
|
||||
"install_version": 7,
|
||||
"news": {
|
||||
"NEWS.md": "11866"
|
||||
},
|
||||
"version": 8
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
lazy = false,
|
||||
version = false,
|
||||
},
|
||||
install = {},
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = true,
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
vim.o.tw = 60
|
||||
vim.o.clipboard = ""
|
||||
vim.g.snacks_animate = false
|
||||
vim.g.lazyvim_php_lsp = "intelephense"
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
local ns = vim.api.nvim_create_namespace('git')
|
||||
local status_hl = { M = 'DiagnosticWarn', A = 'DiagnosticOk', D = 'DiagnosticError', ['?'] = 'DiagnosticInfo' }
|
||||
|
||||
local function git(args)
|
||||
local result = vim.system(vim.list_extend({ 'git', '-c', 'core.quotepath=false' }, args)):wait()
|
||||
if result.code ~= 0 then error(vim.trim(result.stderr), 0) end
|
||||
return result.stdout
|
||||
end
|
||||
|
||||
-- Picker lines look like ' M path'; colour the status letter
|
||||
local function show(buf, items, query)
|
||||
MiniPick.default_show(buf, items, query)
|
||||
vim.api.nvim_buf_clear_namespace(buf, ns, 0, -1)
|
||||
for i, item in ipairs(items) do
|
||||
vim.api.nvim_buf_set_extmark(buf, ns, i - 1, 1, { end_col = 2, hl_group = status_hl[item.status], priority = 202, hl_mode = 'combine' })
|
||||
end
|
||||
end
|
||||
|
||||
-- Diff the current file against its staged version
|
||||
local function diff()
|
||||
vim.cmd('diffthis')
|
||||
vim.cmd('vertical Git show :./%')
|
||||
vim.cmd('diffthis')
|
||||
end
|
||||
|
||||
-- Pick an unstaged file; picking a deleted file stages the deletion
|
||||
local function status()
|
||||
local items = {}
|
||||
for _, line in ipairs(vim.split(git({ 'status', '--short', '--untracked-files' }), '\n', { trimempty = true })) do
|
||||
local s = line:sub(2, 2)
|
||||
local path = line:sub(4):gsub('.* %-> ', ''):gsub('^"(.*)"$', '%1')
|
||||
if s ~= ' ' then table.insert(items, { status = s, path = path, text = ' ' .. s .. ' ' .. path }) end
|
||||
end
|
||||
|
||||
local function choose(item)
|
||||
if vim.uv.fs_stat(item.path) then return MiniPick.default_choose(item) end
|
||||
git({ 'add', '--', item.path })
|
||||
end
|
||||
|
||||
MiniPick.start({ source = { name = 'Git status', items = items, show = show, choose = choose } })
|
||||
end
|
||||
|
||||
-- Write `path` as it is at `rev` to a temp file (empty if it doesn't exist there)
|
||||
local function file_at(rev, path)
|
||||
local file = vim.fn.tempname() .. '/' .. path
|
||||
vim.fn.mkdir(vim.fs.dirname(file), 'p')
|
||||
local content = rev and vim.F.npcall(git, { 'show', rev .. ':' .. path }) or ''
|
||||
vim.fn.writefile(vim.split(content, '\n'), file, 'b')
|
||||
return file
|
||||
end
|
||||
|
||||
-- Open `right` in the current window and diff it against `left` in a split, replacing the previous split
|
||||
local split
|
||||
local function open_diff(left, right)
|
||||
if split and vim.api.nvim_win_is_valid(split) then vim.api.nvim_win_close(split, true) end
|
||||
vim.cmd('edit ' .. vim.fn.fnameescape(right))
|
||||
vim.cmd('leftabove vertical diffsplit ' .. vim.fn.fnameescape(left))
|
||||
split = vim.api.nvim_get_current_win()
|
||||
vim.cmd('wincmd p')
|
||||
end
|
||||
|
||||
-- Last review, refreshed by `review()` without args
|
||||
local last = {}
|
||||
|
||||
-- Review changes since the merge-base with `base` (default @{upstream}, i.e. unpushed commits) up to `head`.
|
||||
-- Without `head` the working tree is used, so the right side is your real, editable file.
|
||||
local function review(base, head)
|
||||
if base or not last.base then last = { base = base or '@{upstream}', head = head, seen = {} } end
|
||||
local root = vim.trim(git({ 'rev-parse', '--show-toplevel' }))
|
||||
local merge_base = vim.trim(git({ 'merge-base', last.base, last.head or 'HEAD' }))
|
||||
local range = last.head and (merge_base .. '..' .. last.head) or merge_base
|
||||
|
||||
local items = {}
|
||||
for _, line in ipairs(vim.split(git({ 'diff', '--name-status', '--no-renames', range }), '\n', { trimempty = true })) do
|
||||
local s, path = line:match('^(%a)\t(.*)$')
|
||||
table.insert(items, { status = s, path = path, text = ' ' .. s .. ' ' .. path })
|
||||
end
|
||||
|
||||
-- ✓ is drawn on display (not part of the text) so it stays current when the picker is resumed
|
||||
local function show_seen(buf, shown, query)
|
||||
show(buf, shown, query)
|
||||
for i, item in ipairs(shown) do
|
||||
if last.seen[item.path] then
|
||||
vim.api.nvim_buf_set_extmark(buf, ns, i - 1, 3, { virt_text = { { '✓' } }, virt_text_pos = 'overlay' })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function preview(buf, item)
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(git({ 'diff', range, '--', ':/' .. item.path }), '\n'))
|
||||
vim.bo[buf].filetype = 'diff'
|
||||
end
|
||||
|
||||
local function choose(item)
|
||||
last.seen[item.path] = true
|
||||
local real_file = root .. '/' .. item.path
|
||||
local left = file_at(merge_base, item.path)
|
||||
local right = (not last.head and vim.uv.fs_stat(real_file)) and real_file or file_at(last.head, item.path)
|
||||
vim.schedule(function() open_diff(left, right) end)
|
||||
end
|
||||
|
||||
local name = 'Review ' .. last.base .. '..' .. (last.head or 'worktree')
|
||||
MiniPick.start({ source = { name = name, items = items, show = show_seen, preview = preview, choose = choose } })
|
||||
end
|
||||
|
||||
return { status = status, diff = diff, review = review }
|
||||
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
{ "rose-pine/neovim", name = "rose-pine" },
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = { colorscheme = "rose-pine" },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
return {
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
opts = {
|
||||
dashboard = { enabled = false },
|
||||
explorer = { trash = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
inlay_hints = { enabled = false },
|
||||
},
|
||||
},
|
||||
{ "akinsho/bufferline.nvim", enabled = false },
|
||||
{ "folke/flash.nvim", enabled = false },
|
||||
{ "rafamadriz/friendly-snippets", enabled = false },
|
||||
|
||||
{ "catppuccin/nvim", enabled = false },
|
||||
{ "folke/tokyonight.nvim", enabled = false },
|
||||
|
||||
{ "folke/todo-comments.nvim", enabled = false },
|
||||
{ "folke/ts-comments.nvim", enabled = false },
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
{ "MagicDuck/grug-far.nvim", enabled = false },
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
return {
|
||||
{
|
||||
-- Set Laravel Pint as the default PHP formatter with PHP CS Fixer as a fall back.
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
php = { { "pint", "php_cs_fixer" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
-- Remove phpcs linter.
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
php = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"adalessa/laravel.nvim",
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-neotest/nvim-nio",
|
||||
},
|
||||
ft = { "php", "blade" },
|
||||
event = {
|
||||
"BufEnter composer.json",
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>ll",
|
||||
function()
|
||||
Laravel.pickers.laravel()
|
||||
end,
|
||||
desc = "Laravel: Open Laravel Picker",
|
||||
},
|
||||
{
|
||||
"<c-g>",
|
||||
function()
|
||||
Laravel.commands.run("view:finder")
|
||||
end,
|
||||
desc = "Laravel: Open View Finder",
|
||||
},
|
||||
{
|
||||
"<leader>la",
|
||||
function()
|
||||
Laravel.pickers.artisan()
|
||||
end,
|
||||
desc = "Laravel: Open Artisan Picker",
|
||||
},
|
||||
{
|
||||
"<leader>lt",
|
||||
function()
|
||||
Laravel.commands.run("actions")
|
||||
end,
|
||||
desc = "Laravel: Open Actions Picker",
|
||||
},
|
||||
{
|
||||
"<leader>lr",
|
||||
function()
|
||||
Laravel.pickers.routes()
|
||||
end,
|
||||
desc = "Laravel: Open Routes Picker",
|
||||
},
|
||||
{
|
||||
"<leader>lh",
|
||||
function()
|
||||
Laravel.run("artisan docs")
|
||||
end,
|
||||
desc = "Laravel: Open Documentation",
|
||||
},
|
||||
{
|
||||
"<leader>lm",
|
||||
function()
|
||||
Laravel.pickers.make()
|
||||
end,
|
||||
desc = "Laravel: Open Make Picker",
|
||||
},
|
||||
{
|
||||
"<leader>lc",
|
||||
function()
|
||||
Laravel.pickers.commands()
|
||||
end,
|
||||
desc = "Laravel: Open Commands Picker",
|
||||
},
|
||||
{
|
||||
"<leader>lo",
|
||||
function()
|
||||
Laravel.pickers.resources()
|
||||
end,
|
||||
desc = "Laravel: Open Resources Picker",
|
||||
},
|
||||
{
|
||||
"<leader>lp",
|
||||
function()
|
||||
Laravel.commands.run("command_center")
|
||||
end,
|
||||
desc = "Laravel: Open Command Center",
|
||||
},
|
||||
{
|
||||
"<leader>lu",
|
||||
function()
|
||||
Laravel.commands.run("hub")
|
||||
end,
|
||||
desc = "Laravel Artisan hub",
|
||||
},
|
||||
{
|
||||
"gf",
|
||||
function()
|
||||
local ok, res = pcall(function()
|
||||
if Laravel.app("gf").cursorOnResource() then
|
||||
return "<cmd>lua Laravel.commands.run('gf')<cr>"
|
||||
end
|
||||
end)
|
||||
if not ok or not res then
|
||||
return "gf"
|
||||
end
|
||||
return res
|
||||
end,
|
||||
expr = true,
|
||||
noremap = true,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
features = {
|
||||
pickers = {
|
||||
provider = "snacks",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"plugins": {
|
||||
"conform.nvim": {
|
||||
"rev": "016802de402556da54c36bd7359b441266b01cdd",
|
||||
"src": "https://github.com/stevearc/conform.nvim"
|
||||
},
|
||||
"mini.nvim": {
|
||||
"rev": "6d5a29e86a7352739506c28e0bc50fe214b5216f",
|
||||
"src": "https://github.com/nvim-mini/mini.nvim"
|
||||
},
|
||||
"nvim-dap": {
|
||||
"rev": "cfa2d58f4537aca6ca83e2de1a0d9f1491121264",
|
||||
"src": "https://github.com/mfussenegger/nvim-dap"
|
||||
},
|
||||
"nvim-lspconfig": {
|
||||
"rev": "d8d2fda7aae57030452ce8cd6e770b1eb704514e",
|
||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"rev": "a9c4e1457e2e59f1b82c8f78dcdb3b2517555200",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
"rose-pine": {
|
||||
"rev": "ff483051a47e27d84bdef47703538df1ed9f4a47",
|
||||
"src": "https://github.com/rose-pine/neovim"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
-- General
|
||||
vim.g.mapleader = ' ' -- Use <Space> as <Leader> key
|
||||
vim.o.undofile = true -- Keep undo history after closing files
|
||||
vim.o.shada = "'50,<20,s10,:100,/50,@50,h,r/tmp/" -- Fewer saved items (faster startup), skip /tmp files
|
||||
|
||||
-- UI
|
||||
vim.o.number = true -- Show line numbers
|
||||
vim.o.cursorline = true -- Highlight the line the cursor is on
|
||||
vim.o.signcolumn = 'yes' -- Always show sign column (no text shifting)
|
||||
vim.o.wrap = false -- Don't wrap long lines
|
||||
vim.o.list = true -- Show tabs, trailing spaces and nbsp
|
||||
vim.o.listchars = 'tab:→ ,trail:·,nbsp:␣' -- Symbols used for those characters
|
||||
vim.o.fillchars = 'eob: ' -- Hide `~` on lines after end of buffer
|
||||
vim.o.splitbelow = true -- Open horizontal splits below
|
||||
vim.o.splitright = true -- Open vertical splits to the right
|
||||
vim.o.splitkeep = 'screen' -- Keep text in place when opening splits
|
||||
vim.o.cmdheight = 0 -- Hide command line when not typing a command
|
||||
vim.o.shortmess = 'CFOSWacou' -- Hide completion, search count, undo and write messages
|
||||
vim.cmd.syntax('off') -- Disable legacy syntax (treesitter handles highlighting)
|
||||
require('vim._core.ui2').enable({ -- New message/cmdline UI, messages in float (nightly)
|
||||
msg = { targets = 'msg' }
|
||||
})
|
||||
|
||||
-- Editing
|
||||
vim.o.expandtab = true -- Insert spaces when pressing <Tab>
|
||||
vim.o.shiftwidth = 2 -- Spaces per indent level (>>, <<, autoindent)
|
||||
vim.o.tabstop = 2 -- Display width of a tab character
|
||||
vim.o.ignorecase = true -- Ignore case when searching
|
||||
vim.o.smartcase = true -- ...unless the pattern contains uppercase
|
||||
vim.o.virtualedit = 'block' -- Allow cursor past end of line in visual block
|
||||
vim.o.spelloptions = 'camel' -- Spell-check camelCase words per part
|
||||
|
||||
-- Completion
|
||||
vim.o.complete = '.,w,b,kspell' -- Complete from buffer, windows, buffers, spell
|
||||
vim.o.completeopt = 'menuone,noselect,fuzzy,popup' -- Show menu for one match, don't preselect, fuzzy match, description popup
|
||||
vim.o.pumheight = 10 -- Max items visible in completion popup
|
||||
vim.o.pummaxwidth = 120 -- Max width of completion popup
|
||||
|
||||
-- Autocommands
|
||||
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('LspAttach', '*', function(ev) vim.bo[ev.buf].complete = 'o' end, 'Use lsp completions')
|
||||
|
||||
-- Diagnostics
|
||||
Config.later(function()
|
||||
vim.diagnostic.config({
|
||||
jump = { on_jump = vim.diagnostic.open_float },
|
||||
signs = {
|
||||
priority = 9999,
|
||||
severity = { min = vim.diagnostic.severity.INFO },
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = '',
|
||||
[vim.diagnostic.severity.WARN] = '',
|
||||
[vim.diagnostic.severity.INFO] = '',
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
@@ -1,55 +0,0 @@
|
||||
-- Clues
|
||||
Config.leader_group_clues = {
|
||||
{ mode = 'n', keys = '<Leader>d', desc = '+Debug' },
|
||||
{ mode = 'n', keys = '<Leader>e', desc = '+Explore' },
|
||||
{ mode = 'n', keys = '<Leader>f', desc = '+Find' },
|
||||
{ mode = { 'n', 'x' }, keys = '<Leader>g', desc = '+Git' },
|
||||
}
|
||||
|
||||
-- Keymap Helpers
|
||||
local leader = function(suffix, rhs, desc, mode)
|
||||
vim.keymap.set(mode or 'n', '<Leader>' .. suffix, rhs, { desc = desc, silent = true })
|
||||
end
|
||||
|
||||
-- Debug
|
||||
leader('db', function() require('dap').toggle_breakpoint() end, 'Toggle Breakpoint')
|
||||
leader('dc', function() require('dap').continue() end, 'Run/Continue')
|
||||
leader('dC', function() require('dap').run_to_cursor() end, 'Run to Cursor')
|
||||
leader('di', function() require('dap.ui.widgets').hover() end, 'Inspect')
|
||||
leader('dt', function() require('dap').terminate() end, 'Terminate')
|
||||
|
||||
-- Explore
|
||||
local explore_at_file = function()
|
||||
local file = vim.api.nvim_buf_get_name(0)
|
||||
MiniFiles.open(vim.uv.fs_stat(file) and file or nil)
|
||||
end
|
||||
|
||||
local yank_path = function(modifier)
|
||||
return function() vim.fn.setreg('+', vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), modifier)) end
|
||||
end
|
||||
|
||||
leader('ef', explore_at_file, 'File directory')
|
||||
leader('ey', yank_path(':.'), 'Yank relative path')
|
||||
leader('eY', yank_path(':p'), 'Yank absolute path')
|
||||
|
||||
-- Find
|
||||
leader('fb', function() MiniPick.builtin.buffers() end, 'Buffers')
|
||||
leader('fc', function() MiniExtra.pickers.git_commits() end, 'Commits (all)')
|
||||
leader('fC', function() MiniExtra.pickers.git_commits({ path = vim.fn.expand('%') }) end, 'Commits (buf)')
|
||||
leader('fd', function() MiniExtra.pickers.diagnostic({ scope = 'all' }) end, 'Diagnostic workspace')
|
||||
leader('fD', function() MiniExtra.pickers.diagnostic({ scope = 'current' }) end, 'Diagnostic buffer')
|
||||
leader('ff', function() MiniPick.builtin.files() end, 'Files')
|
||||
leader('fg', function() MiniPick.builtin.grep_live() end, 'Grep live')
|
||||
leader('fG', function() MiniPick.builtin.grep({ pattern = vim.fn.expand('<cword>') }) end, 'Grep word')
|
||||
leader('fl', function() MiniExtra.pickers.buf_lines({ scope = 'all' }) end, 'Lines (all)')
|
||||
leader('fL', function() MiniExtra.pickers.buf_lines({ scope = 'current' }) end, 'Lines (buf)')
|
||||
leader('fm', function() require('git').status() end, 'Modified / changed files')
|
||||
leader('fo', function() MiniExtra.pickers.oldfiles() end, 'Old / recent files')
|
||||
leader('fr', function() MiniPick.builtin.resume() end, 'Resume')
|
||||
leader('fs', function() MiniExtra.pickers.lsp({ scope = 'workspace_symbol_live' }) end, 'Symbols workspace')
|
||||
leader('fS', function() MiniExtra.pickers.lsp({ scope = 'document_symbol' }) end, 'Symbols document')
|
||||
leader('f:', function() MiniExtra.pickers.history({ scope = ':' }) end, 'Command history')
|
||||
|
||||
-- Git
|
||||
leader('gd', function() require('git').diff() end, 'Diff unstaged')
|
||||
leader('gs', function() MiniGit.show_at_cursor() end, 'Show at cursor', { 'n', 'x' })
|
||||
@@ -1,6 +0,0 @@
|
||||
-- :Review [base] [head] e.g. `:Review origin/develop`, `:Review origin/main origin/feat-x`
|
||||
-- Without args it refreshes the last review (or starts one against @{upstream}: unpushed commits)
|
||||
Config.command('Review', function(o) require('git').review(o.fargs[1], o.fargs[2]) end, 'Review changes against merge-base', {
|
||||
nargs = '*',
|
||||
complete = function() return vim.fn.systemlist('git branch -a --format=%(refname:short)') end,
|
||||
})
|
||||
@@ -1,79 +0,0 @@
|
||||
-- UI
|
||||
Config.now(function()
|
||||
-- Global icon provider
|
||||
require('mini.icons').setup()
|
||||
Config.later(MiniIcons.tweak_lsp_kind)
|
||||
require('mini.statusline').setup()
|
||||
|
||||
local starter = require('mini.starter')
|
||||
starter.setup({
|
||||
items = {
|
||||
function()
|
||||
local dirs = vim.fn.glob('~/Code/*/', false, true)
|
||||
return vim.tbl_map(function(p)
|
||||
return {
|
||||
name = vim.fn.fnamemodify(p, ':h:t'),
|
||||
section = 'Projects',
|
||||
action = function()
|
||||
vim.fn.chdir(p)
|
||||
MiniStarter.close()
|
||||
end,
|
||||
}
|
||||
end, dirs)
|
||||
end,
|
||||
|
||||
starter.sections.builtin_actions(),
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
Config.later(function()
|
||||
-- Git diff indicators
|
||||
require('mini.diff').setup()
|
||||
require('mini.git').setup()
|
||||
|
||||
-- Keymap hints
|
||||
local miniclue = require('mini.clue')
|
||||
miniclue.setup({
|
||||
clues = {
|
||||
Config.leader_group_clues,
|
||||
miniclue.gen_clues.builtin_completion(),
|
||||
miniclue.gen_clues.g(),
|
||||
miniclue.gen_clues.marks(),
|
||||
miniclue.gen_clues.registers(),
|
||||
miniclue.gen_clues.square_brackets(),
|
||||
miniclue.gen_clues.windows({ submode_resize = true }),
|
||||
miniclue.gen_clues.z(),
|
||||
},
|
||||
triggers = {
|
||||
{ mode = { 'n', 'x' }, keys = '<Leader>' },
|
||||
{ mode = { 'n', 'x' }, keys = '[' },
|
||||
{ mode = { 'n', 'x' }, keys = ']' },
|
||||
{ mode = 'i', keys = '<C-x>' },
|
||||
{ mode = { 'n', 'x' }, keys = 'g' },
|
||||
{ mode = { 'n', 'x' }, keys = "'" },
|
||||
{ mode = { 'n', 'x' }, keys = '`' },
|
||||
{ mode = { 'n', 'x' }, keys = '"' },
|
||||
{ mode = { 'i', 'c' }, keys = '<C-r>' },
|
||||
{ mode = 'n', keys = '<C-w>' },
|
||||
{ mode = { 'n', 'x' }, keys = 'z' },
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
-- Editing & Navigation
|
||||
Config.later(function()
|
||||
require('mini.ai').setup()
|
||||
require('mini.pairs').setup()
|
||||
require('mini.pick').setup()
|
||||
require('mini.extra').setup()
|
||||
end)
|
||||
|
||||
-- File Explorer & auto root
|
||||
Config.now(function()
|
||||
require('mini.files').setup()
|
||||
Config.autocmd('User', 'MiniFilesExplorerOpen', function()
|
||||
MiniFiles.set_bookmark('c', vim.fn.stdpath('config'), { desc = 'Config' })
|
||||
MiniFiles.set_bookmark('w', vim.fn.getcwd, { desc = 'Working directory' })
|
||||
end, 'Add default marks')
|
||||
end)
|
||||
@@ -1,84 +0,0 @@
|
||||
-- Colortheme
|
||||
Config.now(function()
|
||||
vim.pack.add({ { src = 'https://github.com/rose-pine/neovim', name = 'rose-pine' } })
|
||||
require('rose-pine').setup({
|
||||
enable = { terminal = false, legacy_highlights = false, migrations = false, },
|
||||
styles = { italic = false },
|
||||
groups = { git_change = 'gold', git_text = 'gold' },
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme('rose-pine')
|
||||
end)
|
||||
|
||||
-- Treesitter
|
||||
Config.now(function()
|
||||
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
||||
|
||||
local filetypes = {
|
||||
'html', 'css', 'lua', 'go', 'php', 'blade', 'sql', 'javascript',
|
||||
'typescript', 'typescriptreact', 'svelte', 'dockerfile', 'yaml', 'markdown', 'dart',
|
||||
'json', 'xml', 'toml', 'sh', 'zsh', 'just', 'gitcommit', 'diff', 'regex', 'http', 'kotlin'
|
||||
}
|
||||
|
||||
Config.autocmd('FileType', filetypes, function(ev)
|
||||
if pcall(vim.treesitter.start, ev.buf) and vim.bo[ev.buf].filetype == 'php' then
|
||||
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end
|
||||
end, 'Start tree-sitter')
|
||||
|
||||
Config.later(function()
|
||||
require('nvim-treesitter').install(vim.iter(filetypes):map(vim.treesitter.language.get_lang):totable())
|
||||
end)
|
||||
end)
|
||||
|
||||
-- LSP
|
||||
Config.later(function()
|
||||
vim.pack.add({ 'https://github.com/neovim/nvim-lspconfig' })
|
||||
vim.lsp.enable({ 'ansiblels', 'gopls', 'phpantom_lsp', 'svelte', 'tailwindcss', 'tsc', 'biome' })
|
||||
end)
|
||||
|
||||
-- Formatting
|
||||
Config.later(function()
|
||||
vim.pack.add({ 'https://github.com/stevearc/conform.nvim' })
|
||||
require('conform').setup({
|
||||
default_format_opts = { lsp_format = 'fallback' },
|
||||
format_on_save = { timeout_ms = 1000 },
|
||||
formatters_by_ft = {
|
||||
go = { 'gofumpt', 'goimports' },
|
||||
php = { 'php_cs_fixer' },
|
||||
json = { 'jq' },
|
||||
javascript = { 'biome' },
|
||||
typescript = { 'biome' },
|
||||
javascriptreact = { 'biome' },
|
||||
typescriptreact = { 'biome' },
|
||||
svelte = { 'biome' },
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
-- DAP
|
||||
Config.later(function()
|
||||
vim.pack.add({ 'https://github.com/mfussenegger/nvim-dap' })
|
||||
|
||||
local dap_signs = {
|
||||
DapBreakpoint = { text = '', texthl = 'DapBreakpoint' },
|
||||
DapBreakpointCondition = { text = '', texthl = 'DapBreakpointCondition' },
|
||||
DapStopped = { text = '', texthl = 'DapStopped', linehl = 'DapStoppedLine' },
|
||||
DapBreakpointRejected = { text = '', texthl = 'DapBreakpointRejected' },
|
||||
}
|
||||
|
||||
for name, sign in pairs(dap_signs) do
|
||||
vim.fn.sign_define(name, sign)
|
||||
end
|
||||
|
||||
require('dap').adapters.go = { type = 'server', host = '127.0.0.1', port = '${port}' }
|
||||
end)
|
||||
|
||||
-- Flutter
|
||||
Config.autocmd('FileType', 'dart', function()
|
||||
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, 'Setup flutter', true)
|
||||
Reference in new issue
Block a user