mirror of
https://github.com/cap153/nvim.git
synced 2025-12-26 19:25:01 +08:00
添加高亮单词其他引用相关插件
This commit is contained in:
parent
94f6e2b4e8
commit
03f9cefeb2
4 changed files with 58 additions and 10 deletions
|
|
@ -13,7 +13,6 @@
|
|||
"flutter-tools.nvim": { "branch": "main", "commit": "65b7399804315a1160933b64292d3c5330aa4e9f" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"fzf-lua": { "branch": "main", "commit": "f972ad787ee8d3646d30000a0652e9b168a90840" },
|
||||
"gemini-cli.nvim": { "branch": "main", "commit": "2ba2358f476af7bd64158fdc446690082350a7e9" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "d20209a154a8d11710607899b24a0698085b35cf" },
|
||||
"gtranslate.nvim": { "branch": "master", "commit": "a3ce65cd2ccda9c3198869fee53553d575aa547d" },
|
||||
"img-clip.nvim": { "branch": "main", "commit": "d8b6b030672f9f551a0e3526347699985a779d93" },
|
||||
|
|
@ -42,9 +41,11 @@
|
|||
"nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "59f318a65d42a5c4037796886a8874fd57f774fc" },
|
||||
"nvim-treesitter-refactor": { "branch": "master", "commit": "d8b74fa87afc6a1e97b18da23e762efb032dc270" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "80fe8215ba566df2fbf3bf4d25f59ff8f41bc0e1" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" },
|
||||
"outline.nvim": { "branch": "main", "commit": "0eb9289ab39c91caf8b3ed0e3a17764809d69558" },
|
||||
"overseer.nvim": { "branch": "master", "commit": "fe7b2f9ba263e150ab36474dfc810217b8cf7400" },
|
||||
"peek.nvim": { "branch": "master", "commit": "803815d18689b8f9e69d433b08ed767d7555128c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||
|
|
@ -53,6 +54,7 @@
|
|||
"suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
|
||||
"tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
|
||||
"yazi.nvim": { "branch": "main", "commit": "e35c636e8777c8d79cbc68a3d685fd661da1f7c8" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
|||
-- 启动Lazy插件管理快捷键
|
||||
vim.keymap.set("n", "<leader>l", ":Lazy<CR>", { noremap = true })
|
||||
require("lazy").setup({
|
||||
-- Neovim的任务运行器和作业管理插件
|
||||
require("lazy.plugins.overseer"),
|
||||
-- 运行代码
|
||||
require("lazy.plugins.coderunner"),
|
||||
-- 自动补全插件
|
||||
|
|
@ -51,8 +53,10 @@ require("lazy").setup({
|
|||
require("lazy.plugins.gitstatus"),
|
||||
-- outline大纲
|
||||
require("lazy.plugins.outline"),
|
||||
-- treesitter语法高亮
|
||||
-- treesitter语法高亮,nvim-treesitter-refactor高亮当前单词的定义和其他引用、高亮当前作用域
|
||||
require("lazy.plugins.treesitter"),
|
||||
-- illuminate高亮当前单词的定义和其他引用,g=和g-在它们之间跳转
|
||||
require("lazy.plugins.illuminate"),
|
||||
-- tabular,使用:Tab /=来格式化等号之类,特殊符号要转义如:Tabularize /\/
|
||||
require("lazy.plugins.tabular"),
|
||||
-- surround,各种对字符的包裹{} [] ''
|
||||
|
|
@ -96,7 +100,7 @@ require("lazy").setup({
|
|||
-- 在浏览器中查看markdown preview
|
||||
require("lazy.plugins.markdownpreview"),
|
||||
-- 在neovim中使用gemini-cli
|
||||
require("lazy.plugins.gemini"),
|
||||
-- require("lazy.plugins.gemini"),
|
||||
-- 像cursor一样使用neovim
|
||||
-- require("lazy.plugins.avante"),
|
||||
-- mcp server插件
|
||||
|
|
|
|||
19
lua/lazy/plugins/illuminate.lua
Normal file
19
lua/lazy/plugins/illuminate.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
"RRethy/vim-illuminate",
|
||||
config = function()
|
||||
-- 将光标移动到下一个引用
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"g=",
|
||||
"<cmd>lua require('illuminate').goto_next_reference(true)<cr>",
|
||||
{ noremap = true, silent = true, desc = "Go to next reference" }
|
||||
)
|
||||
-- 将光标移动到上一个引用
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"g-",
|
||||
"<cmd>lua require('illuminate').goto_prev_reference(true)<cr>",
|
||||
{ noremap = true, silent = true, desc = "Go to previous reference" }
|
||||
)
|
||||
end,
|
||||
}
|
||||
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = {
|
||||
-- "nvim-treesitter/nvim-treesitter-refactor",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- 要安装高亮的语言直接加入括号即可,把sync_install设置为true下次进入vim自动安装,
|
||||
|
|
@ -24,8 +27,7 @@ return {
|
|||
-- 设置为true后位于ensure_installed里面的语言会自动安装
|
||||
sync_install = true,
|
||||
-- 这里填写不想要自动安装的语言
|
||||
ignore_install = {
|
||||
},
|
||||
ignore_install = {},
|
||||
highlight = {
|
||||
-- 默认开启高亮
|
||||
enable = true,
|
||||
|
|
@ -34,17 +36,38 @@ return {
|
|||
-- },
|
||||
-- 使用function以提高灵活性,禁用大型文件的高亮
|
||||
disable = function(lang, buf)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
-- 如果您依靠启用'语法'(例如,缩进),则将其设置为“ True”。
|
||||
-- 使用此选项可能会放慢编辑器,您可能会看到一些重复的高亮。
|
||||
-- 除了设置为true,它也可以设置成语言列表
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
-- 下面功能需要`nvim-treesitter/nvim-treesitter-refactor`插件
|
||||
-- refactor = {
|
||||
-- -- 高亮光标当前作用域中的块
|
||||
-- highlight_current_scope = { enable = true },
|
||||
-- -- 高亮光标下当前单词的定义和其他用法
|
||||
-- -- 现使用`RRethy/vim-illuminate`插件也而可以做到并支持LSP和正则匹配
|
||||
-- highlight_definitions = {
|
||||
-- enable = true,
|
||||
-- -- Set to false if you have an `updatetime` of ~100.
|
||||
-- clear_on_cursor_move = true,
|
||||
-- },
|
||||
-- -- 光标在高亮之间移动
|
||||
-- navigation = {
|
||||
-- enable = true,
|
||||
-- -- 将keymaps分配给false以禁用它们,例如`goto_definition = false`.
|
||||
-- keymaps = {
|
||||
-- goto_next_usage = "g=",
|
||||
-- goto_previous_usage = "g-",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue