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'
|
||||
if not vim.uv.fs_stat(mini_path) then
|
||||
vim.cmd 'echo "Installing mini.nvim" | redraw'
|
||||
vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'https://github.com/echasnovski/mini.nvim',
|
||||
mini_path,
|
||||
}
|
||||
vim.fn.system { 'git', 'clone', '--filter=blob:none', 'https://github.com/echasnovski/mini.nvim', mini_path }
|
||||
vim.cmd 'packadd mini.nvim | helptags ALL'
|
||||
end
|
||||
|
||||
|
|
@ -53,12 +47,12 @@ add 'NeogitOrg/neogit'
|
|||
add 'nvim-lua/plenary.nvim'
|
||||
add 'sindrets/diffview.nvim'
|
||||
add 'folke/which-key.nvim'
|
||||
add {
|
||||
source = 'saghen/blink.cmp',
|
||||
checkout = 'v1.8.0',
|
||||
}
|
||||
add { source = 'saghen/blink.cmp', checkout = 'v1.8.0' }
|
||||
add 'stevearc/conform.nvim'
|
||||
add 'coder/claudecode.nvim'
|
||||
add 'mbbill/undotree'
|
||||
add 'cbochs/grapple.nvim'
|
||||
add 'fang2hou/blink-copilot'
|
||||
|
||||
now(function()
|
||||
require('mini.icons').setup {
|
||||
|
|
@ -171,10 +165,26 @@ later(function()
|
|||
|
||||
require('fyler').setup {
|
||||
views = {
|
||||
---@diagnostic disable
|
||||
finder = {
|
||||
confirm_simple = true,
|
||||
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,
|
||||
}
|
||||
|
||||
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('compile-mode').setup {}
|
||||
|
||||
require('neogit').setup {
|
||||
integrations = {
|
||||
|
|
@ -213,6 +218,11 @@ later(function()
|
|||
}
|
||||
|
||||
require('claudecode').setup {}
|
||||
|
||||
require('grapple').setup {
|
||||
scope = 'git_branch',
|
||||
icons = false,
|
||||
}
|
||||
end)
|
||||
|
||||
later(function()
|
||||
|
|
@ -271,7 +281,14 @@ later(function()
|
|||
nerd_font_variant = 'mono',
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'buffer' },
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer', 'copilot' },
|
||||
providers = {
|
||||
copilot = {
|
||||
name = 'copilot',
|
||||
module = 'blink-copilot',
|
||||
async = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
|
|
@ -321,6 +338,7 @@ later(function()
|
|||
'pyright', -- Python
|
||||
'rust_analyzer', -- Rust
|
||||
'clangd', -- C/C++
|
||||
'copilot',
|
||||
},
|
||||
automatic_installation = true,
|
||||
}
|
||||
|
|
@ -450,7 +468,7 @@ later(function()
|
|||
}
|
||||
|
||||
-- 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)
|
||||
|
||||
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>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
|
||||
map('n', '<leader>ac', '<cmd>ClaudeCode<cr>', 'Toggle Claude')
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ local MAX_HISTORY_SIZE = 200
|
|||
local config = {
|
||||
on_success = nil,
|
||||
on_error = nil,
|
||||
on_exit = nil,
|
||||
on_exit = function(qf_list, _)
|
||||
if #qf_list > 0 then vim.cmd 'copen' end
|
||||
end,
|
||||
buffer_keymaps = {
|
||||
close = 'q',
|
||||
recompile = 'g',
|
||||
|
|
@ -244,12 +246,10 @@ local function run_compile(cmd)
|
|||
local function append_output(data)
|
||||
if not data then return end
|
||||
for _, line in ipairs(data) do
|
||||
if line ~= '' then
|
||||
table.insert(output_lines, line)
|
||||
vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, { line })
|
||||
local buf_line = vim.api.nvim_buf_line_count(bufnr)
|
||||
line_to_qf[buf_line] = #output_lines
|
||||
end
|
||||
table.insert(output_lines, line)
|
||||
vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, { line })
|
||||
local buf_line = vim.api.nvim_buf_line_count(bufnr)
|
||||
line_to_qf[buf_line] = #output_lines
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -282,41 +282,6 @@ local function run_compile(cmd)
|
|||
valid_entries = vim.tbl_filter(function(item) return item.valid == 1 end, qf_list)
|
||||
|
||||
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
|
||||
|
||||
vim.schedule(function()
|
||||
|
|
@ -776,9 +741,7 @@ function M.compile()
|
|||
if config.input_keymaps.history_prev then
|
||||
vim.keymap.set('i', config.input_keymaps.history_prev, function()
|
||||
if #command_history > 0 then
|
||||
if history_index == 0 then
|
||||
saved_input = get_input()
|
||||
end
|
||||
if history_index == 0 then saved_input = get_input() end
|
||||
if history_index < #command_history then
|
||||
history_index = history_index + 1
|
||||
current_input = command_history[#command_history - history_index + 1]
|
||||
|
|
@ -824,7 +787,8 @@ function M.compile()
|
|||
|
||||
-- Close compile prompt
|
||||
---@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
|
||||
if key then vim.keymap.set({ 'i', 'n' }, key, function() vim.schedule(close) end, opts) end
|
||||
end
|
||||
|
|
@ -883,7 +847,9 @@ function M.setup(opts)
|
|||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'compilation',
|
||||
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
|
||||
|
||||
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' })
|
||||
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
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Reference in a new issue