feat(nvim): half-baked migration from lazy.nvim to lz.n + vim.pack
This commit is contained in:
parent
60969865b5
commit
50642823bd
30 changed files with 865 additions and 1315 deletions
|
|
@ -1,128 +1,152 @@
|
|||
vim.pack.add({
|
||||
'https://github.com/saghen/blink.cmp',
|
||||
'https://github.com/Kaiser-Yang/blink-cmp-git',
|
||||
'https://github.com/bydlw98/blink-cmp-env',
|
||||
'https://github.com/barrettruth/blink-cmp-ssh',
|
||||
'https://github.com/barrettruth/blink-cmp-tmux',
|
||||
'https://github.com/barrettruth/blink-cmp-ghostty',
|
||||
})
|
||||
|
||||
local pack_dir = vim.fn.stdpath('data') .. '/site/pack/core/opt'
|
||||
local blink_dir = pack_dir .. '/blink.cmp'
|
||||
if
|
||||
vim.fn.filereadable(blink_dir .. '/target/release/libblink_cmp_fuzzy.so')
|
||||
== 0
|
||||
then
|
||||
vim.system({ 'nix', 'run', '.#build-plugin' }, { cwd = blink_dir }):wait()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('PackChanged', {
|
||||
callback = function(ev)
|
||||
local name, kind = ev.data.spec.name, ev.data.kind
|
||||
if kind == 'delete' then
|
||||
return
|
||||
end
|
||||
if name == 'blink.cmp' then
|
||||
vim.system(
|
||||
{ 'nix', 'run', '.#build-plugin' },
|
||||
{ cwd = ev.data.path }
|
||||
)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
return {
|
||||
'saghen/blink.cmp',
|
||||
build = 'nix run .#build-plugin',
|
||||
dependencies = {
|
||||
'Kaiser-Yang/blink-cmp-git',
|
||||
'folke/lazydev.nvim',
|
||||
'bydlw98/blink-cmp-env',
|
||||
'barrettruth/blink-cmp-ssh',
|
||||
'barrettruth/blink-cmp-tmux',
|
||||
'barrettruth/blink-cmp-ghostty'
|
||||
},
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
event = { 'InsertEnter', 'LspAttach' },
|
||||
config = function(_, opts)
|
||||
vim.o.pumheight = 15
|
||||
opts.completion.menu.max_height = vim.o.pumheight
|
||||
|
||||
require('config.blink')
|
||||
require('blink.cmp').setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
fuzzy = { implementation = 'prefer_rust_with_warning' },
|
||||
keymap = {
|
||||
['<c-p>'] = { 'select_prev' },
|
||||
['<c-n>'] = { 'show', 'select_next' },
|
||||
['<c-space>'] = {},
|
||||
['<c-y>'] = {
|
||||
function(cmp)
|
||||
return cmp.snippet_active() and cmp.accept()
|
||||
or cmp.select_and_accept()
|
||||
end,
|
||||
'snippet_forward',
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
accept = {
|
||||
auto_brackets = { enabled = false },
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
window = {
|
||||
border = 'single',
|
||||
scrollbar = false,
|
||||
keys = { { '<c-n>', mode = 'i' } },
|
||||
after = function()
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
local opts = {
|
||||
fuzzy = { implementation = 'prefer_rust_with_warning' },
|
||||
keymap = {
|
||||
['<c-p>'] = { 'select_prev' },
|
||||
['<c-n>'] = { 'show', 'select_next' },
|
||||
['<c-space>'] = {},
|
||||
['<c-y>'] = {
|
||||
function(cmp)
|
||||
return cmp.snippet_active() and cmp.accept()
|
||||
or cmp.select_and_accept()
|
||||
end,
|
||||
'snippet_forward',
|
||||
},
|
||||
},
|
||||
menu = {
|
||||
auto_show = false,
|
||||
border = 'single',
|
||||
scrollbar = false,
|
||||
draw = {
|
||||
treesitter = { 'lsp', 'snippets', 'buffer' },
|
||||
columns = {
|
||||
{ 'label', 'label_description', gap = 1 },
|
||||
{ 'kind' },
|
||||
completion = {
|
||||
accept = {
|
||||
auto_brackets = { enabled = false },
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
window = {
|
||||
border = 'single',
|
||||
scrollbar = false,
|
||||
},
|
||||
components = {
|
||||
kind = {
|
||||
ellipsis = false,
|
||||
text = function(ctx)
|
||||
return '[' .. ctx.kind .. ']'
|
||||
end,
|
||||
highlight = function(ctx)
|
||||
return ctx.kind_hl
|
||||
end,
|
||||
},
|
||||
menu = {
|
||||
auto_show = false,
|
||||
border = 'single',
|
||||
scrollbar = false,
|
||||
draw = {
|
||||
treesitter = { 'lsp', 'snippets', 'buffer' },
|
||||
columns = {
|
||||
{ 'label', 'label_description', gap = 1 },
|
||||
{ 'kind' },
|
||||
},
|
||||
components = {
|
||||
kind = {
|
||||
ellipsis = false,
|
||||
text = function(ctx)
|
||||
return '[' .. ctx.kind .. ']'
|
||||
end,
|
||||
highlight = function(ctx)
|
||||
return ctx.kind_hl
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
show_with_selection = true,
|
||||
show_without_selection = false,
|
||||
show_without_menu = false,
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
default = {
|
||||
'git',
|
||||
'conventional_commits',
|
||||
'lsp',
|
||||
'path',
|
||||
'buffer',
|
||||
'env',
|
||||
'snippets',
|
||||
'ssh',
|
||||
'tmux',
|
||||
'ghostty',
|
||||
},
|
||||
per_filetype = {
|
||||
pending = { 'omni', 'buffer' },
|
||||
},
|
||||
providers = {
|
||||
git = {
|
||||
module = 'blink-cmp-git',
|
||||
name = 'Git',
|
||||
},
|
||||
ssh = {
|
||||
name = 'SSH',
|
||||
module = 'blink-cmp-ssh',
|
||||
},
|
||||
tmux = {
|
||||
name = 'Tmux',
|
||||
module = 'blink-cmp-tmux',
|
||||
},
|
||||
ghostty = {
|
||||
name = 'Ghostty',
|
||||
module = 'blink-cmp-ghostty',
|
||||
},
|
||||
conventional_commits = {
|
||||
name = 'Conventional Commits',
|
||||
module = 'config.blink.conventional_commits',
|
||||
},
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
module = 'lazydev.integrations.blink',
|
||||
score_offset = 100,
|
||||
},
|
||||
env = {
|
||||
name = 'Env',
|
||||
module = 'blink-cmp-env',
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
show_with_selection = true,
|
||||
show_without_selection = false,
|
||||
show_without_menu = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = { { '<c-n>', mode = 'i' } },
|
||||
opts_extend = { 'sources.default' },
|
||||
sources = {
|
||||
default = {
|
||||
'git',
|
||||
'conventional_commits',
|
||||
'lsp',
|
||||
'path',
|
||||
'buffer',
|
||||
'env',
|
||||
'snippets',
|
||||
'ssh',
|
||||
'tmux',
|
||||
'ghostty',
|
||||
},
|
||||
per_filetype = {
|
||||
pending = { 'omni', 'buffer' },
|
||||
},
|
||||
providers = {
|
||||
git = {
|
||||
module = 'blink-cmp-git',
|
||||
name = 'Git',
|
||||
},
|
||||
ssh = {
|
||||
name = 'SSH',
|
||||
module = 'blink-cmp-ssh',
|
||||
},
|
||||
tmux = {
|
||||
name = 'Tmux',
|
||||
module = 'blink-cmp-tmux',
|
||||
},
|
||||
ghostty = {
|
||||
name = 'Ghostty',
|
||||
module = 'blink-cmp-ghostty',
|
||||
},
|
||||
conventional_commits = {
|
||||
name = 'Conventional Commits',
|
||||
module = 'config.cmp.conventional_commits',
|
||||
},
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
module = 'lazydev.integrations.blink',
|
||||
score_offset = 100,
|
||||
},
|
||||
env = {
|
||||
name = 'Env',
|
||||
module = 'blink-cmp-env',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.o.pumheight = 15
|
||||
opts.completion.menu.max_height = vim.o.pumheight
|
||||
|
||||
require('config.cmp')
|
||||
require('blink.cmp').setup(opts)
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ local function insert_template(buf, lang, platform)
|
|||
return true
|
||||
end
|
||||
|
||||
vim.pack.add({ 'https://github.com/barrettruth/cp.nvim' })
|
||||
|
||||
return {
|
||||
'barrettruth/cp.nvim',
|
||||
cmd = 'CP',
|
||||
|
|
|
|||
|
|
@ -1,12 +1,91 @@
|
|||
vim.pack.add({
|
||||
'https://github.com/ibhagwan/fzf-lua',
|
||||
})
|
||||
|
||||
return {
|
||||
'ibhagwan/fzf-lua',
|
||||
config = function(_, opts)
|
||||
after = function()
|
||||
local fzf = require('fzf-lua')
|
||||
|
||||
local has_devicons = pcall(require, 'nvim-web-devicons')
|
||||
opts.files = opts.files or {}
|
||||
|
||||
local opts = {
|
||||
file_icon_padding = ' ',
|
||||
files = {
|
||||
cmd = vim.env.FZF_CTRL_T_COMMAND,
|
||||
no_header_i = true,
|
||||
},
|
||||
fzf_args = (vim.env.FZF_DEFAULT_OPTS or ''):gsub(
|
||||
'%-%-color=[^%s]+',
|
||||
''
|
||||
),
|
||||
grep = {
|
||||
no_header_i = true,
|
||||
RIPGREP_CONFIG_PATH = vim.env.RIPGREP_CONFIG_PATH,
|
||||
},
|
||||
lsp = {
|
||||
includeDeclaration = false,
|
||||
jump1 = true,
|
||||
symbols = {
|
||||
symbol_hl_prefix = '@',
|
||||
symbol_style = 3,
|
||||
},
|
||||
},
|
||||
winopts = {
|
||||
border = 'single',
|
||||
preview = {
|
||||
hidden = 'hidden',
|
||||
},
|
||||
},
|
||||
actions = {
|
||||
files = {
|
||||
default = function(...)
|
||||
require('fzf-lua.actions').file_edit(...)
|
||||
end,
|
||||
['ctrl-l'] = function(...)
|
||||
local a = require('fzf-lua.actions')
|
||||
a.file_sel_to_ll(...)
|
||||
vim.cmd.lclose()
|
||||
end,
|
||||
['ctrl-q'] = function(...)
|
||||
local a = require('fzf-lua.actions')
|
||||
a.file_sel_to_qf(...)
|
||||
vim.cmd.cclose()
|
||||
end,
|
||||
['ctrl-h'] = function(...)
|
||||
require('fzf-lua.actions').toggle_hidden(...)
|
||||
end,
|
||||
['ctrl-v'] = function(...)
|
||||
require('fzf-lua.actions').file_vsplit(...)
|
||||
end,
|
||||
['ctrl-x'] = function(...)
|
||||
require('fzf-lua.actions').file_split(...)
|
||||
end,
|
||||
},
|
||||
},
|
||||
border = 'single',
|
||||
git = {
|
||||
files = {
|
||||
cmd = 'git ls-files --cached --others --exclude-standard',
|
||||
git_icons = false,
|
||||
},
|
||||
worktrees = {
|
||||
fzf_args = (
|
||||
(vim.env.FZF_DEFAULT_OPTS or '')
|
||||
:gsub('%-%-bind=ctrl%-a:select%-all', '')
|
||||
:gsub('--color=[^%s]+', '')
|
||||
),
|
||||
},
|
||||
branches = {
|
||||
fzf_args = (
|
||||
(vim.env.FZF_DEFAULT_OPTS or '')
|
||||
:gsub('%-%-bind=ctrl%-a:select%-all', '')
|
||||
:gsub('--color=[^%s]+', '')
|
||||
),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
opts.files.file_icons = has_devicons
|
||||
opts.grep = opts.grep or {}
|
||||
opts.grep.file_icons = has_devicons
|
||||
opts.grep.rg_opts =
|
||||
fzf.defaults.grep.rg_opts:gsub('%-e$', "--glob='!.git/' -e")
|
||||
|
|
@ -83,76 +162,4 @@ return {
|
|||
{ 'gq', '<cmd>FzfLua quickfix<cr>' },
|
||||
{ 'gl', '<cmd>FzfLua loclist<cr>' },
|
||||
},
|
||||
opts = {
|
||||
file_icon_padding = ' ',
|
||||
files = {
|
||||
cmd = vim.env.FZF_CTRL_T_COMMAND,
|
||||
no_header_i = true,
|
||||
},
|
||||
fzf_args = (vim.env.FZF_DEFAULT_OPTS or ''):gsub(
|
||||
'%-%-color=[^%s]+',
|
||||
''
|
||||
),
|
||||
grep = {
|
||||
no_header_i = true,
|
||||
RIPGREP_CONFIG_PATH = vim.env.RIPGREP_CONFIG_PATH,
|
||||
},
|
||||
lsp = {
|
||||
includeDeclaration = false,
|
||||
jump1 = true,
|
||||
symbols = {
|
||||
symbol_hl_prefix = '@',
|
||||
symbol_style = 3,
|
||||
},
|
||||
},
|
||||
winopts = {
|
||||
border = 'single',
|
||||
preview = {
|
||||
hidden = 'hidden',
|
||||
},
|
||||
},
|
||||
actions = {
|
||||
files = {
|
||||
default = function(...)
|
||||
require('fzf-lua.actions').file_edit(...)
|
||||
end,
|
||||
['ctrl-l'] = function(...)
|
||||
local a = require('fzf-lua.actions')
|
||||
a.file_sel_to_ll(...)
|
||||
vim.cmd.lclose()
|
||||
end,
|
||||
['ctrl-q'] = function(...)
|
||||
local a = require('fzf-lua.actions')
|
||||
a.file_sel_to_qf(...)
|
||||
vim.cmd.cclose()
|
||||
end,
|
||||
['ctrl-h'] = function(...)
|
||||
require('fzf-lua.actions').toggle_hidden(...)
|
||||
end,
|
||||
['ctrl-v'] = function(...)
|
||||
require('fzf-lua.actions').file_vsplit(...)
|
||||
end,
|
||||
['ctrl-x'] = function(...)
|
||||
require('fzf-lua.actions').file_split(...)
|
||||
end,
|
||||
},
|
||||
},
|
||||
border = 'single',
|
||||
git = {
|
||||
files = {
|
||||
cmd = 'git ls-files --cached --others --exclude-standard',
|
||||
git_icons = false,
|
||||
},
|
||||
worktrees = {
|
||||
fzf_args = ((vim.env.FZF_DEFAULT_OPTS or '')
|
||||
:gsub('%-%-bind=ctrl%-a:select%-all', '')
|
||||
:gsub('--color=[^%s]+', '')),
|
||||
},
|
||||
branches = {
|
||||
fzf_args = ((vim.env.FZF_DEFAULT_OPTS or '')
|
||||
:gsub('%-%-bind=ctrl%-a:select%-all', '')
|
||||
:gsub('--color=[^%s]+', '')),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
vim.pack.add({
|
||||
'https://github.com/tpope/vim-fugitive',
|
||||
{ src = 'https://github.com/lewis6991/gitsigns.nvim', load = false },
|
||||
})
|
||||
|
||||
---@return string
|
||||
local function file_loc()
|
||||
local root = vim.trim(vim.fn.system('git rev-parse --show-toplevel'))
|
||||
|
|
@ -125,6 +130,7 @@ local function forge_picker(kind, state)
|
|||
local forge = forges[forge_name]
|
||||
local cli_kind = forge.kinds[kind]
|
||||
local next_state = ({ all = 'open', open = 'closed', closed = 'all' })[state]
|
||||
pcall(vim.cmd.packadd, 'fzf-lua')
|
||||
require('fzf-lua').fzf_exec(forge.list_cmd(cli_kind, state), {
|
||||
prompt = ('%s (%s)> '):format(forge.labels[kind], state),
|
||||
header = ':: <c-o> to toggle all/open/closed',
|
||||
|
|
@ -153,23 +159,79 @@ local function with_forge(fn)
|
|||
end
|
||||
end
|
||||
|
||||
map({
|
||||
{ 'n', 'v' },
|
||||
'<leader>go',
|
||||
with_forge(function(forge)
|
||||
local branch = vim.trim(vim.fn.system('git branch --show-current'))
|
||||
forge.browse(file_loc(), branch)
|
||||
end),
|
||||
})
|
||||
map({
|
||||
{ 'n', 'v' },
|
||||
'<leader>gy',
|
||||
with_forge(function(forge)
|
||||
forge.yank_commit(file_loc())
|
||||
end),
|
||||
})
|
||||
map({
|
||||
{ 'n', 'v' },
|
||||
'<leader>gl',
|
||||
with_forge(function(forge)
|
||||
forge.yank_branch(file_loc())
|
||||
end),
|
||||
})
|
||||
map({
|
||||
'n',
|
||||
'<leader>gx',
|
||||
with_forge(function(forge)
|
||||
forge.browse_root()
|
||||
end),
|
||||
})
|
||||
map({
|
||||
'n',
|
||||
'<leader>gd',
|
||||
function()
|
||||
pcall(vim.cmd.packadd, 'fzf-lua')
|
||||
require('fzf-lua').fzf_exec(
|
||||
'git branch -a --format="%(refname:short)"',
|
||||
{
|
||||
prompt = 'Git diff> ',
|
||||
actions = {
|
||||
['default'] = function(selected)
|
||||
vim.cmd('Git diff ' .. selected[1])
|
||||
end,
|
||||
},
|
||||
}
|
||||
)
|
||||
end,
|
||||
})
|
||||
map({
|
||||
'n',
|
||||
'<leader>gi',
|
||||
function()
|
||||
forge_picker('issue', 'all')
|
||||
end,
|
||||
})
|
||||
map({
|
||||
'n',
|
||||
'<leader>gp',
|
||||
function()
|
||||
forge_picker('pr', 'all')
|
||||
end,
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
'tpope/vim-fugitive',
|
||||
cmd = { 'Git', 'G', 'Gread', 'Gwrite', 'Gdiffsplit', 'Gvdiffsplit' },
|
||||
after = function()
|
||||
vim.o.statusline = '%{FugitiveStatusline()} ' .. vim.o.statusline
|
||||
end,
|
||||
},
|
||||
{
|
||||
'barrettruth/diffs.nvim',
|
||||
dir = '~/dev/diffs.nvim',
|
||||
enabled = true,
|
||||
dependencies = {
|
||||
{
|
||||
'NeogitOrg/neogit',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
before = function()
|
||||
vim.g.diffs = {
|
||||
fugitive = true,
|
||||
neogit = false,
|
||||
|
|
@ -187,96 +249,25 @@ return {
|
|||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'ibhagwan/fzf-lua',
|
||||
keys = {
|
||||
{
|
||||
'<leader>go',
|
||||
with_forge(function(forge)
|
||||
local branch =
|
||||
vim.trim(vim.fn.system('git branch --show-current'))
|
||||
forge.browse(file_loc(), branch)
|
||||
end),
|
||||
mode = { 'n', 'v' },
|
||||
},
|
||||
{
|
||||
'<leader>gy',
|
||||
with_forge(function(forge)
|
||||
forge.yank_commit(file_loc())
|
||||
end),
|
||||
mode = { 'n', 'v' },
|
||||
},
|
||||
{
|
||||
'<leader>gl',
|
||||
with_forge(function(forge)
|
||||
forge.yank_branch(file_loc())
|
||||
end),
|
||||
mode = { 'n', 'v' },
|
||||
},
|
||||
{
|
||||
'<leader>gx',
|
||||
with_forge(function(forge)
|
||||
forge.browse_root()
|
||||
end),
|
||||
},
|
||||
{
|
||||
'<leader>gd',
|
||||
function()
|
||||
require('fzf-lua').fzf_exec(
|
||||
'git branch -a --format="%(refname:short)"',
|
||||
{
|
||||
prompt = 'Git diff> ',
|
||||
actions = {
|
||||
['default'] = function(selected)
|
||||
vim.cmd('Git diff ' .. selected[1])
|
||||
end,
|
||||
},
|
||||
}
|
||||
)
|
||||
end,
|
||||
},
|
||||
{
|
||||
'<leader>gi',
|
||||
function()
|
||||
forge_picker('issue', 'all')
|
||||
end,
|
||||
},
|
||||
{
|
||||
'<leader>gp',
|
||||
function()
|
||||
forge_picker('pr', 'all')
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '│' },
|
||||
change = { text = '│' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '│' },
|
||||
},
|
||||
},
|
||||
enabled = false,
|
||||
event = 'DeferredUIEnter',
|
||||
after = function()
|
||||
require('gitsigns').setup({
|
||||
signs = {
|
||||
add = { text = '│' },
|
||||
change = { text = '│' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '│' },
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
']g',
|
||||
'<cmd>Gitsigns next_hunk<cr>',
|
||||
desc = 'Next git hunk',
|
||||
},
|
||||
{
|
||||
'[g',
|
||||
'<cmd>Gitsigns prev_hunk<cr>',
|
||||
desc = 'Previous git hunk',
|
||||
},
|
||||
{
|
||||
'<leader>gB',
|
||||
'<cmd>Gitsigns toggle_current_line_blame<cr>',
|
||||
desc = 'Toggle line blame',
|
||||
},
|
||||
{ ']g', '<cmd>Gitsigns next_hunk<cr>' },
|
||||
{ '[g', '<cmd>Gitsigns prev_hunk<cr>' },
|
||||
{ '<leader>gB', '<cmd>Gitsigns toggle_current_line_blame<cr>' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
vim.pack.add({
|
||||
'https://github.com/nvimdev/guard.nvim',
|
||||
'https://github.com/nvimdev/guard-collection',
|
||||
})
|
||||
|
||||
return {
|
||||
'nvimdev/guard.nvim',
|
||||
dependencies = {
|
||||
'nvimdev/guard-collection',
|
||||
},
|
||||
init = function()
|
||||
before = function()
|
||||
vim.g.guard_config = {
|
||||
fmt_on_save = false,
|
||||
save_on_fmt = true,
|
||||
|
|
@ -13,7 +15,7 @@ return {
|
|||
keys = {
|
||||
{ 'gF', '<cmd>Guard fmt<cr>', mode = { 'n', 'x' } },
|
||||
},
|
||||
config = function()
|
||||
after = function()
|
||||
local ft = require('guard.filetype')
|
||||
|
||||
ft('python')
|
||||
|
|
|
|||
|
|
@ -1,24 +1,31 @@
|
|||
vim.pack.add({
|
||||
'https://github.com/neovim/nvim-lspconfig',
|
||||
'https://github.com/folke/lazydev.nvim',
|
||||
'https://github.com/saecki/live-rename.nvim',
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
dir = '~/dev/nvim-lspconfig',
|
||||
},
|
||||
{
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
{ path = '${3rd}/luv/library' },
|
||||
},
|
||||
},
|
||||
after = function()
|
||||
require('lazydev').setup({
|
||||
library = {
|
||||
{ path = '${3rd}/luv/library' },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'saecki/live-rename.nvim',
|
||||
event = 'LspAttach',
|
||||
config = function(_, opts)
|
||||
after = function()
|
||||
local live_rename = require('live-rename')
|
||||
|
||||
live_rename.setup(opts)
|
||||
live_rename.setup()
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(o)
|
||||
|
|
@ -43,70 +50,63 @@ return {
|
|||
{
|
||||
'yioneko/nvim-vtsls',
|
||||
enabled = false,
|
||||
config = function(_, opts)
|
||||
require('vtsls').config(opts)
|
||||
end,
|
||||
dependencies = {
|
||||
{
|
||||
'davidosomething/format-ts-errors.nvim',
|
||||
ft = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
},
|
||||
},
|
||||
},
|
||||
ft = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
},
|
||||
opts = {
|
||||
on_attach = function(_, bufnr)
|
||||
bmap(
|
||||
{ 'n', 'gD', vim.cmd.VtsExec('goto_source_definition') },
|
||||
{ buffer = bufnr }
|
||||
)
|
||||
end,
|
||||
settings = {
|
||||
typescript = {
|
||||
inlayHints = {
|
||||
parameterNames = { enabled = 'literals' },
|
||||
parameterTypes = { enabled = true },
|
||||
variableTypes = { enabled = true },
|
||||
propertyDeclarationTypes = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = true },
|
||||
enumMemberValues = { enabled = true },
|
||||
after = function()
|
||||
require('vtsls').config({
|
||||
on_attach = function(_, bufnr)
|
||||
bmap(
|
||||
{ 'n', 'gD', vim.cmd.VtsExec('goto_source_definition') },
|
||||
{ buffer = bufnr }
|
||||
)
|
||||
end,
|
||||
settings = {
|
||||
typescript = {
|
||||
inlayHints = {
|
||||
parameterNames = { enabled = 'literals' },
|
||||
parameterTypes = { enabled = true },
|
||||
variableTypes = { enabled = true },
|
||||
propertyDeclarationTypes = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = true },
|
||||
enumMemberValues = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
handlers = {
|
||||
['textDocument/publishDiagnostics'] = function(_, result, ctx)
|
||||
if not result.diagnostics then
|
||||
return
|
||||
end
|
||||
|
||||
local idx = 1
|
||||
while idx <= #result.diagnostics do
|
||||
local entry = result.diagnostics[idx]
|
||||
|
||||
local formatter =
|
||||
require('format-ts-errors')[entry.code]
|
||||
entry.message = formatter and formatter(entry.message)
|
||||
or entry.message
|
||||
|
||||
if vim.tbl_contains({ 80001, 80006 }, entry.code) then
|
||||
table.remove(result.diagnostics, idx)
|
||||
else
|
||||
idx = idx + 1
|
||||
handlers = {
|
||||
['textDocument/publishDiagnostics'] = function(
|
||||
_,
|
||||
result,
|
||||
ctx
|
||||
)
|
||||
if not result.diagnostics then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(_, result, ctx)
|
||||
end,
|
||||
},
|
||||
},
|
||||
local idx = 1
|
||||
while idx <= #result.diagnostics do
|
||||
local entry = result.diagnostics[idx]
|
||||
|
||||
local formatter =
|
||||
require('format-ts-errors')[entry.code]
|
||||
entry.message = formatter
|
||||
and formatter(entry.message)
|
||||
or entry.message
|
||||
|
||||
if
|
||||
vim.tbl_contains({ 80001, 80006 }, entry.code)
|
||||
then
|
||||
table.remove(result.diagnostics, idx)
|
||||
else
|
||||
idx = idx + 1
|
||||
end
|
||||
end
|
||||
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(
|
||||
_,
|
||||
result,
|
||||
ctx
|
||||
)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
local oil_detail = false
|
||||
|
||||
local function parse_output(proc)
|
||||
local result = proc:wait()
|
||||
local ret = {}
|
||||
|
|
@ -40,139 +38,156 @@ end
|
|||
|
||||
local git_status = new_git_status()
|
||||
|
||||
vim.pack.add({
|
||||
-- 'https://github.com/barrettruth/midnight.nvim',
|
||||
'https://github.com/echasnovski/mini.ai',
|
||||
'https://github.com/monaqa/dial.nvim',
|
||||
'https://github.com/catgoose/nvim-colorizer.lua',
|
||||
'https://github.com/echasnovski/mini.pairs',
|
||||
'https://github.com/echasnovski/mini.misc',
|
||||
'https://github.com/nvim-mini/mini.bufremove',
|
||||
'https://github.com/tpope/vim-abolish',
|
||||
'https://github.com/tpope/vim-sleuth',
|
||||
'https://github.com/kylechui/nvim-surround',
|
||||
'https://github.com/lervag/vimtex',
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
'barrettruth/live-server.nvim',
|
||||
enabled = false,
|
||||
init = function()
|
||||
before = function()
|
||||
vim.g.live_server = {
|
||||
debug = false
|
||||
debug = false,
|
||||
}
|
||||
end,
|
||||
keys = { { '<leader>l', '<cmd>LiveServerToggle<cr>' } },
|
||||
},
|
||||
{
|
||||
'barrettruth/midnight.nvim',
|
||||
config = function()
|
||||
after = function()
|
||||
vim.cmd.colorscheme('midnight')
|
||||
end,
|
||||
},
|
||||
{
|
||||
'barrettruth/nonicons.nvim',
|
||||
dir = '~/dev/nonicons.nvim',
|
||||
enabled = false,
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.pairs',
|
||||
config = true,
|
||||
after = function()
|
||||
require('mini.pairs').setup()
|
||||
end,
|
||||
event = 'InsertEnter',
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.ai',
|
||||
opts = {
|
||||
custom_textobjects = {
|
||||
b = false,
|
||||
f = false,
|
||||
e = function(ai_type)
|
||||
local n_lines = vim.fn.line('$')
|
||||
local start_line, end_line = 1, n_lines
|
||||
if ai_type == 'i' then
|
||||
while
|
||||
start_line <= n_lines
|
||||
and vim.fn.getline(start_line):match('^%s*$')
|
||||
do
|
||||
start_line = start_line + 1
|
||||
after = function()
|
||||
require('mini.ai').setup({
|
||||
custom_textobjects = {
|
||||
b = false,
|
||||
f = false,
|
||||
e = function(ai_type)
|
||||
local n_lines = vim.fn.line('$')
|
||||
local start_line, end_line = 1, n_lines
|
||||
if ai_type == 'i' then
|
||||
while
|
||||
start_line <= n_lines
|
||||
and vim.fn.getline(start_line):match('^%s*$')
|
||||
do
|
||||
start_line = start_line + 1
|
||||
end
|
||||
while
|
||||
end_line >= start_line
|
||||
and vim.fn.getline(end_line):match('^%s*$')
|
||||
do
|
||||
end_line = end_line - 1
|
||||
end
|
||||
end
|
||||
while
|
||||
end_line >= start_line
|
||||
and vim.fn.getline(end_line):match('^%s*$')
|
||||
do
|
||||
end_line = end_line - 1
|
||||
end
|
||||
end
|
||||
local to_col = math.max(vim.fn.getline(end_line):len(), 1)
|
||||
return {
|
||||
from = { line = start_line, col = 1 },
|
||||
to = { line = end_line, col = to_col },
|
||||
}
|
||||
end,
|
||||
l = function(ai_type)
|
||||
local line_num = vim.fn.line('.')
|
||||
local line = vim.fn.getline(line_num)
|
||||
if line == '' then
|
||||
local to_col =
|
||||
math.max(vim.fn.getline(end_line):len(), 1)
|
||||
return {
|
||||
from = { line = line_num, col = 1 },
|
||||
to = { line = line_num, col = 1 },
|
||||
from = { line = start_line, col = 1 },
|
||||
to = { line = end_line, col = to_col },
|
||||
}
|
||||
end
|
||||
local start_col, end_col
|
||||
if ai_type == 'i' then
|
||||
start_col = line:find('%S') or 1
|
||||
end_col = line:match('.*%S()') or 1
|
||||
else
|
||||
start_col, end_col = 1, line:len()
|
||||
end
|
||||
return {
|
||||
from = { line = line_num, col = start_col },
|
||||
to = { line = line_num, col = end_col },
|
||||
}
|
||||
end,
|
||||
I = function(ai_type)
|
||||
local cur_line = vim.fn.line('.')
|
||||
local cur_indent = vim.fn.indent(cur_line)
|
||||
if vim.fn.getline(cur_line):match('^%s*$') then
|
||||
local search_line = cur_line + 1
|
||||
while
|
||||
search_line <= vim.fn.line('$')
|
||||
and vim.fn.getline(search_line):match('^%s*$')
|
||||
do
|
||||
search_line = search_line + 1
|
||||
end,
|
||||
l = function(ai_type)
|
||||
local line_num = vim.fn.line('.')
|
||||
local line = vim.fn.getline(line_num)
|
||||
if line == '' then
|
||||
return {
|
||||
from = { line = line_num, col = 1 },
|
||||
to = { line = line_num, col = 1 },
|
||||
}
|
||||
end
|
||||
if search_line <= vim.fn.line('$') then
|
||||
cur_indent = vim.fn.indent(search_line)
|
||||
local start_col, end_col
|
||||
if ai_type == 'i' then
|
||||
start_col = line:find('%S') or 1
|
||||
end_col = line:match('.*%S()') or 1
|
||||
else
|
||||
start_col, end_col = 1, line:len()
|
||||
end
|
||||
end
|
||||
local start_line, end_line = cur_line, cur_line
|
||||
while start_line > 1 do
|
||||
local prev = start_line - 1
|
||||
local prev_blank = vim.fn.getline(prev):match('^%s*$')
|
||||
if ai_type == 'i' and prev_blank then
|
||||
break
|
||||
return {
|
||||
from = { line = line_num, col = start_col },
|
||||
to = { line = line_num, col = end_col },
|
||||
}
|
||||
end,
|
||||
I = function(ai_type)
|
||||
local cur_line = vim.fn.line('.')
|
||||
local cur_indent = vim.fn.indent(cur_line)
|
||||
if vim.fn.getline(cur_line):match('^%s*$') then
|
||||
local search_line = cur_line + 1
|
||||
while
|
||||
search_line <= vim.fn.line('$')
|
||||
and vim.fn.getline(search_line):match('^%s*$')
|
||||
do
|
||||
search_line = search_line + 1
|
||||
end
|
||||
if search_line <= vim.fn.line('$') then
|
||||
cur_indent = vim.fn.indent(search_line)
|
||||
end
|
||||
end
|
||||
if
|
||||
not prev_blank
|
||||
and vim.fn.indent(prev) < cur_indent
|
||||
then
|
||||
break
|
||||
local start_line, end_line = cur_line, cur_line
|
||||
while start_line > 1 do
|
||||
local prev = start_line - 1
|
||||
local prev_blank =
|
||||
vim.fn.getline(prev):match('^%s*$')
|
||||
if ai_type == 'i' and prev_blank then
|
||||
break
|
||||
end
|
||||
if
|
||||
not prev_blank
|
||||
and vim.fn.indent(prev) < cur_indent
|
||||
then
|
||||
break
|
||||
end
|
||||
start_line = prev
|
||||
end
|
||||
start_line = prev
|
||||
end
|
||||
while end_line < vim.fn.line('$') do
|
||||
local next = end_line + 1
|
||||
local next_blank = vim.fn.getline(next):match('^%s*$')
|
||||
if ai_type == 'i' and next_blank then
|
||||
break
|
||||
while end_line < vim.fn.line('$') do
|
||||
local next = end_line + 1
|
||||
local next_blank =
|
||||
vim.fn.getline(next):match('^%s*$')
|
||||
if ai_type == 'i' and next_blank then
|
||||
break
|
||||
end
|
||||
if
|
||||
not next_blank
|
||||
and vim.fn.indent(next) < cur_indent
|
||||
then
|
||||
break
|
||||
end
|
||||
end_line = next
|
||||
end
|
||||
if
|
||||
not next_blank
|
||||
and vim.fn.indent(next) < cur_indent
|
||||
then
|
||||
break
|
||||
end
|
||||
end_line = next
|
||||
end
|
||||
local to_col = math.max(vim.fn.getline(end_line):len(), 1)
|
||||
return {
|
||||
from = { line = start_line, col = 1 },
|
||||
to = { line = end_line, col = to_col },
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
local to_col =
|
||||
math.max(vim.fn.getline(end_line):len(), 1)
|
||||
return {
|
||||
from = { line = start_line, col = 1 },
|
||||
to = { line = end_line, col = to_col },
|
||||
}
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{ 'a', mode = { 'x', 'o' } },
|
||||
{ 'i', mode = { 'x', 'o' } },
|
||||
|
|
@ -181,14 +196,14 @@ return {
|
|||
{
|
||||
'lervag/vimtex',
|
||||
ft = { 'latex' },
|
||||
init = function()
|
||||
before = function()
|
||||
vim.g.vimtex_view_method = 'sioyek'
|
||||
vim.g.vimtex_quickfix_mode = 0
|
||||
end,
|
||||
},
|
||||
{
|
||||
'monaqa/dial.nvim',
|
||||
config = function(_)
|
||||
after = function()
|
||||
local augend = require('dial.augend')
|
||||
require('dial.config').augends:register_group({
|
||||
default = {
|
||||
|
|
@ -232,7 +247,6 @@ return {
|
|||
end,
|
||||
mode = 'n',
|
||||
},
|
||||
|
||||
{
|
||||
'<c-a>',
|
||||
function()
|
||||
|
|
@ -265,23 +279,63 @@ return {
|
|||
},
|
||||
{
|
||||
'catgoose/nvim-colorizer.lua',
|
||||
opts = {
|
||||
user_default_options = {
|
||||
names = false,
|
||||
rrggbbaa = true,
|
||||
css = true,
|
||||
css_fn = true,
|
||||
rgb_fn = true,
|
||||
hsl_fn = true,
|
||||
},
|
||||
},
|
||||
after = function()
|
||||
require('colorizer').setup({
|
||||
user_default_options = {
|
||||
names = false,
|
||||
rrggbbaa = true,
|
||||
css = true,
|
||||
css_fn = true,
|
||||
rgb_fn = true,
|
||||
hsl_fn = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
event = 'BufReadPre',
|
||||
},
|
||||
{
|
||||
'barrettruth/canola.nvim',
|
||||
dir = '~/dev/canola.nvim',
|
||||
config = function(_, opts)
|
||||
require('oil').setup(opts)
|
||||
enabled = true,
|
||||
after = function()
|
||||
require('oil').setup({
|
||||
skip_confirm_for_simple_edits = true,
|
||||
prompt_save_on_select_new_entry = false,
|
||||
float = { border = 'single' },
|
||||
view_options = {
|
||||
is_hidden_file = function(name, bufnr)
|
||||
local dir = require('oil').get_current_dir(bufnr)
|
||||
local is_dotfile = vim.startswith(name, '.')
|
||||
and name ~= '..'
|
||||
if not dir then
|
||||
return is_dotfile
|
||||
end
|
||||
if is_dotfile then
|
||||
return not git_status[dir].tracked[name]
|
||||
else
|
||||
return git_status[dir].ignored[name]
|
||||
end
|
||||
end,
|
||||
},
|
||||
keymaps = {
|
||||
['<C-h>'] = false,
|
||||
['<C-t>'] = false,
|
||||
['<C-l>'] = false,
|
||||
['<C-r>'] = 'actions.refresh',
|
||||
['<C-s>'] = { 'actions.select', opts = { vertical = true } },
|
||||
['<C-x>'] = {
|
||||
'actions.select',
|
||||
opts = { horizontal = true },
|
||||
},
|
||||
q = function()
|
||||
local ok, bufremove = pcall(require, 'mini.bufremove')
|
||||
if ok then
|
||||
bufremove.delete()
|
||||
else
|
||||
vim.cmd.bd()
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
local refresh = require('oil.actions').refresh
|
||||
local orig_refresh = refresh.callback
|
||||
refresh.callback = function(...)
|
||||
|
|
@ -301,97 +355,17 @@ return {
|
|||
group = vim.api.nvim_create_augroup('AOil', { clear = true }),
|
||||
})
|
||||
end,
|
||||
event = 'VeryLazy',
|
||||
event = 'DeferredUIEnter',
|
||||
keys = {
|
||||
{ '-', '<cmd>e .<cr>' },
|
||||
{ '_', vim.cmd.Oil },
|
||||
},
|
||||
opts = {
|
||||
skip_confirm_for_simple_edits = true,
|
||||
prompt_save_on_select_new_entry = false,
|
||||
float = { border = 'single' },
|
||||
view_options = {
|
||||
is_hidden_file = function(name, bufnr)
|
||||
local dir = require('oil').get_current_dir(bufnr)
|
||||
local is_dotfile = vim.startswith(name, '.')
|
||||
and name ~= '..'
|
||||
if not dir then
|
||||
return is_dotfile
|
||||
end
|
||||
if is_dotfile then
|
||||
return not git_status[dir].tracked[name]
|
||||
else
|
||||
return git_status[dir].ignored[name]
|
||||
end
|
||||
end,
|
||||
},
|
||||
keymaps = {
|
||||
['<C-h>'] = false,
|
||||
['<C-t>'] = false,
|
||||
['<C-l>'] = false,
|
||||
['<C-r>'] = 'actions.refresh',
|
||||
['<C-s>'] = { 'actions.select', opts = { vertical = true } },
|
||||
['<C-x>'] = { 'actions.select', opts = { horizontal = true } },
|
||||
q = function()
|
||||
local ok, bufremove = pcall(require, 'mini.bufremove')
|
||||
if ok then
|
||||
bufremove.delete()
|
||||
else
|
||||
vim.cmd.bd()
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
{
|
||||
'malewicz1337/oil-git.nvim',
|
||||
dir = '~/dev/oil-git.nvim',
|
||||
opts = {
|
||||
symbol_position = 'signcolumn',
|
||||
can_use_signcolumn = function()
|
||||
return true
|
||||
end,
|
||||
show_file_highlights = false,
|
||||
show_directory_highlights = false,
|
||||
symbols = {
|
||||
file = {
|
||||
added = '│',
|
||||
modified = '│',
|
||||
renamed = '│',
|
||||
deleted = '_',
|
||||
copied = '│',
|
||||
conflict = '│',
|
||||
untracked = '│',
|
||||
ignored = ' ',
|
||||
},
|
||||
directory = {
|
||||
added = '│',
|
||||
modified = '│',
|
||||
renamed = '│',
|
||||
deleted = '_',
|
||||
copied = '│',
|
||||
conflict = '│',
|
||||
untracked = '│',
|
||||
ignored = ' ',
|
||||
},
|
||||
},
|
||||
highlights = {
|
||||
OilGitAdded = { link = 'GitSignsAdd' },
|
||||
OilGitModified = { link = 'GitSignsChange' },
|
||||
OilGitRenamed = { link = 'GitSignsChange' },
|
||||
OilGitDeleted = { link = 'GitSignsDelete' },
|
||||
OilGitCopied = { link = 'GitSignsChange' },
|
||||
OilGitConflict = { link = 'GitSignsDelete' },
|
||||
OilGitUntracked = { link = 'GitSignsAdd' },
|
||||
OilGitIgnored = { link = 'Comment' },
|
||||
},
|
||||
},
|
||||
},
|
||||
{ '_', '<cmd>Oil<cr>' },
|
||||
},
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.misc',
|
||||
config = true,
|
||||
after = function()
|
||||
require('mini.misc').setup()
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
'<c-w>m',
|
||||
|
|
@ -401,7 +375,9 @@ return {
|
|||
},
|
||||
{
|
||||
'nvim-mini/mini.bufremove',
|
||||
config = true,
|
||||
after = function()
|
||||
require('mini.bufremove').setup()
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
'<leader>bd',
|
||||
|
|
@ -413,11 +389,13 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{ 'tpope/vim-abolish', event = 'VeryLazy' },
|
||||
{ 'tpope/vim-abolish', event = 'DeferredUIEnter' },
|
||||
{ 'tpope/vim-sleuth', event = 'BufReadPost' },
|
||||
{
|
||||
'kylechui/nvim-surround',
|
||||
config = true,
|
||||
after = function()
|
||||
require('nvim-surround').setup()
|
||||
end,
|
||||
keys = {
|
||||
{ 'cs', mode = 'n' },
|
||||
{ 'ds', mode = 'n' },
|
||||
|
|
@ -430,22 +408,22 @@ return {
|
|||
{
|
||||
-- TODO: replace this with own barrettruth/render.nvim
|
||||
'wallpants/github-preview.nvim',
|
||||
dir = '~/dev/github-preview.nvim',
|
||||
after = function()
|
||||
require('github-preview').setup({
|
||||
single_file = true,
|
||||
cursor_line = {
|
||||
disable = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = { { '<leader>m', '<cmd>silent GithubPreviewToggle<cr>' } },
|
||||
opts = {
|
||||
single_file = true,
|
||||
cursor_line = {
|
||||
disable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'barrettruth/pending.nvim',
|
||||
init = function()
|
||||
before = function()
|
||||
vim.g.pending = { debug = true }
|
||||
end,
|
||||
dir = '~/dev/pending.nvim',
|
||||
-- TODO: should we be using this or `<Plug>` mappings?
|
||||
keys = { { '<leader>p', '<cmd>Pending<cr>' }}
|
||||
}
|
||||
keys = { { '<leader>p', '<cmd>Pending<cr>' } },
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
return {
|
||||
'stevearc/overseer.nvim',
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd('VimLeavePre', {
|
||||
callback = function()
|
||||
local overseer = require('overseer')
|
||||
for _, task in ipairs(overseer.list_tasks()) do
|
||||
if task:is_running() then
|
||||
task:stop()
|
||||
end
|
||||
task:dispose(true)
|
||||
end
|
||||
current_task = nil
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup('AOverseer', { clear = true }),
|
||||
})
|
||||
end,
|
||||
opts = {
|
||||
strategy = 'terminal',
|
||||
task_list = {
|
||||
bindings = {
|
||||
q = '<Cmd>OverseerClose<CR>',
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>Oa', '<cmd>OverseerTaskAction<cr>' },
|
||||
{ '<leader>Ob', '<cmd>OverseerBuild<cr>' },
|
||||
},
|
||||
}
|
||||
|
|
@ -1,31 +1,46 @@
|
|||
vim.pack.add({
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter-textobjects',
|
||||
'https://github.com/Wansmer/treesj',
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('PackChanged', {
|
||||
callback = function(ev)
|
||||
local name, kind = ev.data.spec.name, ev.data.kind
|
||||
if kind == 'delete' then
|
||||
return
|
||||
end
|
||||
if name == 'nvim-treesitter' then
|
||||
vim.schedule(function()
|
||||
vim.cmd('TSUpdate all')
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
branch = 'main',
|
||||
build = ':TSUpdate all',
|
||||
opts = {
|
||||
auto_install = true,
|
||||
},
|
||||
after = function()
|
||||
require('nvim-treesitter').setup({ auto_install = true })
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
branch = 'main',
|
||||
dependencies = 'nvim-treesitter/nvim-treesitter',
|
||||
init = function()
|
||||
before = function()
|
||||
vim.g.no_plugin_maps = true
|
||||
end,
|
||||
opts = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('nvim-treesitter-textobjects').setup(opts)
|
||||
after = function()
|
||||
require('nvim-treesitter-textobjects').setup({
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
},
|
||||
})
|
||||
|
||||
local select = require('nvim-treesitter-textobjects.select')
|
||||
local select_maps = {
|
||||
|
|
@ -113,7 +128,9 @@ return {
|
|||
},
|
||||
{
|
||||
'Wansmer/treesj',
|
||||
config = true,
|
||||
after = function()
|
||||
require('treesj').setup()
|
||||
end,
|
||||
keys = {
|
||||
{ 'gt', '<cmd>lua require("treesj").toggle()<cr>' },
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue