feat(nvim): completion sources
This commit is contained in:
parent
b133b675f0
commit
e9aeacd1e6
9 changed files with 219 additions and 103 deletions
100
config/nvim/lua/plugins/blink.lua
Normal file
100
config/nvim/lua/plugins/blink.lua
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
return {
|
||||
'saghen/blink.cmp',
|
||||
version = '1.*',
|
||||
dependencies = {
|
||||
'Kaiser-Yang/blink-cmp-git',
|
||||
'folke/lazydev.nvim',
|
||||
'bydlw98/blink-cmp-env',
|
||||
{ 'bydlw98/blink-cmp-sshconfig', build = 'make' },
|
||||
},
|
||||
---@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('blink.cmp').setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
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,
|
||||
},
|
||||
},
|
||||
menu = {
|
||||
auto_show = false,
|
||||
border = 'single',
|
||||
scrollbar = false,
|
||||
draw = {
|
||||
treesitter = { 'lsp', 'snippets', 'buffer' },
|
||||
columns = {
|
||||
{ 'kind_icon' },
|
||||
{ 'label', 'label_description', gap = 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
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',
|
||||
-- 'sshconfig',
|
||||
},
|
||||
providers = {
|
||||
git = {
|
||||
module = 'blink-cmp-git',
|
||||
name = 'Git',
|
||||
},
|
||||
conventional_commits = {
|
||||
name = 'Conventional Commits',
|
||||
module = 'config.cmp_cc',
|
||||
},
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
module = 'lazydev.integrations.blink',
|
||||
score_offset = 100,
|
||||
},
|
||||
env = {
|
||||
name = 'Env',
|
||||
module = 'blink-cmp-env',
|
||||
},
|
||||
-- sshconfig = {
|
||||
-- name = 'SshConfig',
|
||||
-- module = 'blink-cmp-sshconfig',
|
||||
-- },
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = { { '<c-n>', mode = 'i' } },
|
||||
opts_extend = { 'sources.default' },
|
||||
}
|
||||
|
|
@ -1,6 +1,12 @@
|
|||
return {
|
||||
'ibhagwan/fzf-lua',
|
||||
config = function(_, opts)
|
||||
local has_devicons = pcall(require, 'nvim-web-devicons')
|
||||
opts.files = opts.files or {}
|
||||
opts.files.file_icons = has_devicons
|
||||
opts.grep = opts.grep or {}
|
||||
opts.grep.file_icons = has_devicons
|
||||
|
||||
require('fzf-lua').setup(opts)
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
|
|
@ -77,7 +83,6 @@ return {
|
|||
file_icon_padding = ' ',
|
||||
files = {
|
||||
cmd = vim.env.FZF_CTRL_T_COMMAND,
|
||||
file_icons = true,
|
||||
no_header_i = true,
|
||||
},
|
||||
fzf_args = (vim.env.FZF_DEFAULT_OPTS or ''):gsub(
|
||||
|
|
@ -85,7 +90,6 @@ return {
|
|||
''
|
||||
),
|
||||
grep = {
|
||||
file_icons = true,
|
||||
no_header_i = true,
|
||||
RIPGREP_CONFIG_PATH = vim.env.RIPGREP_CONFIG_PATH,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,78 +9,6 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'saghen/blink.cmp',
|
||||
version = '1.*',
|
||||
dependencies = 'folke/lazydev.nvim',
|
||||
---@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('blink.cmp').setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
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 = {
|
||||
menu = {
|
||||
auto_show = false,
|
||||
scrollbar = false,
|
||||
draw = {
|
||||
columns = function(ctx)
|
||||
if ctx.mode == 'cmdline' then
|
||||
return {
|
||||
{ 'label', 'label_description', gap = 1 },
|
||||
}
|
||||
else
|
||||
return {
|
||||
{ 'label', 'label_description' },
|
||||
{ 'kind' },
|
||||
}
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
cmdline = {
|
||||
enabled = false,
|
||||
-- completion = {
|
||||
-- menu = {
|
||||
-- auto_show = true,
|
||||
-- },
|
||||
-- },
|
||||
-- keymap = {
|
||||
-- ['<left>'] = false,
|
||||
-- ['<right>'] = false,
|
||||
-- },
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
providers = {
|
||||
lazydev = {
|
||||
name = 'LazyDev',
|
||||
module = 'lazydev.integrations.blink',
|
||||
score_offset = 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = { { '<c-n>', mode = 'i' } },
|
||||
opts_extend = { 'sources.default' },
|
||||
},
|
||||
{
|
||||
'saecki/live-rename.nvim',
|
||||
event = 'LspAttach',
|
||||
|
|
|
|||
|
|
@ -38,16 +38,17 @@ return {
|
|||
{
|
||||
'barrettruth/midnight.nvim',
|
||||
dir = '~/dev/midnight.nvim',
|
||||
enabled = true,
|
||||
config = function()
|
||||
vim.cmd.colorscheme('midnight')
|
||||
end,
|
||||
},
|
||||
{
|
||||
'barrettruth/nonicons.nvim',
|
||||
enabled = false,
|
||||
lazy = false,
|
||||
dir = '~/dev/nonicons.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
dependencies = {
|
||||
{ 'nvim-tree/nvim-web-devicons', enabled = false, },
|
||||
},
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.pairs',
|
||||
|
|
@ -163,7 +164,7 @@ return {
|
|||
},
|
||||
{
|
||||
'lervag/vimtex',
|
||||
lazy = false,
|
||||
ft = { 'latex' },
|
||||
init = function()
|
||||
vim.g.vimtex_view_method = 'sioyek'
|
||||
vim.g.vimtex_quickfix_mode = 0
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ return {
|
|||
'nvim-treesitter/nvim-treesitter',
|
||||
branch = 'main',
|
||||
build = ':TSUpdate all',
|
||||
lazy = false,
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = '*',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue