mirror of
https://github.com/cap153/nvim.git
synced 2025-12-26 19:25:01 +08:00
添加fzf-lua配置
This commit is contained in:
parent
6d2c60eedc
commit
557287033b
8 changed files with 78 additions and 50 deletions
|
|
@ -73,6 +73,8 @@ require("lazy").setup({
|
|||
require("lazy.plugins.filemanager"),
|
||||
-- crtl+g快捷键在neovim中启动lazygit
|
||||
require("lazy.plugins.lazygit"),
|
||||
-- fzf/skim模糊查找
|
||||
require("lazy.plugins.fzf"),
|
||||
-- telescope模糊查找
|
||||
require("lazy.plugins.telescope"),
|
||||
-- 代码雨插件
|
||||
|
|
|
|||
|
|
@ -4,28 +4,28 @@ return {
|
|||
commit = "7dc5560",
|
||||
-- version = false, -- Never set this value to "*"! Never!
|
||||
opts = {
|
||||
-- behaviour = {
|
||||
-- enable_cursor_planning_mode = true, -- enable cursor planning mode!
|
||||
-- },
|
||||
-- provider = "openrouter",
|
||||
-- vendors = {
|
||||
-- openrouter = {
|
||||
-- __inherited_from = "openai",
|
||||
-- disable_tools = true,
|
||||
-- endpoint = "https://openrouter.ai/api/v1",
|
||||
-- api_key_name = "OPENROUTER_API_KEY",
|
||||
-- model = "deepseek/deepseek-chat-v3-0324:free",
|
||||
-- },
|
||||
-- },
|
||||
provider = "deepseek",
|
||||
behaviour = {
|
||||
enable_cursor_planning_mode = true, -- enable cursor planning mode!
|
||||
},
|
||||
provider = "openrouter",
|
||||
vendors = {
|
||||
deepseek = {
|
||||
openrouter = {
|
||||
__inherited_from = "openai",
|
||||
api_key_name = "DEEPSEEK_API_KEY",
|
||||
endpoint = "https://api.deepseek.com",
|
||||
model = "deepseek-chat",
|
||||
disable_tools = true,
|
||||
endpoint = "https://openrouter.ai/api/v1",
|
||||
api_key_name = "OPENROUTER_API_KEY",
|
||||
model = "deepseek/deepseek-chat-v3-0324:free",
|
||||
},
|
||||
},
|
||||
-- provider = "deepseek",
|
||||
-- vendors = {
|
||||
-- deepseek = {
|
||||
-- __inherited_from = "openai",
|
||||
-- api_key_name = "DEEPSEEK_API_KEY",
|
||||
-- endpoint = "https://api.deepseek.com",
|
||||
-- model = "deepseek-chat",
|
||||
-- },
|
||||
-- },
|
||||
-- The system_prompt type supports both a string and a function that returns a string. Using a function here allows dynamically updating the prompt with mcphub
|
||||
-- system_prompt = function()
|
||||
-- local hub = require("mcphub").get_hub_instance()
|
||||
|
|
@ -50,7 +50,6 @@ return {
|
|||
--- The below dependencies are optional,
|
||||
"echasnovski/mini.pick", -- for file_selector provider mini.pick
|
||||
"nvim-telescope/telescope.nvim", -- for file_selector provider telescope
|
||||
"ibhagwan/fzf-lua", -- for file_selector provider fzf
|
||||
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
|
||||
"zbirenbaum/copilot.lua", -- for providers='copilot'
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ return {
|
|||
filetype = {
|
||||
python = "uv run $fileName",
|
||||
rust = {
|
||||
"cargo run",
|
||||
"cargo run --release",
|
||||
-- "cd $dir &&",
|
||||
-- "rustc $fileName &&",
|
||||
-- "$dir/$fileNameWithoutExt",
|
||||
|
|
|
|||
25
lua/lazy/plugins/fzf.lua
Normal file
25
lua/lazy/plugins/fzf.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
return {
|
||||
"ibhagwan/fzf-lua",
|
||||
-- optional for icon support
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
-- ctrl+t打开文件查找
|
||||
vim.keymap.set('n', '<c-t>', '<cmd>FzfLua files<cr>', {})
|
||||
-- ctrl+f打开字符串查找
|
||||
vim.keymap.set('n', '<c-f>', '<cmd>FzfLua grep<cr>', {})
|
||||
require("fzf-lua").setup({
|
||||
fzf_bin = "sk",
|
||||
keymap = {
|
||||
fzf = {
|
||||
-- fzf '--bind=' options
|
||||
-- true, -- uncomment to inherit all the below in your custom config
|
||||
["ctrl-e"] = "down",
|
||||
["ctrl-u"] = "up",
|
||||
-- Only valid with fzf previewers (bat/cat/git/etc)
|
||||
-- ["shift-down"] = "preview-page-down",
|
||||
-- ["shift-up"] = "preview-page-up",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,36 +1,38 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "mason-org/mason-lspconfig.nvim" },
|
||||
-- 通过mason来自动安装语言服务器并启用
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
{
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
-- "gopls",
|
||||
},
|
||||
automatic_enable = {
|
||||
exclude = {
|
||||
"marksman",
|
||||
"pylsp",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "MysticalDevil/inlay-hints.nvim", event = "LspAttach" },
|
||||
},
|
||||
config = function()
|
||||
-- 通过mason来自动安装语言服务器并启用
|
||||
require("mason").setup({})
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"rust_analyzer",
|
||||
"pylsp",
|
||||
-- "gopls",
|
||||
},
|
||||
automatic_enable = {
|
||||
exclude = {},
|
||||
},
|
||||
})
|
||||
|
||||
-- 快捷键的映射
|
||||
vim.keymap.set("n", "<leader>h", vim.lsp.buf.hover, opts) -- <space>h显示提示文档
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) -- gd跳转到定义的位置
|
||||
vim.keymap.set("n", "go", vim.lsp.buf.type_definition, opts) -- go跳转到变量类型定义的位置
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) -- gr跳转到引用了对应变量或函数的位置
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- <space>rn变量重命名
|
||||
vim.keymap.set("n", "<leader>aw", vim.lsp.buf.code_action, opts) -- <space>aw可以在出现警告或错误的地方打开建议的修复方法
|
||||
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- <space>d浮动窗口显示所在行警告或错误信息
|
||||
vim.keymap.set("n", "<leader>-", vim.diagnostic.goto_prev, opts) -- <space>-跳转到上一处警告或错误的地方
|
||||
vim.keymap.set("n", "<leader>=", vim.diagnostic.goto_next, opts) -- <space>+跳转到下一处警告或错误的地方
|
||||
vim.keymap.set("n", "<leader>h", vim.lsp.buf.hover, opts) -- <space>h显示提示文档
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) -- gd跳转到定义
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) -- gD跳转到声明(例如c语言中的头文件中的原型、一个变量的extern声明)
|
||||
vim.keymap.set("n", "go", vim.lsp.buf.type_definition, opts) -- go跳转到变量类型定义的位置(例如一些自定义类型)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) -- gr跳转到引用了对应变量或函数的位置
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- <space>rn变量重命名
|
||||
vim.keymap.set("n", "<leader>aw", vim.lsp.buf.code_action, opts) -- <space>aw可以在出现警告或错误的地方打开建议的修复方法
|
||||
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- <space>d浮动窗口显示所在行警告或错误信息
|
||||
vim.keymap.set("n", "<leader>-", vim.diagnostic.goto_prev, opts) -- <space>-跳转到上一处警告或错误的地方
|
||||
vim.keymap.set("n", "<leader>=", vim.diagnostic.goto_next, opts) -- <space>+跳转到下一处警告或错误的地方
|
||||
-- vim.keymap.set({ 'n', 'x' }, '<leader>f', function() vim.lsp.buf.format({ async = true }) end, opts) -- <space>f进行代码格式化
|
||||
|
||||
-- 诊断信息的图标
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ return {
|
|||
config = function()
|
||||
local builtin = require('telescope.builtin')
|
||||
-- ctrl+t打开文件查找
|
||||
vim.keymap.set('n', '<c-t>', builtin.find_files, {})
|
||||
-- vim.keymap.set('n', '<c-t>', builtin.find_files, {})
|
||||
-- ctrl+f打开字符串查找
|
||||
vim.keymap.set('n', '<c-f>', '<cmd>lua require("telescope.builtin").grep_string({ search = vim.fn.input("Grep For > "), only_sort_text = true, })<cr>', { noremap = true })
|
||||
-- vim.keymap.set('n', '<c-f>', '<cmd>lua require("telescope.builtin").grep_string({ search = vim.fn.input("Grep For > "), only_sort_text = true, })<cr>', { noremap = true })
|
||||
-- 下面的配置从cw的配置粘贴过来的,删除一部分看不懂的
|
||||
local ts = require('telescope')
|
||||
ts.setup({
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ return {
|
|||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
opts = {
|
||||
transparent_background = true,
|
||||
transparent_background = false,
|
||||
custom_highlights = function(colors)
|
||||
return {
|
||||
LineNr = { fg = colors.surface2 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue