fix: nvim

This commit is contained in:
2026-01-17 21:52:18 +08:00
parent 72fb4fc412
commit fba3be8fd8
4 changed files with 69 additions and 5 deletions
+21
View File
@@ -0,0 +1,21 @@
return {
{
"ibhagwan/fzf-lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
keys = {
-- 如果需要使用 fzf-lua 的快捷键,可以在这里添加
},
config = function()
require("fzf-lua").setup({
-- fzf-lua 的配置
winopts = {
height = 0.85,
width = 0.80,
},
})
end,
},
}
+2 -1
View File
@@ -9,10 +9,11 @@ return {
--"bashls",
"shfmt",
--"tailwindcss",
--"tsserver",
"tsserver", -- TypeScript/JavaScript LSP
"pylyzer",
--"cssls",
"bufls", -- Protocol Buffers LSP
"gopls", -- Go LSP
})
end,
},
+37 -2
View File
@@ -5,6 +5,10 @@ return {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
-- 确保编译成功,如果 make 失败,尝试 cmake
cond = function()
return vim.fn.executable("make") == 1 or vim.fn.executable("cmake") == 1
end,
},
"nvim-telescope/telescope-file-browser.nvim",
},
@@ -125,6 +129,15 @@ return {
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
-- 确保文件查找器正常工作
file_ignore_patterns = {
"^.git/",
"^node_modules/",
"^.DS_Store",
},
-- 使用 fzf 排序(如果可用)
path_display = { "truncate" },
dynamic_preview_title = true,
mappings = {
i = {
["<C-c>"] = actions.close,
@@ -151,6 +164,22 @@ return {
},
},
})
-- Configure live_grep: use ripgrep if available, otherwise fallback to grep
-- Note: Install ripgrep for better performance: brew install ripgrep
if vim.fn.executable("rg") == 0 then
vim.notify("ripgrep (rg) not found. live_grep will use grep (slower). Install with: brew install ripgrep", vim.log.levels.WARN)
opts.defaults = opts.defaults or {}
opts.defaults.vimgrep_arguments = {
"grep",
"--recursive",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
}
end
opts.extensions = vim.tbl_deep_extend("force", opts.extensions or {}, {
file_browser = {
theme = "dropdown",
@@ -182,8 +211,14 @@ return {
},
})
telescope.setup(opts)
require("telescope").load_extension("fzf")
require("telescope").load_extension("file_browser")
-- 安全地加载扩展
pcall(function()
require("telescope").load_extension("fzf")
end)
pcall(function()
require("telescope").load_extension("file_browser")
end)
end,
},
}