Compare commits
15
Commits
d8b6f1515f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf28a408eb | ||
|
|
0feb2c324e
|
||
|
|
3b18b6c7c0
|
||
|
|
1203d6be6c
|
||
|
|
9853ec0dbb
|
||
|
|
987a52e779
|
||
|
|
f6ed9c992c
|
||
|
|
10406758d8
|
||
|
|
2616b14b9f
|
||
|
|
1cf3eef5e9
|
||
|
|
8292ff741d
|
||
|
|
6dadd015bf
|
||
|
|
887ade2cd7
|
||
|
|
88467bfe52 | ||
|
|
3b27bbca7b
|
@@ -1,10 +1,22 @@
|
|||||||
-- Modules
|
-- Modules
|
||||||
vim.loader.enable()
|
vim.loader.enable()
|
||||||
vim.opt.runtimepath:remove('/usr/share/nvim/site')
|
vim.opt.runtimepath:remove('/usr/share/nvim/site')
|
||||||
for _, m in ipairs({ 'netrw', 'netrwPlugin', 'gzip', 'tarPlugin', 'zipPlugin', 'tutor_mode_plugin', 'rplugin' }) do
|
for _, m in ipairs({
|
||||||
|
'netrw', 'netrwPlugin',
|
||||||
|
'gzip', 'tarPlugin',
|
||||||
|
'tutor_mode_plugin',
|
||||||
|
'remote_plugins',
|
||||||
|
'nvim_zip_plugin',
|
||||||
|
'nvim_net_plugin',
|
||||||
|
'spellfile_plugin',
|
||||||
|
}) do
|
||||||
vim.g['loaded_' .. m] = 1
|
vim.g['loaded_' .. m] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for _, p in ipairs({ 'node', 'python3', 'perl', 'ruby' }) do
|
||||||
|
vim.g['loaded_' .. p .. '_provider'] = 0
|
||||||
|
end
|
||||||
|
|
||||||
-- Config Global
|
-- Config Global
|
||||||
vim.pack.add({ 'https://github.com/nvim-mini/mini.nvim' })
|
vim.pack.add({ 'https://github.com/nvim-mini/mini.nvim' })
|
||||||
local misc = require('mini.misc')
|
local misc = require('mini.misc')
|
||||||
|
|||||||
+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,
|
||||||
|
}
|
||||||
+8
-15
@@ -1,26 +1,19 @@
|
|||||||
local M = {}
|
local function open(cmd)
|
||||||
|
|
||||||
-- Open a command in a simple centered floating window
|
|
||||||
function M.open_terminal_app(cmd)
|
|
||||||
local buf = vim.api.nvim_create_buf(false, true)
|
|
||||||
vim.bo[buf].bufhidden = "wipe"
|
|
||||||
|
|
||||||
local lines = vim.o.lines - vim.o.cmdheight - (vim.o.laststatus > 0 and 1 or 0)
|
local lines = vim.o.lines - vim.o.cmdheight - (vim.o.laststatus > 0 and 1 or 0)
|
||||||
local w = math.floor(vim.o.columns * 0.95)
|
local w, h = math.floor(vim.o.columns * 0.95), math.floor(lines * 0.95)
|
||||||
local h = math.floor(lines * 0.95)
|
local buf = vim.api.nvim_create_buf(false, true)
|
||||||
|
vim.bo[buf].bufhidden = 'wipe'
|
||||||
|
|
||||||
local win = vim.api.nvim_open_win(buf, true, {
|
local win = vim.api.nvim_open_win(buf, true, {
|
||||||
relative = "editor",
|
relative = 'editor',
|
||||||
width = w,
|
width = w,
|
||||||
height = h,
|
height = h,
|
||||||
row = math.floor((lines - h) / 2),
|
row = math.floor((lines - h) / 2),
|
||||||
col = math.floor((vim.o.columns - w) / 2),
|
col = math.floor((vim.o.columns - w) / 2),
|
||||||
border = "rounded",
|
border = 'rounded',
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.fn.termopen(cmd, {
|
vim.fn.termopen(cmd, { on_exit = function() pcall(vim.api.nvim_win_close, win, true) end })
|
||||||
on_exit = function() pcall(vim.api.nvim_win_close, win, true) end,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return { open = open }
|
||||||
|
|||||||
+4
-4
@@ -5,19 +5,19 @@
|
|||||||
"src": "https://github.com/stevearc/conform.nvim"
|
"src": "https://github.com/stevearc/conform.nvim"
|
||||||
},
|
},
|
||||||
"mini.nvim": {
|
"mini.nvim": {
|
||||||
"rev": "455856f765c78220fe547fb0862708942b52c42c",
|
"rev": "ac5dffcc52b8378fbb15efeb0497a83e57a0b01c",
|
||||||
"src": "https://github.com/nvim-mini/mini.nvim"
|
"src": "https://github.com/nvim-mini/mini.nvim"
|
||||||
},
|
},
|
||||||
"nvim-dap": {
|
"nvim-dap": {
|
||||||
"rev": "c9a0738e45f1bd41d792a126941348dce661cf9b",
|
"rev": "cfa2d58f4537aca6ca83e2de1a0d9f1491121264",
|
||||||
"src": "https://github.com/mfussenegger/nvim-dap"
|
"src": "https://github.com/mfussenegger/nvim-dap"
|
||||||
},
|
},
|
||||||
"nvim-lspconfig": {
|
"nvim-lspconfig": {
|
||||||
"rev": "456f8cc94438de35ff2294454019e7b780b73514",
|
"rev": "ac9d2f7c4757db6320cab6697fe73e5e8adb2457",
|
||||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||||
},
|
},
|
||||||
"nvim-treesitter": {
|
"nvim-treesitter": {
|
||||||
"rev": "5cb0114e6242625db56dd6440e945ed1ece10bc7",
|
"rev": "9a168f6357ed21c3a636e1727bc7d382abc451b8",
|
||||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
},
|
},
|
||||||
"rose-pine": {
|
"rose-pine": {
|
||||||
|
|||||||
+5
-10
@@ -1,7 +1,7 @@
|
|||||||
-- 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
|
||||||
@@ -9,6 +9,7 @@ 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.listchars = 'tab:→ ,trail:·,nbsp:␣' -- Characters for list mode
|
||||||
vim.o.number = true -- Show line numbers
|
vim.o.number = true -- Show line numbers
|
||||||
vim.o.pumheight = 10 -- Make popup menu smaller
|
vim.o.pumheight = 10 -- Make popup menu smaller
|
||||||
vim.o.pummaxwidth = 80 -- Make popup menu not too wide
|
vim.o.pummaxwidth = 80 -- Make popup menu not too wide
|
||||||
@@ -48,22 +49,16 @@ Config.autocmd('LspAttach', '*', function(ev) vim.bo[ev.buf].complete = 'o' end,
|
|||||||
-- 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 = vim.diagnostic.severity.WARN, max = vim.diagnostic.severity.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 = vim.diagnostic.severity.HINT, max = vim.diagnostic.severity.ERROR } },
|
virtual_text = false,
|
||||||
virtual_lines = false,
|
|
||||||
virtual_text = {
|
|
||||||
current_line = true,
|
|
||||||
severity = { min = vim.diagnostic.severity.ERROR, max = vim.diagnostic.severity.ERROR },
|
|
||||||
},
|
|
||||||
update_in_insert = false,
|
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|||||||
+66
-63
@@ -34,21 +34,19 @@ local close_invisible_buffers = function()
|
|||||||
:each(function(buf) pcall(vim.api.nvim_buf_delete, buf, { force = false }) end)
|
:each(function(buf) pcall(vim.api.nvim_buf_delete, buf, { force = false }) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
nmap_leader('bd', '<Cmd>bdelete<CR>', 'Delete')
|
nmap_leader('bd', vim.cmd.bdelete, 'Delete')
|
||||||
nmap_leader('bD', '<Cmd>bdelete!<CR>', 'Delete!')
|
|
||||||
nmap_leader('bs', new_scratch_buffer, 'Scratch')
|
nmap_leader('bs', new_scratch_buffer, 'Scratch')
|
||||||
nmap_leader('bw', '<Cmd>bwipeout<CR>', 'Wipeout')
|
nmap_leader('bw', vim.cmd.bwipeout, 'Wipeout')
|
||||||
nmap_leader('bW', '<Cmd>bwipeout!<CR>', 'Wipeout!')
|
|
||||||
nmap_leader('bo', close_invisible_buffers, 'Close invisible buffers')
|
nmap_leader('bo', close_invisible_buffers, 'Close invisible buffers')
|
||||||
|
|
||||||
-- Debug
|
-- Debug
|
||||||
nmap_leader('db', '<Cmd>lua require("dap").toggle_breakpoint()<CR>', 'Toggle Breakpoint')
|
nmap_leader('db', function() require('dap').toggle_breakpoint() end, 'Toggle Breakpoint')
|
||||||
nmap_leader('dl', '<Cmd>lua require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point: "))<CR>', 'Log point')
|
nmap_leader('dl', function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point: ')) end, 'Log point')
|
||||||
nmap_leader('dc', '<Cmd>lua require("dap").continue()<CR>', 'Run/Continue')
|
nmap_leader('dc', function() require('dap').continue() end, 'Run/Continue')
|
||||||
nmap_leader('dC', '<Cmd>lua require("dap").run_to_cursor()<CR>', 'Run to Cursor')
|
nmap_leader('dC', function() require('dap').run_to_cursor() end, 'Run to Cursor')
|
||||||
nmap_leader('de', '<Cmd>lua require("dap.ui.widgets").hover()<CR>', 'Inspect')
|
nmap_leader('de', function() require('dap.ui.widgets').hover() end, 'Inspect')
|
||||||
nmap_leader('dr', '<Cmd>lua require("dap").repl.open()<CR>', 'Open REPL')
|
nmap_leader('dr', function() require('dap').repl.open() end, 'Open REPL')
|
||||||
nmap_leader('dt', '<Cmd>lua require("dap").terminate()<CR>', 'Terminate')
|
nmap_leader('dt', function() require('dap').terminate() end, 'Terminate')
|
||||||
|
|
||||||
-- Explore
|
-- Explore
|
||||||
local explore_at_file = function()
|
local explore_at_file = function()
|
||||||
@@ -56,76 +54,81 @@ local explore_at_file = function()
|
|||||||
MiniFiles.open(vim.uv.fs_stat(file) and file or nil)
|
MiniFiles.open(vim.uv.fs_stat(file) and file or nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
nmap_leader('ed', '<Cmd>lua MiniFiles.open()<CR>', 'Directory')
|
nmap_leader('ed', function() MiniFiles.open() end, 'Directory')
|
||||||
nmap_leader('ef', explore_at_file, 'File directory')
|
nmap_leader('ef', explore_at_file, 'File directory')
|
||||||
nmap_leader('ey', '<Cmd>lua vim.fn.setreg("+", vim.api.nvim_buf_get_name(0))<CR>', 'Yank absolute path')
|
nmap_leader('ey', function() vim.fn.setreg('+', vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':.')) end, 'Yank relative path')
|
||||||
nmap_leader('en', '<Cmd>messages<CR>', 'Notifications')
|
nmap_leader('eY', function() vim.fn.setreg('+', vim.api.nvim_buf_get_name(0)) end, 'Yank absolute path')
|
||||||
|
nmap_leader('en', vim.cmd.messages, 'Notifications')
|
||||||
|
|
||||||
-- Find
|
-- Find
|
||||||
nmap_leader('fb', '<Cmd>lua MiniPick.builtin.buffers()<CR>', 'Buffers')
|
nmap_leader('fb', function() MiniPick.builtin.buffers() end, 'Buffers')
|
||||||
nmap_leader('fc', '<Cmd>lua MiniExtra.pickers.git_commits()<CR>', 'Commits (all)')
|
nmap_leader('fc', function() MiniExtra.pickers.git_commits() end, 'Commits (all)')
|
||||||
nmap_leader('fC', '<Cmd>lua MiniExtra.pickers.git_commits({ path = "%" })<CR>', 'Commits (buf)')
|
nmap_leader('fC', function() MiniExtra.pickers.git_commits({ path = vim.fn.expand('%') }) end, 'Commits (buf)')
|
||||||
nmap_leader('fd', '<Cmd>lua MiniExtra.pickers.diagnostic({ scope = "all" })<CR>', 'Diagnostic workspace')
|
nmap_leader('fd', function() MiniExtra.pickers.diagnostic({ scope = 'all' }) end, 'Diagnostic workspace')
|
||||||
nmap_leader('fD', '<Cmd>lua MiniExtra.pickers.diagnostic({ scope = "current" })<CR>', 'Diagnostic buffer')
|
nmap_leader('fD', function() MiniExtra.pickers.diagnostic({ scope = 'current' }) end, 'Diagnostic buffer')
|
||||||
nmap_leader('ff', '<Cmd>lua MiniPick.builtin.files()<CR>', 'Files')
|
nmap_leader('ff', function() MiniPick.builtin.files() end, 'Files')
|
||||||
nmap_leader('fg', '<Cmd>lua MiniPick.builtin.grep_live()<CR>', 'Grep live')
|
nmap_leader('fg', function() MiniPick.builtin.grep_live() end, 'Grep live')
|
||||||
nmap_leader('fG', '<Cmd>lua MiniPick.builtin.grep({ pattern = vim.fn.expand("<cword>") })<CR>', 'Grep word')
|
nmap_leader('fG', function() MiniPick.builtin.grep({ pattern = vim.fn.expand('<cword>') }) end, 'Grep word')
|
||||||
nmap_leader('fh', '<Cmd>lua MiniPick.builtin.help()<CR>', 'Help tags')
|
nmap_leader('fh', function() MiniPick.builtin.help() end, 'Help tags')
|
||||||
nmap_leader('fl', '<Cmd>lua MiniPick.builtin.buf_lines({ scope = "all" })<CR>', 'Lines (all)')
|
nmap_leader('fl', function() MiniExtra.pickers.buf_lines({ scope = 'all' }) end, 'Lines (all)')
|
||||||
nmap_leader('fL', '<Cmd>lua MiniPick.builtin.buf_lines({ scope = "current" })<CR>', 'Lines (buf)')
|
nmap_leader('fL', function() MiniExtra.pickers.buf_lines({ scope = 'current' }) end, 'Lines (buf)')
|
||||||
nmap_leader('fr', '<Cmd>lua MiniPick.builtin.resume()<CR>', 'Resume')
|
nmap_leader('fm', function() require('git').status() end, 'Modified / changed files')
|
||||||
nmap_leader('fs', '<Cmd>lua MiniExtra.pickers.lsp({ scope = "workspace_symbol_live" })<CR>', 'Symbols workspace')
|
nmap_leader('fo', function() MiniExtra.pickers.oldfiles() end, 'Old / recent files')
|
||||||
nmap_leader('fS', '<Cmd>lua MiniExtra.pickers.lsp({ scope = "document_symbol" })<CR>', 'Symbols document')
|
nmap_leader('fr', function() MiniPick.builtin.resume() end, 'Resume')
|
||||||
nmap_leader('f:', '<Cmd>lua MiniExtra.pickers.history({ scope = ":" })<CR>', 'Command history')
|
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')
|
||||||
|
|
||||||
-- Git
|
-- Git
|
||||||
local git_log_cmd = [[Git log --pretty=format:\%h\ \%as\ │\ \%s --topo-order]]
|
local diff_unstaged = function()
|
||||||
local git_log_buf_cmd = git_log_cmd .. ' --follow -- %'
|
vim.cmd.diffthis()
|
||||||
|
vim.cmd('vert Git show :./%')
|
||||||
|
vim.cmd.diffthis()
|
||||||
|
end
|
||||||
|
|
||||||
nmap_leader('ga', '<Cmd>Git diff --cached<CR>', 'Added diff')
|
nmap_leader('ga', function() vim.cmd('Git add %') end, 'Add current file')
|
||||||
nmap_leader('gA', '<Cmd>Git diff --cached -- %<CR>', 'Added diff buffer')
|
nmap_leader('gd', diff_unstaged, 'Diff unstaged')
|
||||||
nmap_leader('gd', '<Cmd>Git diff<CR>', 'Diff')
|
nmap_leader('gs', function() MiniGit.show_at_cursor() end, 'Show at cursor')
|
||||||
nmap_leader('gD', '<Cmd>Git diff -- %<CR>', 'Diff buffer')
|
xmap_leader('gs', function() MiniGit.show_at_cursor() end, 'Show at selection')
|
||||||
nmap_leader('gl', '<Cmd>' .. git_log_cmd .. '<CR>', 'Log')
|
|
||||||
nmap_leader('gL', '<Cmd>' .. git_log_buf_cmd .. '<CR>', 'Log buffer')
|
|
||||||
nmap_leader('go', '<Cmd>lua MiniDiff.toggle_overlay()<CR>', 'Toggle overlay')
|
|
||||||
nmap_leader('gs', '<Cmd>lua MiniGit.show_at_cursor()<CR>', 'Show at cursor')
|
|
||||||
xmap_leader('gs', '<Cmd>lua MiniGit.show_at_cursor()<CR>', 'Show at selection')
|
|
||||||
|
|
||||||
-- Language
|
-- Language
|
||||||
nmap_leader('la', '<Cmd>lua vim.lsp.buf.code_action()<CR>', 'Actions')
|
nmap_leader('la', function() vim.lsp.buf.code_action() end, 'Actions')
|
||||||
nmap_leader('ld', '<Cmd>lua vim.diagnostic.open_float()<CR>', 'Diagnostic popup')
|
nmap_leader('ld', function() vim.diagnostic.open_float() end, 'Diagnostic popup')
|
||||||
nmap_leader('lf', '<Cmd>lua require("conform").format({ async = true })<CR>', 'Format')
|
nmap_leader('lf', function() require('conform').format({ async = true }) end, 'Format')
|
||||||
xmap_leader('lf', '<Cmd>lua require("conform").format({ async = true })<CR>', 'Format selection')
|
xmap_leader('lf', function() require('conform').format({ async = true }) end, 'Format selection')
|
||||||
nmap_leader('li', '<Cmd>lua vim.lsp.buf.implementation()<CR>', 'Implementation')
|
nmap_leader('li', function() vim.lsp.buf.implementation() end, 'Implementation')
|
||||||
nmap_leader('lh', '<Cmd>lua vim.lsp.buf.hover()<CR>', 'Hover')
|
nmap_leader('lh', function() vim.lsp.buf.hover() end, 'Hover')
|
||||||
nmap_leader('ll', '<Cmd>lua vim.lsp.codelens.run()<CR>', 'Lens')
|
nmap_leader('ll', function() vim.lsp.codelens.run() end, 'Lens')
|
||||||
nmap_leader('lr', '<Cmd>lua vim.lsp.buf.rename()<CR>', 'Rename')
|
nmap_leader('lr', function() vim.lsp.buf.rename() end, 'Rename')
|
||||||
nmap_leader('lR', '<Cmd>lua vim.lsp.buf.references()<CR>', 'References')
|
nmap_leader('lR', function() vim.lsp.buf.references() end, 'References')
|
||||||
nmap_leader('ls', '<Cmd>lua vim.lsp.buf.definition()<CR>', 'Source definition')
|
nmap_leader('ls', function() vim.lsp.buf.definition() end, 'Source definition')
|
||||||
nmap_leader('lt', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', 'Type definition')
|
nmap_leader('lt', function() vim.lsp.buf.type_definition() end, 'Type definition')
|
||||||
|
|
||||||
-- Request
|
-- Request
|
||||||
nmap_leader('rs', '<Cmd>lua require("kulala").run()<CR>', 'Send HTTP request')
|
nmap_leader('rs', function() require('kulala').run() end, 'Send HTTP request')
|
||||||
|
|
||||||
-- Terminal
|
-- Terminal
|
||||||
nmap_leader('tT', '<Cmd>horizontal term<CR>', 'Terminal (horizontal)')
|
local open_ai = function()
|
||||||
nmap_leader('tt', '<Cmd>vertical term<CR>', 'Terminal (vertical)')
|
vim.cmd('vertical term ' .. (vim.fn.executable('pi') == 1 and 'pi' or 'claude'))
|
||||||
nmap_leader('tc', '<Cmd>vertical term claude<CR>', 'Claude')
|
end
|
||||||
nmap_leader('tf', '<Cmd>lua require("terminal").open_terminal_app(vim.o.shell)<CR>', 'Terminal (popup)')
|
|
||||||
nmap_leader('tg', '<Cmd>lua require("terminal").open_terminal_app("lazygit")<CR>', 'LazyGit')
|
nmap_leader('tT', function() vim.cmd('horizontal term') end, 'Terminal (horizontal)')
|
||||||
nmap_leader('ts', '<Cmd>lua require("terminal").open_terminal_app("lazysql")<CR>', 'LazySQL')
|
nmap_leader('tt', function() vim.cmd('vertical term') end, 'Terminal (vertical)')
|
||||||
|
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
|
-- Tabs
|
||||||
nmap_leader('<Tab><Tab>', '<Cmd>tabnew<CR>', 'New tab')
|
nmap_leader('<Tab><Tab>', vim.cmd.tabnew, 'New tab')
|
||||||
nmap_leader('<Tab>d', '<Cmd>tabclose<CR>', 'Close tab')
|
nmap_leader('<Tab>d', vim.cmd.tabclose, 'Close tab')
|
||||||
nmap_leader('<Tab>]', '<Cmd>tabnext<CR>', 'Next tab')
|
nmap_leader('<Tab>]', vim.cmd.tabnext, 'Next tab')
|
||||||
nmap_leader('<Tab>[', '<Cmd>tabprevious<CR>', 'Previous tab')
|
nmap_leader('<Tab>[', vim.cmd.tabprevious, 'Previous tab')
|
||||||
|
|
||||||
-- Brackets
|
-- 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 = 'Next diagnostic' })
|
||||||
vim.keymap.set('n', '[d', function() vim.diagnostic.jump({ count = -1 }) end, { desc = 'Previous diagnostic' })
|
vim.keymap.set('n', '[d', function() vim.diagnostic.jump({ count = -1 }) end, { desc = 'Previous diagnostic' })
|
||||||
|
|
||||||
-- Overwrites
|
-- Overwrites
|
||||||
vim.keymap.set('n', '<Esc>', '<Cmd>nohlsearch<CR>', { desc = 'Clear highlights', silent = true })
|
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 })
|
vim.keymap.set('t', '<C-w>', '<C-\\><C-n><C-w>', { desc = 'Terminal window navigation', silent = true })
|
||||||
|
|||||||
+12
-2
@@ -12,7 +12,16 @@ Config.now(function()
|
|||||||
return vim.iter({ vim.fn.glob('~/Code/*', 0, 1), vim.fn.glob('~/Documents/*/*', 0, 1) })
|
return vim.iter({ vim.fn.glob('~/Code/*', 0, 1), vim.fn.glob('~/Documents/*/*', 0, 1) })
|
||||||
:flatten()
|
:flatten()
|
||||||
:filter(function(p) return vim.fn.isdirectory(p) == 1 end)
|
:filter(function(p) return vim.fn.isdirectory(p) == 1 end)
|
||||||
:map(function(p) return { name = vim.fn.fnamemodify(p, ':t'), action = 'edit ' .. vim.fn.fnameescape(p), section = 'Projects' } 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()
|
:totable()
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@@ -47,7 +56,7 @@ Config.later(function()
|
|||||||
{ mode = { 'n', 'x' }, keys = 'g' },
|
{ mode = { 'n', 'x' }, keys = 'g' },
|
||||||
{ mode = { 'n', 'x' }, keys = "'" },
|
{ mode = { 'n', 'x' }, keys = "'" },
|
||||||
{ mode = { 'n', 'x' }, keys = '`' },
|
{ mode = { 'n', 'x' }, keys = '`' },
|
||||||
{ mode = { 'n', 'x' }, keys = "'" },
|
{ mode = { 'n', 'x' }, keys = '"' },
|
||||||
{ mode = { 'i', 'c' }, keys = '<C-r>' },
|
{ mode = { 'i', 'c' }, keys = '<C-r>' },
|
||||||
{ mode = 'n', keys = '<C-w>' },
|
{ mode = 'n', keys = '<C-w>' },
|
||||||
{ mode = { 'n', 'x' }, keys = 's' },
|
{ mode = { 'n', 'x' }, keys = 's' },
|
||||||
@@ -62,6 +71,7 @@ Config.later(function()
|
|||||||
require('mini.pairs').setup()
|
require('mini.pairs').setup()
|
||||||
require('mini.pick').setup()
|
require('mini.pick').setup()
|
||||||
require('mini.extra').setup()
|
require('mini.extra').setup()
|
||||||
|
MiniPick.registry.git_status = function() require('git').status() end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- File Explorer
|
-- File Explorer
|
||||||
|
|||||||
+25
-8
@@ -2,18 +2,27 @@
|
|||||||
Config.now(function()
|
Config.now(function()
|
||||||
vim.pack.add({ { src = 'https://github.com/rose-pine/neovim', name = 'rose-pine' } })
|
vim.pack.add({ { src = 'https://github.com/rose-pine/neovim', name = 'rose-pine' } })
|
||||||
require('rose-pine').setup({
|
require('rose-pine').setup({
|
||||||
enable = { terminal = false, legacy_highlights = false, migrations = false },
|
enable = { terminal = false, legacy_highlights = false, migrations = false, },
|
||||||
|
styles = { italic = 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({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
||||||
|
vim.treesitter.language.register('bash', 'sh')
|
||||||
|
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', 'svelte', 'dockerfile', 'yaml', 'markdown', 'dart',
|
'typescript', 'typescriptreact', 'svelte', 'dockerfile', 'yaml', 'markdown', 'dart',
|
||||||
'json', 'xml', 'toml', 'sh', 'bash', 'zsh', 'just', '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)
|
||||||
@@ -23,17 +32,25 @@ Config.now_if_args(function()
|
|||||||
end, 'Start tree-sitter')
|
end, 'Start tree-sitter')
|
||||||
|
|
||||||
Config.later(function()
|
Config.later(function()
|
||||||
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
local missing = {}
|
||||||
require('nvim-treesitter').install(vim.tbl_map(function(ft)
|
|
||||||
return vim.treesitter.language.get_lang(ft) or ft
|
for _, ft in ipairs(filetypes) do
|
||||||
end, filetypes))
|
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)
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
Config.now_if_args(function()
|
Config.now_if_args(function()
|
||||||
vim.pack.add({ 'https://github.com/neovim/nvim-lspconfig' })
|
vim.pack.add({ 'https://github.com/neovim/nvim-lspconfig' })
|
||||||
vim.lsp.enable({ 'ansiblels', 'gopls', 'phpantom_lsp', 'svelte', 'tailwindcss', 'tsc' })
|
vim.lsp.enable({ 'ansiblels', 'gopls', 'phpantom_lsp', 'svelte', 'tailwindcss', 'tsc', 'biome' })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Formatting
|
-- Formatting
|
||||||
|
|||||||
Reference in New Issue
Block a user