Skip to content

Commit 61ee4b1

Browse files
committed
add cover
1 parent c19e7a8 commit 61ee4b1

File tree

5 files changed

+57
-11
lines changed

5 files changed

+57
-11
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
本整合包内含大量实用插件,包括智能补全、语法高亮、错误提示、快速跳转、全局搜索、集成终端、文件浏览、Git 支持等。且安装方便,小彭老师自用同款,纯 Lua 配置,是您基于 NeoVim 的 IDE 不二之选。
44

5+
![图片演示](cover.png)
6+
57
## 一键安装(推荐)
68

79
无需克隆本仓库,直接在命令行中输入以下命令即可安装:
@@ -49,6 +51,9 @@ curl -sSLf https://142857.red/files/nvimrc-install.sh | bash
4951
- Q: 打开 C/C++ 源码时不识别头文件目录,“飙红线”,怎么办?
5052
- A: 请先在 NeoVim 中用 `:CMakeGenerate` 命令配置项目!否则无法识别你 CMake 里的编译选项。如果一定要命令行构建,请给 `cmake` 指定 `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` 参数,这样 C++ 补全才能正常工作,详见下方的 “C/C++/CMake 配置” 章节。
5153

54+
- Q: Inlay Hint 太烦太挡视线了!能否关闭?
55+
- A: `:lua require'archvim.options'.enable_inlay_hint = false`,重启,即可永久关闭。如需暂时开启和关闭,可以用 `gsi` 快捷键。
56+
5257
- Q: 支持(非 Neo 的)Vim 吗?
5358
- A: 本分支只有 NeoVim 配置,对于来自 BV1H44y1V7DW 视频想领取老版 Vim 插件的同学,请移步 [main 分支](https://github.com/archibate/vimrc/tree/main)
5459

@@ -118,8 +123,11 @@ curl -sSLf https://142857.red/files/nvimrc-install.sh | bash
118123
- `K` 悬浮窗查看文档
119124
- `gsf` 预览函数定义
120125
- `gsc` 预览类定义
121-
- `gsd` 查看所有语法错误
122-
- `<C-w>d` 查看当前光标下的语法错误
126+
- `gso` 打开大纲
127+
- `gst` 打开项目文件树
128+
- `gsd` 查看所有静态检查语法错误
129+
- `gsq` 查看所有编译器报错
130+
- `gsi` 开关 Inlay Hint
123131

124132
**标签页**
125133

cover.png

299 KB
Loading

key_details.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,12 @@ int main() {
294294

295295
- `gsc` 在小窗口中预览当前光标下类或变量的定义(但不跳转过去)
296296
- `gsf` 在小窗口中预览当前光标下函数的定义(但不跳转过去)
297-
- `gsd` 在弹出窗口中预览当前项目中的所有语法错误
298-
- `<C-w>d` 在小窗口中预览当前光标下存在的语法错误
297+
- `gsd` 在弹出窗口中预览当前项目中的所有静态检查语法错误
298+
- `<C-w>d` 在小窗口中预览当前光标下存在的静态检查语法错误
299+
- `gsq` 在弹出窗口中预览当前项目中的所有编译器报错
300+
- `gso` 打开/关闭大纲视图
301+
- `gst` 打开/关闭项目文件树
302+
- `gsi` 开启/关闭 Inlay Hint 功能
299303

300304
#### 语法树换位 (nvim-treesitter)
301305

lua/archvim/config/lspconfig.lua

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,34 @@ local function setup_lsp(event)
9393
end,
9494
})
9595

96+
vim.api.nvim_create_autocmd({'CursorMoved', 'CursorMovedI'}, {
97+
group = group,
98+
buffer = event.buf,
99+
callback = vim.lsp.buf.clear_references,
100+
})
101+
end
102+
103+
vim.api.nvim_create_autocmd({"CursorHold"}, {
104+
callback = function()
105+
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
106+
if vim.api.nvim_win_get_config(winid).zindex then
107+
return
108+
end
109+
end
110+
vim.diagnostic.open_float({
111+
scope = "cursor",
112+
focusable = false,
113+
close_events = {
114+
"CursorMoved",
115+
"CursorMovedI",
116+
"BufHidden",
117+
"InsertCharPre",
118+
"WinLeave",
119+
},
120+
})
121+
end,
122+
})
123+
96124
if vim.lsp.buf.signature_help ~= nil and require'archvim.options'.enable_signature_help then
97125
vim.api.nvim_create_autocmd({'CursorHoldI'}, {
98126
group = group,
@@ -102,13 +130,6 @@ local function setup_lsp(event)
102130
end
103131
})
104132
end
105-
106-
vim.api.nvim_create_autocmd({'CursorMoved', 'CursorMovedI'}, {
107-
group = group,
108-
buffer = event.buf,
109-
callback = vim.lsp.buf.clear_references,
110-
})
111-
end
112133
end
113134

114135
vim.api.nvim_create_autocmd('LspAttach', {

lua/archvim/mappings.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,20 @@ vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>")
183183
vim.keymap.set("n", "gD", function()
184184
vim.lsp.buf.declaration()
185185
end)
186+
-- 开关静态分析错误列表
186187
vim.keymap.set("n", "gsd", "<cmd>Trouble diagnostics toggle<CR>")
188+
-- 开关编译器报错列表
189+
vim.keymap.set("n", "gsq", "<cmd>Trouble qflist toggle<CR>")
190+
-- 开关 Inlay Hint
191+
vim.keymap.set("n", "gsi", function()
192+
if vim.lsp.inlay_hint ~= nil then
193+
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
194+
end
195+
end)
196+
-- 开关项目文件树
197+
vim.keymap.set({"v", "n", "i", "t"}, "gst", "<cmd>NvimTreeFindFileToggle<CR>", { silent = true })
198+
-- 开关大纲视图
199+
vim.keymap.set("n", "gso", "<cmd>AerialToggle!<CR>")
187200
-- 查找类型定义
188201
vim.keymap.set("n", "gy", "<cmd>Telescope lsp_type_definitions<CR>")
189202
-- 查找所有引用

0 commit comments

Comments
 (0)