feat(nvim): more completion configs
This commit is contained in:
parent
e9aeacd1e6
commit
dd13c34c92
7 changed files with 161 additions and 143 deletions
|
|
@ -14,6 +14,7 @@ return {
|
|||
vim.o.pumheight = 15
|
||||
opts.completion.menu.max_height = vim.o.pumheight
|
||||
|
||||
require('config.blink')
|
||||
require('blink.cmp').setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
|
|
@ -47,8 +48,19 @@ return {
|
|||
draw = {
|
||||
treesitter = { 'lsp', 'snippets', 'buffer' },
|
||||
columns = {
|
||||
{ 'kind_icon' },
|
||||
{ '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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -68,16 +80,20 @@ return {
|
|||
'buffer',
|
||||
'env',
|
||||
'snippets',
|
||||
-- 'sshconfig',
|
||||
'sshconfig',
|
||||
},
|
||||
providers = {
|
||||
git = {
|
||||
module = 'blink-cmp-git',
|
||||
name = 'Git',
|
||||
},
|
||||
sshconfig = {
|
||||
name = 'SshConfig',
|
||||
module = 'blink-cmp-sshconfig',
|
||||
},
|
||||
conventional_commits = {
|
||||
name = 'Conventional Commits',
|
||||
module = 'config.cmp_cc',
|
||||
module = 'config.blink.conventional_commits',
|
||||
},
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
|
|
@ -88,10 +104,6 @@ return {
|
|||
name = 'Env',
|
||||
module = 'blink-cmp-env',
|
||||
},
|
||||
-- sshconfig = {
|
||||
-- name = 'SshConfig',
|
||||
-- module = 'blink-cmp-sshconfig',
|
||||
-- },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ return {
|
|||
}
|
||||
end,
|
||||
keys = {
|
||||
{ 'gF', '<cmd>Guard fmt<CR>', mode = { 'n', 'x' } },
|
||||
{ 'gF', '<cmd>Guard fmt<cr>', mode = { 'n', 'x' } },
|
||||
},
|
||||
config = function()
|
||||
local ft = require('guard.filetype')
|
||||
|
|
|
|||
|
|
@ -3,30 +3,6 @@ return {
|
|||
'nvim-treesitter/nvim-treesitter',
|
||||
branch = 'main',
|
||||
build = ':TSUpdate all',
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local lines = vim.api.nvim_buf_line_count(bufnr)
|
||||
|
||||
if lines < 5000 then
|
||||
pcall(vim.treesitter.start)
|
||||
else
|
||||
vim.notify_once(
|
||||
('Skipping tree-sitter for bufnr %s; file too large (%s >= 5000 lines)'):format(
|
||||
bufnr,
|
||||
lines
|
||||
)
|
||||
)
|
||||
end
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup(
|
||||
'ATreeSitter',
|
||||
{ clear = true }
|
||||
),
|
||||
})
|
||||
end,
|
||||
opts = {
|
||||
auto_install = true,
|
||||
},
|
||||
|
|
@ -79,33 +55,47 @@ return {
|
|||
end
|
||||
|
||||
local move = require('nvim-treesitter-textobjects.move')
|
||||
local move_maps = {
|
||||
{ ']a', 'goto_next_start', '@parameter.inner' },
|
||||
{ ']s', 'goto_next_start', '@class.outer' },
|
||||
{ ']f', 'goto_next_start', '@function.outer' },
|
||||
{ ']i', 'goto_next_start', '@conditional.outer' },
|
||||
{ ']/', 'goto_next_start', '@comment.outer' },
|
||||
{ ']A', 'goto_next_end', '@parameter.inner' },
|
||||
{ ']F', 'goto_next_end', '@function.outer' },
|
||||
{ ']I', 'goto_next_end', '@conditional.outer' },
|
||||
{ '[a', 'goto_previous_start', '@parameter.inner' },
|
||||
{ '[s', 'goto_previous_start', '@class.outer' },
|
||||
{ '[f', 'goto_previous_start', '@function.outer' },
|
||||
{ '[i', 'goto_previous_start', '@conditional.outer' },
|
||||
{ '[/', 'goto_previous_start', '@comment.outer' },
|
||||
{ '[A', 'goto_previous_end', '@parameter.inner' },
|
||||
{ '[F', 'goto_previous_end', '@function.outer' },
|
||||
{ '[I', 'goto_previous_end', '@conditional.outer' },
|
||||
local move_textobjects = {
|
||||
{ 'a', '@parameter.inner' },
|
||||
{ 's', '@class.outer' },
|
||||
{ 'f', '@function.outer' },
|
||||
{ 'i', '@conditional.outer' },
|
||||
{ '/', '@comment.outer' },
|
||||
}
|
||||
for _, m in ipairs({ 'n', 'x', 'o' }) do
|
||||
for _, t in ipairs(move_maps) do
|
||||
for _, t in ipairs(move_textobjects) do
|
||||
local key, capture = t[1], t[2]
|
||||
map({
|
||||
m,
|
||||
t[1],
|
||||
']' .. key,
|
||||
function()
|
||||
move[t[2]](t[3], 'textobjects')
|
||||
move.goto_next_start(capture, 'textobjects')
|
||||
end,
|
||||
})
|
||||
map({
|
||||
m,
|
||||
'[' .. key,
|
||||
function()
|
||||
move.goto_previous_start(capture, 'textobjects')
|
||||
end,
|
||||
})
|
||||
local upper = key:upper()
|
||||
if upper ~= key then
|
||||
map({
|
||||
m,
|
||||
']' .. upper,
|
||||
function()
|
||||
move.goto_next_end(capture, 'textobjects')
|
||||
end,
|
||||
})
|
||||
map({
|
||||
m,
|
||||
'[' .. upper,
|
||||
function()
|
||||
move.goto_previous_end(capture, 'textobjects')
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue