Compare commits
2 commits
d276de37c8
...
7254f63fcf
| Author | SHA1 | Date | |
|---|---|---|---|
| 7254f63fcf | |||
| d186f510e3 |
2 changed files with 97 additions and 66 deletions
|
|
@ -25,13 +25,7 @@ local path_package = vim.fn.stdpath 'data' .. '/site/'
|
||||||
local mini_path = path_package .. 'pack/deps/start/mini.nvim'
|
local mini_path = path_package .. 'pack/deps/start/mini.nvim'
|
||||||
if not vim.uv.fs_stat(mini_path) then
|
if not vim.uv.fs_stat(mini_path) then
|
||||||
vim.cmd 'echo "Installing mini.nvim" | redraw'
|
vim.cmd 'echo "Installing mini.nvim" | redraw'
|
||||||
vim.fn.system {
|
vim.fn.system { 'git', 'clone', '--filter=blob:none', 'https://github.com/echasnovski/mini.nvim', mini_path }
|
||||||
'git',
|
|
||||||
'clone',
|
|
||||||
'--filter=blob:none',
|
|
||||||
'https://github.com/echasnovski/mini.nvim',
|
|
||||||
mini_path,
|
|
||||||
}
|
|
||||||
vim.cmd 'packadd mini.nvim | helptags ALL'
|
vim.cmd 'packadd mini.nvim | helptags ALL'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -53,12 +47,12 @@ add 'NeogitOrg/neogit'
|
||||||
add 'nvim-lua/plenary.nvim'
|
add 'nvim-lua/plenary.nvim'
|
||||||
add 'sindrets/diffview.nvim'
|
add 'sindrets/diffview.nvim'
|
||||||
add 'folke/which-key.nvim'
|
add 'folke/which-key.nvim'
|
||||||
add {
|
add { source = 'saghen/blink.cmp', checkout = 'v1.8.0' }
|
||||||
source = 'saghen/blink.cmp',
|
|
||||||
checkout = 'v1.8.0',
|
|
||||||
}
|
|
||||||
add 'stevearc/conform.nvim'
|
add 'stevearc/conform.nvim'
|
||||||
add 'coder/claudecode.nvim'
|
add 'coder/claudecode.nvim'
|
||||||
|
add 'mbbill/undotree'
|
||||||
|
add 'cbochs/grapple.nvim'
|
||||||
|
add 'fang2hou/blink-copilot'
|
||||||
|
|
||||||
now(function()
|
now(function()
|
||||||
require('mini.icons').setup {
|
require('mini.icons').setup {
|
||||||
|
|
@ -171,10 +165,26 @@ later(function()
|
||||||
|
|
||||||
require('fyler').setup {
|
require('fyler').setup {
|
||||||
views = {
|
views = {
|
||||||
|
---@diagnostic disable
|
||||||
finder = {
|
finder = {
|
||||||
confirm_simple = true,
|
confirm_simple = true,
|
||||||
close_on_select = false,
|
close_on_select = false,
|
||||||
|
watcher = {
|
||||||
|
enabled = true,
|
||||||
},
|
},
|
||||||
|
win = {
|
||||||
|
kind = 'replace',
|
||||||
|
kinds = {
|
||||||
|
split_left_most = {
|
||||||
|
width = '10%',
|
||||||
|
win_opts = {
|
||||||
|
winfixwidth = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
---@diagnostic enable
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,12 +193,7 @@ later(function()
|
||||||
on_directory_enter = function(dir) require('oil').open(dir) end,
|
on_directory_enter = function(dir) require('oil').open(dir) end,
|
||||||
}
|
}
|
||||||
|
|
||||||
require('compile-mode').setup {
|
require('compile-mode').setup {}
|
||||||
-- split_mode = "vertical-right",
|
|
||||||
on_exit = function(qf_list, _)
|
|
||||||
if #qf_list > 0 then require('quicker').open { focus = false } end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require('neogit').setup {
|
require('neogit').setup {
|
||||||
integrations = {
|
integrations = {
|
||||||
|
|
@ -213,6 +218,11 @@ later(function()
|
||||||
}
|
}
|
||||||
|
|
||||||
require('claudecode').setup {}
|
require('claudecode').setup {}
|
||||||
|
|
||||||
|
require('grapple').setup {
|
||||||
|
scope = 'git_branch',
|
||||||
|
icons = false,
|
||||||
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
later(function()
|
later(function()
|
||||||
|
|
@ -271,7 +281,14 @@ later(function()
|
||||||
nerd_font_variant = 'mono',
|
nerd_font_variant = 'mono',
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'buffer' },
|
default = { 'lsp', 'path', 'snippets', 'buffer', 'copilot' },
|
||||||
|
providers = {
|
||||||
|
copilot = {
|
||||||
|
name = 'copilot',
|
||||||
|
module = 'blink-copilot',
|
||||||
|
async = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
completion = {
|
completion = {
|
||||||
menu = {
|
menu = {
|
||||||
|
|
@ -321,6 +338,7 @@ later(function()
|
||||||
'pyright', -- Python
|
'pyright', -- Python
|
||||||
'rust_analyzer', -- Rust
|
'rust_analyzer', -- Rust
|
||||||
'clangd', -- C/C++
|
'clangd', -- C/C++
|
||||||
|
'copilot',
|
||||||
},
|
},
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
}
|
}
|
||||||
|
|
@ -450,7 +468,7 @@ later(function()
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Enable language servers
|
-- Enable language servers
|
||||||
vim.lsp.enable { 'lua_ls', 'ts_ls', 'pyright', 'rust_analyzer', 'clangd' }
|
vim.lsp.enable { 'lua_ls', 'ts_ls', 'pyright', 'rust_analyzer', 'clangd', 'copilot' }
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local map = function(mode, lhs, rhs, opts)
|
local map = function(mode, lhs, rhs, opts)
|
||||||
|
|
@ -481,6 +499,19 @@ map('n', '<leader>ch', '<cmd>checkhealth<cr>', 'Check health')
|
||||||
map('n', '<leader>cf', '<cmd>Format<cr>', 'Format buffer')
|
map('n', '<leader>cf', '<cmd>Format<cr>', 'Format buffer')
|
||||||
|
|
||||||
map('n', '<leader>gg', function() require('neogit').open() end, 'Open Neogit')
|
map('n', '<leader>gg', function() require('neogit').open() end, 'Open Neogit')
|
||||||
|
map('n', '<leader>ut', '<cmd>UndotreeToggle<cr>', 'Toggle undotree')
|
||||||
|
|
||||||
|
-- Grapple keymaps (harpoon-style)
|
||||||
|
map('n', '<leader>ma', '<cmd>Grapple toggle<cr>', 'Grapple toggle tag')
|
||||||
|
map('n', '<leader>mm', '<cmd>Grapple toggle_tags<cr>', 'Grapple tags menu')
|
||||||
|
map('n', '<leader>m1', '<cmd>Grapple select index=1<cr>', 'Grapple select 1')
|
||||||
|
map('n', '<leader>m2', '<cmd>Grapple select index=2<cr>', 'Grapple select 2')
|
||||||
|
map('n', '<leader>m3', '<cmd>Grapple select index=3<cr>', 'Grapple select 3')
|
||||||
|
map('n', '<leader>m4', '<cmd>Grapple select index=4<cr>', 'Grapple select 4')
|
||||||
|
map('n', '<leader>mn', '<cmd>Grapple cycle_tags next<cr>', 'Grapple next tag')
|
||||||
|
map('n', '<leader>mp', '<cmd>Grapple cycle_tags prev<cr>', 'Grapple prev tag')
|
||||||
|
map('n', '<leader>mga', '<cmd>Grapple toggle scope=global<cr>', 'Grapple add global tag')
|
||||||
|
map('n', '<leader>mgm', '<cmd>Grapple toggle_tags scope=global<cr>', 'Grapple global tags menu')
|
||||||
|
|
||||||
-- Claude Code keymaps
|
-- Claude Code keymaps
|
||||||
map('n', '<leader>ac', '<cmd>ClaudeCode<cr>', 'Toggle Claude')
|
map('n', '<leader>ac', '<cmd>ClaudeCode<cr>', 'Toggle Claude')
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ local MAX_HISTORY_SIZE = 200
|
||||||
local config = {
|
local config = {
|
||||||
on_success = nil,
|
on_success = nil,
|
||||||
on_error = nil,
|
on_error = nil,
|
||||||
on_exit = nil,
|
on_exit = function(qf_list, _)
|
||||||
|
if #qf_list > 0 then vim.cmd 'copen' end
|
||||||
|
end,
|
||||||
buffer_keymaps = {
|
buffer_keymaps = {
|
||||||
close = 'q',
|
close = 'q',
|
||||||
recompile = 'g',
|
recompile = 'g',
|
||||||
|
|
@ -244,14 +246,12 @@ local function run_compile(cmd)
|
||||||
local function append_output(data)
|
local function append_output(data)
|
||||||
if not data then return end
|
if not data then return end
|
||||||
for _, line in ipairs(data) do
|
for _, line in ipairs(data) do
|
||||||
if line ~= '' then
|
|
||||||
table.insert(output_lines, line)
|
table.insert(output_lines, line)
|
||||||
vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, { line })
|
vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, { line })
|
||||||
local buf_line = vim.api.nvim_buf_line_count(bufnr)
|
local buf_line = vim.api.nvim_buf_line_count(bufnr)
|
||||||
line_to_qf[buf_line] = #output_lines
|
line_to_qf[buf_line] = #output_lines
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local job_id = vim.fn.jobstart(cmd, {
|
local job_id = vim.fn.jobstart(cmd, {
|
||||||
stdout_buffered = false,
|
stdout_buffered = false,
|
||||||
|
|
@ -282,41 +282,6 @@ local function run_compile(cmd)
|
||||||
valid_entries = vim.tbl_filter(function(item) return item.valid == 1 end, qf_list)
|
valid_entries = vim.tbl_filter(function(item) return item.valid == 1 end, qf_list)
|
||||||
|
|
||||||
vim.b[bufnr].line_to_qf = line_to_qf
|
vim.b[bufnr].line_to_qf = line_to_qf
|
||||||
|
|
||||||
vim.schedule(function()
|
|
||||||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
|
||||||
if vim.api.nvim_buf_is_valid(buf) and vim.bo[buf].buftype == 'quickfix' then
|
|
||||||
local function qf_jump()
|
|
||||||
local line = vim.api.nvim_win_get_cursor(0)[1]
|
|
||||||
local qf_entries = vim.fn.getqflist()
|
|
||||||
|
|
||||||
if line <= #qf_entries then
|
|
||||||
local entry = qf_entries[line]
|
|
||||||
|
|
||||||
if entry.valid == 1 and entry.bufnr > 0 then
|
|
||||||
vim.cmd('cc ' .. line)
|
|
||||||
else
|
|
||||||
for i = line - 1, 1, -1 do
|
|
||||||
if qf_entries[i].valid == 1 and qf_entries[i].bufnr > 0 then
|
|
||||||
vim.cmd('cc ' .. i)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for i = line + 1, #qf_entries do
|
|
||||||
if qf_entries[i].valid == 1 and qf_entries[i].bufnr > 0 then
|
|
||||||
vim.cmd('cc ' .. i)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<CR>', qf_jump, { buffer = buf, desc = 'Jump to error location' })
|
|
||||||
vim.keymap.set('n', '<2-LeftMouse>', qf_jump, { buffer = buf, desc = 'Jump to error location' })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
|
|
@ -776,9 +741,7 @@ function M.compile()
|
||||||
if config.input_keymaps.history_prev then
|
if config.input_keymaps.history_prev then
|
||||||
vim.keymap.set('i', config.input_keymaps.history_prev, function()
|
vim.keymap.set('i', config.input_keymaps.history_prev, function()
|
||||||
if #command_history > 0 then
|
if #command_history > 0 then
|
||||||
if history_index == 0 then
|
if history_index == 0 then saved_input = get_input() end
|
||||||
saved_input = get_input()
|
|
||||||
end
|
|
||||||
if history_index < #command_history then
|
if history_index < #command_history then
|
||||||
history_index = history_index + 1
|
history_index = history_index + 1
|
||||||
current_input = command_history[#command_history - history_index + 1]
|
current_input = command_history[#command_history - history_index + 1]
|
||||||
|
|
@ -824,7 +787,8 @@ function M.compile()
|
||||||
|
|
||||||
-- Close compile prompt
|
-- Close compile prompt
|
||||||
---@type string[]
|
---@type string[]
|
||||||
local close_keys = type(config.input_keymaps.close) == 'table' and config.input_keymaps.close --[[@as string[] ]] or { config.input_keymaps.close }
|
local close_keys = type(config.input_keymaps.close) == 'table' and config.input_keymaps.close --[[@as string[] ]]
|
||||||
|
or { config.input_keymaps.close }
|
||||||
for _, key in ipairs(close_keys) do
|
for _, key in ipairs(close_keys) do
|
||||||
if key then vim.keymap.set({ 'i', 'n' }, key, function() vim.schedule(close) end, opts) end
|
if key then vim.keymap.set({ 'i', 'n' }, key, function() vim.schedule(close) end, opts) end
|
||||||
end
|
end
|
||||||
|
|
@ -883,7 +847,9 @@ function M.setup(opts)
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = 'compilation',
|
pattern = 'compilation',
|
||||||
callback = function()
|
callback = function()
|
||||||
if config.buffer_keymaps.close then vim.keymap.set('n', config.buffer_keymaps.close, '<cmd>close<cr>', { buffer = true, desc = 'Close compilation buffer' }) end
|
if config.buffer_keymaps.close then
|
||||||
|
vim.keymap.set('n', config.buffer_keymaps.close, '<cmd>close<cr>', { buffer = true, desc = 'Close compilation buffer' })
|
||||||
|
end
|
||||||
if config.buffer_keymaps.recompile then vim.keymap.set('n', config.buffer_keymaps.recompile, M.recompile, { buffer = true, desc = 'Recompile' }) end
|
if config.buffer_keymaps.recompile then vim.keymap.set('n', config.buffer_keymaps.recompile, M.recompile, { buffer = true, desc = 'Recompile' }) end
|
||||||
|
|
||||||
local function jump_to_error()
|
local function jump_to_error()
|
||||||
|
|
@ -946,6 +912,40 @@ function M.setup(opts)
|
||||||
vim.keymap.set('n', '<2-LeftMouse>', jump_to_error, { buffer = true, desc = 'Jump to error location' })
|
vim.keymap.set('n', '<2-LeftMouse>', jump_to_error, { buffer = true, desc = 'Jump to error location' })
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = 'qf',
|
||||||
|
callback = function()
|
||||||
|
local function qf_jump()
|
||||||
|
local line = vim.api.nvim_win_get_cursor(0)[1]
|
||||||
|
local qf_entries = vim.fn.getqflist()
|
||||||
|
|
||||||
|
if line <= #qf_entries then
|
||||||
|
local entry = qf_entries[line]
|
||||||
|
|
||||||
|
if entry.valid == 1 and entry.bufnr > 0 then
|
||||||
|
vim.cmd('cc ' .. line)
|
||||||
|
else
|
||||||
|
for i = line - 1, 1, -1 do
|
||||||
|
if qf_entries[i].valid == 1 and qf_entries[i].bufnr > 0 then
|
||||||
|
vim.cmd('cc ' .. i)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i = line + 1, #qf_entries do
|
||||||
|
if qf_entries[i].valid == 1 and qf_entries[i].bufnr > 0 then
|
||||||
|
vim.cmd('cc ' .. i)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<CR>', qf_jump, { buffer = true, desc = 'Jump to error location' })
|
||||||
|
vim.keymap.set('n', '<2-LeftMouse>', qf_jump, { buffer = true, desc = 'Jump to error location' })
|
||||||
|
end,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue