mirror of
https://github.com/cap153/nvim.git
synced 2025-12-26 19:25:01 +08:00
更新blink.cmp命令行模式相关配置
This commit is contained in:
parent
980f03b5e3
commit
5528ddf7d2
8 changed files with 60 additions and 115 deletions
|
|
@ -40,6 +40,8 @@ vim.o.mouse = 'a'
|
|||
vim.o.termguicolors = true
|
||||
-- 将updatetime设置为较低的值以提高性能
|
||||
vim.opt.updatetime = 200
|
||||
-- 指定keyword
|
||||
vim.opt.iskeyword = "_,49-57,A-Z,a-z"
|
||||
|
||||
-- 设置编码格式
|
||||
vim.o.fileencodings = 'utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1'
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
|||
-- 启动Lazy插件管理快捷键
|
||||
vim.keymap.set("n", "<leader>l", ":Lazy<CR>", { noremap = true })
|
||||
require("lazy").setup({
|
||||
-- cmp自动补全
|
||||
-- 自动补全插件
|
||||
require("lazy.plugins.blinkcmp"),
|
||||
-- lsp配置,全局的错误和警告提示,修复建议,重命名变量,格式化代码等等
|
||||
require("lazy.plugins.lspconfig"),
|
||||
|
|
@ -40,7 +40,7 @@ require("lazy").setup({
|
|||
-- 粘贴图片
|
||||
require("lazy.plugins.imgclip"),
|
||||
-- 图片预览
|
||||
require("lazy.plugins.image"),
|
||||
require("lazy.plugins.snacks"),
|
||||
-- 翻译插件gtranslate
|
||||
require("lazy.plugins.translate"),
|
||||
-- git状态
|
||||
|
|
@ -61,8 +61,6 @@ require("lazy").setup({
|
|||
require("lazy.plugins.flutter"),
|
||||
-- 用于改进在 Neovim 中查看 Markdown 文件的插件
|
||||
require("lazy.plugins.render-markdown"),
|
||||
-- markdown preview
|
||||
require("lazy.plugins.markdownpreview"),
|
||||
-- 底部状态栏+主题 themes
|
||||
require("lazy.plugins.themes"),
|
||||
-- 注释插件
|
||||
|
|
@ -71,8 +69,6 @@ require("lazy").setup({
|
|||
require("lazy.plugins.bufferline"),
|
||||
-- explorer tree 文件列表,现在已使用yazi
|
||||
require("lazy.plugins.filemanager"),
|
||||
-- minifiles也是文件管理器,功能较少
|
||||
require("lazy.plugins.minifiles"),
|
||||
-- crtl+g快捷键在neovim中启动lazygit
|
||||
require("lazy.plugins.lazygit"),
|
||||
-- telescope模糊查找
|
||||
|
|
|
|||
|
|
@ -1,29 +1,42 @@
|
|||
return {
|
||||
'saghen/blink.cmp',
|
||||
dependencies = 'rafamadriz/friendly-snippets',
|
||||
version = '*',
|
||||
"saghen/blink.cmp",
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
"mikavilpas/blink-ripgrep.nvim",
|
||||
},
|
||||
version = "*",
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
cmdline = {
|
||||
keymap = {
|
||||
-- 选择并接受预选择的第一个
|
||||
["<CR>"] = { "select_and_accept", "fallback" },
|
||||
},
|
||||
completion = {
|
||||
-- 自动显示补全窗口
|
||||
menu = { auto_show = true },
|
||||
-- 不在当前行上显示所选项目的预览
|
||||
ghost_text = { enabled = false },
|
||||
},
|
||||
},
|
||||
keymap = {
|
||||
preset = 'none',
|
||||
['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
|
||||
-- ['<C-e>'] = { 'hide' },
|
||||
preset = "none",
|
||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
||||
-- fallback命令将运行下一个非闪烁键盘映射(回车键的默认换行等操作需要)
|
||||
['<CR>'] = { 'accept', 'fallback' }, -- 更改成'select_and_accept'会选择第一项插入
|
||||
['<S-Tab>'] = { 'select_prev', 'snippet_backward', 'fallback' },
|
||||
['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' }, -- 同时存在补全列表和snippet时,补全列表选择优先级更高
|
||||
["<CR>"] = { "accept", "fallback" }, -- 更改成'select_and_accept'会选择第一项插入
|
||||
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
|
||||
["<Tab>"] = { "select_next", "snippet_forward", "fallback" }, -- 同时存在补全列表和snippet时,补全列表选择优先级更高
|
||||
|
||||
['<C-b>'] = { 'scroll_documentation_up', 'fallback' },
|
||||
['<C-f>'] = { 'scroll_documentation_down', 'fallback' },
|
||||
|
||||
['<C-e>'] = { 'snippet_forward', 'select_next', 'fallback' }, -- 同时存在补全列表和snippet时,snippet跳转优先级更高
|
||||
['<C-u>'] = { 'snippet_backward', 'select_prev', 'fallback' },
|
||||
["<C-b>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-f>"] = { "scroll_documentation_down", "fallback" },
|
||||
|
||||
["<C-e>"] = { "snippet_forward", "select_next", "fallback" }, -- 同时存在补全列表和snippet时,snippet跳转优先级更高
|
||||
["<C-u>"] = { "snippet_backward", "select_prev", "fallback" },
|
||||
},
|
||||
completion = {
|
||||
-- 示例:使用'prefix'对于'foo_|_bar'单词将匹配'foo_'(光标前面的部分),使用'full'将匹配'foo__bar'(整个单词)
|
||||
keyword = { range = 'full' },
|
||||
keyword = { range = "full" },
|
||||
-- 选择补全项目时显示文档(0.5秒延迟)
|
||||
documentation = { auto_show = true, auto_show_delay_ms = 500 },
|
||||
-- 不预选第一个项目,选中后自动插入该项目文本
|
||||
|
|
@ -32,11 +45,9 @@ return {
|
|||
-- 指定文件类型启用/禁用
|
||||
enabled = function()
|
||||
return not vim.tbl_contains({
|
||||
-- "lua",
|
||||
-- "markdown"
|
||||
}, vim.bo.filetype)
|
||||
and vim.bo.buftype ~= "prompt"
|
||||
and vim.b.completion ~= false
|
||||
-- "lua",
|
||||
-- "markdown"
|
||||
}, vim.bo.filetype) and vim.bo.buftype ~= "prompt" and vim.b.completion ~= false
|
||||
end,
|
||||
|
||||
appearance = {
|
||||
|
|
@ -46,21 +57,32 @@ return {
|
|||
use_nvim_cmp_as_default = true,
|
||||
-- 将“Nerd Font Mono”设置为“mono”,将“Nerd Font”设置为“normal”
|
||||
-- 调整间距以确保图标对齐
|
||||
nerd_font_variant = 'mono'
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
|
||||
-- 已定义启用的提供程序的默认列表,以便您可以扩展它
|
||||
sources = {
|
||||
default = { 'buffer', 'lsp', 'path', 'snippets', },
|
||||
default = {
|
||||
"buffer",
|
||||
"ripgrep",
|
||||
"lsp",
|
||||
"path",
|
||||
"snippets",
|
||||
},
|
||||
providers = {
|
||||
-- score_offset设置优先级数字越大优先级越高
|
||||
buffer = { score_offset = 4 },
|
||||
buffer = { score_offset = 5 },
|
||||
ripgrep = {
|
||||
module = "blink-ripgrep",
|
||||
name = "Ripgrep",
|
||||
score_offset = 4,
|
||||
},
|
||||
path = { score_offset = 3 },
|
||||
lsp = { score_offset = 2 },
|
||||
snippets = { score_offset = 1 },
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
-- 由于“opts_extend”,您的配置中的其他位置无需重新定义它
|
||||
opts_extend = { "sources.default" }
|
||||
opts_extend = { "sources.default" },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
return {
|
||||
"3rd/image.nvim",
|
||||
dependencies = {
|
||||
"vhyrro/luarocks.nvim",
|
||||
priority = 1001, -- this plugin needs to run before anything else
|
||||
opts = {
|
||||
rocks = { "magick" },
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
-- default config
|
||||
require("image").setup({
|
||||
backend = "kitty",
|
||||
-- backend = "ueberzug",
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
clear_in_insert_mode = false, -- 插入模式的时候隐藏
|
||||
download_remote_images = true,
|
||||
only_render_image_at_cursor = false,
|
||||
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
|
||||
},
|
||||
neorg = {
|
||||
enabled = true,
|
||||
clear_in_insert_mode = true,
|
||||
download_remote_images = true,
|
||||
only_render_image_at_cursor = false,
|
||||
filetypes = { "norg" },
|
||||
},
|
||||
},
|
||||
max_width = nil,
|
||||
max_height = nil,
|
||||
max_width_window_percentage = nil,
|
||||
max_height_window_percentage = 50,
|
||||
window_overlap_clear_enabled = true, -- 当打开重叠的浮动窗口时隐藏图片
|
||||
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
|
||||
editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus
|
||||
tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
|
||||
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
|
|
@ -19,8 +19,8 @@ return {
|
|||
local servers = {
|
||||
'marksman', -- 任意标题<space>aw打开code action可以开头生成目录;超链接可以链接到同一个git项目的其他markdown文件#指定标题<space>h可以预览
|
||||
'lua_ls',
|
||||
'pyright',
|
||||
'gopls',
|
||||
'pylsp', -- Mason对应的安装名称是python-lsp-server
|
||||
-- 'gopls',
|
||||
'rust_analyzer',
|
||||
}
|
||||
-- lsp_zero的相关配置
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
-- ===
|
||||
-- === markdown preview
|
||||
-- ===
|
||||
|
||||
return {
|
||||
"iamcco/markdown-preview.nvim",
|
||||
build = "cd app && npm install",
|
||||
init = function() vim.g.mkdp_filetypes = { "markdown" } end,
|
||||
ft = { "markdown" },
|
||||
lazy = true,
|
||||
config = function()
|
||||
-- 设置使用谷歌浏览器进行预览
|
||||
vim.g.mkdp_browser = '/usr/bin/google-chrome-stable'
|
||||
end
|
||||
}
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
return {
|
||||
'echasnovski/mini.files',
|
||||
config = function()
|
||||
require('mini.files').setup{
|
||||
mappings = {
|
||||
close = 'q',
|
||||
go_in = 'I',
|
||||
go_in_plus = 'i',
|
||||
go_out = 'N',
|
||||
go_out_plus = 'n',
|
||||
mark_goto = "'",
|
||||
mark_set = 'm',
|
||||
reset = '<BS>',
|
||||
reveal_cwd = '@',
|
||||
show_help = 'g?',
|
||||
synchronize = '=',
|
||||
trim_left = '<',
|
||||
trim_right = '>',
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
7
lua/lazy/plugins/snacks.lua
Normal file
7
lua/lazy/plugins/snacks.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"folke/snacks.nvim",
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
image = { }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue