Compare commits

..

228 Commits

Author SHA1 Message Date
QQ ceeccbc431 更新一下slot配置 2026-07-06 10:00:22 +08:00
QQ 4eea6fd736 update 2026-06-17 18:03:03 +08:00
QQ 293a5a8689 Merge arch-refactor into main 2026-06-17 14:47:13 +08:00
QQ ba27352d7b fix: pcall QQdock.setup for backward compat with old clone 2026-06-11 20:03:14 +08:00
QQ a210f5e43f config: QQdock size horizontal=10 vertical=40 2026-06-11 20:00:14 +08:00
QQ 93650204df switch QQdock from local module to lazy spec 2026-06-11 19:52:07 +08:00
QQ e1009aea83 refactor: add plugs/QQdock.lua spec (disabled), keep local lua/QQdock/ for now 2026-06-11 19:32:33 +08:00
QQ a615ae1bb7 refactor: QQdock as proper plugin module (lua/QQdock/init.lua) 2026-06-11 19:31:07 +08:00
QQ 7884551a26 restore: local addons/QQdock pending RO fs fix, remote repo at git.qyhhh.top/newbie/QQdock.nvim 2026-06-11 19:18:35 +08:00
QQ 9ae6fcb2ad chore: remove embedded term-plugin repo 2026-06-11 19:14:30 +08:00
QQ fd2e7263f7 rename: term → QQdock 2026-06-11 19:14:24 +08:00
QQ 0727f447d8 feat: add lazygit shortcut (<leader>gg) via addons/term 2026-06-11 17:01:09 +08:00
QQ 131bcb8bf5 refactor: extract terminal logic into addons/term 2026-06-11 17:00:29 +08:00
QQ e45a3b991e feat: terminal persistence (toggle show/hide), size 40%-45% like IDE split 2026-06-11 16:53:09 +08:00
QQ bb1a4df9fa fix: terminal size 30% → 40 cols 2026-06-11 16:49:10 +08:00
QQ 8334f6042a fix: swap terminal split direction — wide→right, tall→bottom 2026-06-11 16:46:36 +08:00
QQ dcfef43b07 refactor: Reasonix terminal size matches nvimtree (30cols vertical, 10rows horizontal) 2026-06-11 16:40:19 +08:00
QQ 3253a2b20f feat: <c-t> adaptive split same as Reasonix, works in both n/i modes 2026-06-11 16:39:38 +08:00
QQ 3c5fa11ef1 docs: add <C-i> Reasonix keymap to README 2026-06-11 16:38:43 +08:00
QQ 480cfff657 feat: add Reasonix keymap <C-i> with adaptive split direction 2026-06-11 16:38:27 +08:00
QQ b01f94be0a docs: add README and key config comments 2026-06-11 16:16:45 +08:00
QQ 2ffc088aa2 refactor: textwidth=0, simplify G.map/delmap, drop redundant opt, reduce lualine refresh 2026-06-11 15:53:50 +08:00
QQ bc435e499e fix: replace table.unpack with direct indexing for Neovim 0.12 compat 2026-06-11 15:28:19 +08:00
QQ 3bfbb680fb fix: cmdline <CR> fallthrough when no selection 2026-06-11 15:21:18 +08:00
QQ dc82aa4ad8 fix: cmdline completion sources, gitignore nvim.log 2026-06-11 12:04:58 +08:00
QQ 8c60f353f8 fix: nvimtree <C-e> keymap, add cmdline completion for cmp 2026-06-11 12:00:49 +08:00
QQ 5261a7f2d7 update 2026-06-11 11:53:52 +08:00
QQ cbf4579990 refactor: fix medium-severity issues (lazy leak, formatoptions, dupe map, dead opts, split theme, cmp keys, capabilities injection, typos, style) 2026-06-11 11:53:18 +08:00
QQ f1ed06ae9f refactor: split nvim-lspconfig into 6 modules, change rename to <cs-r> 2026-06-11 10:12:48 +08:00
QQ 4acadc3ae4 refactor: go.nvim build checks for go binary before installing tools 2026-06-10 22:58:29 +08:00
QQ 64e4111d78 update 2026-06-10 22:17:24 +08:00
QQ b2a3bc393e update 2026-05-17 22:03:51 +08:00
QQ 22dde69f49 first push 2024-08-24 01:14:49 +08:00
QQ 4498108b19 first push 2024-08-24 00:42:40 +08:00
QQ 89668c0024 first push 2024-08-24 00:39:19 +08:00
QQ 6abd9e80c4 update 2024-08-21 15:44:28 +08:00
newbie 840422bde1 update 2024-02-22 21:21:39 +08:00
newbie e4c8ff2f16 update 2024-02-22 21:19:55 +08:00
newbie 6ad2dee781 update 2024-02-07 13:34:06 +08:00
newbie bee651d083 update 2024-02-04 14:29:31 +08:00
newbie 6db4bc6b2a updae 2024-02-04 14:24:22 +08:00
newbie bb38aab048 update 2024-02-01 14:22:05 +08:00
newbie 08184ce63d update 2024-02-01 12:14:27 +08:00
newbie a077ec48c2 增加ssh下载 2024-02-01 11:57:48 +08:00
newbie 04d2ed31d8 update 2024-01-28 16:12:42 +08:00
newbie 81483d4a44 update 2024-01-27 14:25:50 +08:00
newbie 3fd84ce96a update 2024-01-27 12:31:28 +08:00
newbie 21bdf41b37 update 2024-01-27 12:31:15 +08:00
newbie c6dd7ac677 update 2024-01-26 15:32:49 +08:00
newbie 1183b67b68 update 2024-01-22 20:23:18 +08:00
newbie 2e0f8c2a59 update 2024-01-22 19:34:13 +08:00
newbie c39a6f7f09 update 2024-01-20 00:48:15 +08:00
newbie e8e3fa6a3d update 2024-01-16 20:16:19 +08:00
newbie e6d0b2d1f6 update 2024-01-16 20:05:57 +08:00
newbie 4c09041e7e update 2024-01-14 23:20:45 +08:00
newbie 19dd7b61a9 update 2024-01-14 23:16:07 +08:00
newbie 94b3855850 update 2024-01-14 23:10:36 +08:00
newbie 373f67612a update 2024-01-14 19:23:34 +08:00
newbie 56c11a3501 update 2024-01-10 23:21:52 +08:00
newbie ec42df6ac5 update 2024-01-10 23:12:51 +08:00
newbie 9bbc7ba77f update 2024-01-08 14:23:13 +08:00
newbie 113d1c49ab pupdatye 2024-01-06 22:54:13 +08:00
newbie 1f641595fe update 2024-01-06 20:21:15 +08:00
newbie 9b946457da updae 2024-01-06 19:05:22 +08:00
newbie d3bc3ce9ab update 2024-01-06 18:50:53 +08:00
newbie 8f0996aaa9 update 2024-01-06 18:44:41 +08:00
newbie 6d0417c208 update 2024-01-06 11:19:15 +08:00
newbie 7c52a3c538 update 2024-01-06 10:59:58 +08:00
newbie 5eaf966f21 update 2024-01-06 10:53:27 +08:00
newbie 1798c57e08 update 2024-01-06 00:30:26 +08:00
newbie 4848f6e7dc update 2024-01-03 14:53:07 +08:00
newbie 3d02627fcb update 2024-01-03 14:50:03 +08:00
newbie ca0520cd1e updtae 2024-01-03 14:18:04 +08:00
newbie dc59083710 update 2024-01-02 19:58:43 +08:00
newbie 351d431138 update 2024-01-02 16:19:15 +08:00
newbie 76424f27d6 update 2024-01-01 15:58:59 +08:00
newbie b6ea884cee update 2024-01-01 15:55:58 +08:00
newbie 02e0806fc5 update 2023-12-28 20:31:40 +08:00
newbie c2bfcb8ff8 update 2023-12-25 13:03:32 +08:00
newbie 90c900c602 add yaml lsp 2023-12-19 12:08:06 +08:00
newbie 6b8fec654c update 2023-12-19 12:02:11 +08:00
newbie 317c612f41 update lspconfig 2023-12-19 07:16:27 +08:00
newbie d6950258d7 update 2023-12-19 07:13:58 +08:00
newbie f67a85dfb1 update bashls 2023-12-18 23:46:48 +08:00
newbie adb1e88397 update 2023-12-18 23:42:55 +08:00
newbie a1c9ef545c update 2023-12-18 23:34:23 +08:00
newbie eed785a3e6 lspkind 2023-12-18 23:31:37 +08:00
newbie 9499019de5 update 2023-12-18 23:20:53 +08:00
newbie d7f0011c35 update 2023-12-18 23:04:33 +08:00
newbie ff8d4684aa update 2023-12-16 12:07:36 +08:00
newbie 3c09b60016 update 2023-12-15 12:15:39 +08:00
newbie c91084492b update 2023-12-10 12:16:25 +08:00
newbie c721614f76 updatye 2023-12-06 12:06:40 +08:00
newbie 158941ec4b udpate 2023-11-28 13:05:29 +08:00
newbie d79e249e04 ad 2023-11-28 07:46:34 +08:00
newbie 32fda72951 update 2023-11-27 23:08:28 +08:00
newbie be12cae2f9 update 2023-11-27 18:33:57 +08:00
newbie d5927286ab update 2023-11-27 18:22:30 +08:00
newbie bc468f62ca update 2023-11-27 18:19:55 +08:00
newbie 9ff261284f udpate 2023-11-27 18:11:11 +08:00
newbie e4831c4143 update 2023-11-26 19:04:08 +08:00
newbie a6a0ba8d2a update 2023-11-26 18:15:09 +08:00
newbie b2e16f4779 update 2023-11-26 18:13:46 +08:00
newbie 55009edec1 update\ 2023-11-26 18:09:36 +08:00
newbie a1a519ee04 add outline 2023-11-26 08:21:03 +08:00
newbie a3699481a0 upadte 2023-11-26 00:19:51 +08:00
newbie bc619ee6e8 update 2023-11-25 23:42:01 +08:00
newbie 1776426f90 update 2023-11-24 12:59:48 +08:00
newbie 7b84aefc2f update 2023-11-23 23:01:13 +08:00
newbie 3cda0b2696 updaye 2023-11-23 18:39:37 +08:00
newbie 31100c0bb4 asd 2023-11-23 13:19:07 +08:00
newbie 186f3b37af update 2023-11-22 23:59:31 +08:00
newbie e11d62310a update 2023-11-22 23:30:38 +08:00
newbie 8f8db2de10 update' 2023-11-22 23:19:24 +08:00
newbie b99c2fb31b update 2023-11-22 12:59:44 +08:00
newbie 1572e264bb update 2023-11-21 23:16:48 +08:00
newbie b2e92ed5b4 update 2023-11-19 07:56:01 +08:00
newbie 675efecef7 update 2023-11-19 00:37:52 +08:00
QQ 3e409dd1da update 2023-11-18 23:58:25 +08:00
QQ 722bf63839 update 2023-11-18 23:21:18 +08:00
QQ 5413e8323f update 2023-11-17 12:44:57 +08:00
QQ c30bcb1ad1 uodada 2023-11-16 23:43:38 +08:00
QQ a77c1908dd add two plugs 2023-11-16 23:29:04 +08:00
QQ 6dfd732e6d update 2023-11-16 18:14:03 +08:00
QQ 02814a2ba4 update 2023-11-16 12:46:18 +08:00
QQ 9e72d8a2b6 changes flask 2023-11-15 23:40:02 +08:00
QQ f75aa5ec60 update my setting 2023-11-15 13:16:34 +08:00
QQ 676663312a update 2023-11-15 12:56:11 +08:00
QQ f13050bbff update 2023-11-14 13:47:43 +08:00
QQ eee82fd12a update c-f 2023-11-06 00:01:36 +08:00
QQ 6b0bc4cd3e daasdasd 2023-10-15 22:31:32 +08:00
QQ 94d59b68d4 daasdasd 2023-10-15 22:30:52 +08:00
QQ bb72e3049b daasdasd 2023-10-15 20:01:47 +08:00
QQ 6105613974 daasdasd 2023-10-15 19:44:29 +08:00
QQ dc6211e158 daasdasd 2023-10-15 16:37:24 +08:00
QQ de09f1cf28 daasdasd 2023-10-13 18:09:50 +08:00
QQ 861484c0a2 first commit 2023-10-13 18:08:52 +08:00
QQ 638c016838 update 2023-10-10 18:26:42 +08:00
QQ 06c1c92cf3 update 2023-10-10 18:14:47 +08:00
QQ 216fb3527d udpaty 2023-10-10 18:09:35 +08:00
QQ 2f7ce7fc63 updatyy 2023-10-09 17:01:31 +08:00
QQ f0699c52ac dasdas 2023-10-09 16:48:02 +08:00
QQ 149e2a93c5 update 2023-10-09 16:14:40 +08:00
QQ 3b6c8ee310 update 2023-10-08 23:27:05 +08:00
QQ 10cda71a9d update 2023-10-08 22:40:40 +08:00
QQ 4cc25ed0a7 qwe 2023-10-07 10:49:59 +08:00
QQ b0c72897dc asd 2023-10-07 10:49:13 +08:00
QQ b0177d7e1b qwe 2023-10-05 23:23:24 +08:00
QQ 962d79f5b4 wqe 2023-10-05 23:21:33 +08:00
QQ c97c6a0cf0 wqe 2023-10-05 15:14:24 +08:00
QQ e5603f4c6f wqe 2023-10-05 15:13:44 +08:00
QQ 33fdd37491 we 2023-10-05 15:09:47 +08:00
QQ 2e589e81f8 123 2023-10-05 14:56:51 +08:00
QQ 8ea69aaa53 asd 2023-10-04 17:04:01 +08:00
QQ 374ea7e318 update 2023-10-03 01:12:10 +08:00
QQ e084437b4d update 2023-10-02 22:05:38 +08:00
QQ c1541c6e2e update 2023-10-01 17:18:36 +08:00
QQ 516c9e019e ' 2023-10-01 09:27:25 +08:00
QQ 3d439de0d0 . 2023-10-01 09:21:32 +08:00
QQ dc74d3edf4 :: 2023-10-01 00:45:00 +08:00
qcloud a27ce3efaa add install script 2023-09-30 20:30:35 +08:00
qcloud e6c75ed341 change 2023-09-30 20:08:03 +08:00
QQ 4a7393a1ea 删除项目管理 2023-05-16 21:58:17 +08:00
QQ 87d5fc4b28 没事 2023-05-16 21:44:53 +08:00
QQ 31aa10fa34 没啥变化 2023-05-12 11:20:06 +08:00
QQ 8780151610 增加了安装文件 2023-05-12 11:00:26 +08:00
QQ a228c5a028 增加了工作区,但是没啥软子用 2023-05-10 11:01:31 +08:00
QQ 4f88e82366 增加插件 2023-05-09 20:06:48 +08:00
QQ c73156d67b 没事了 2023-05-09 14:08:36 +08:00
QQ 9bfade813d 乱改配置 2023-05-08 23:53:52 +08:00
QQ f1eed0e101 进行了没什么软用的修改 2023-05-08 23:43:49 +08:00
QQ e726be8b6d 增加打开文件 2023-05-08 11:33:18 +08:00
QQ b651252f41 修改快捷键的加载方式 2023-05-08 11:30:06 +08:00
QQ 1f8e865ae7 增加nerdtree 2023-05-08 10:52:46 +08:00
QQ aa9936a8cd update 2023-05-02 21:23:01 +08:00
QQ a7996f2328 添加fzf 2023-05-02 21:12:12 +08:00
QQ ba8c93735b 删除treesitter配置,以及更换主题 2023-04-29 22:30:25 +08:00
QQ 5dc4318fe3 删除treesitter配置 2023-04-07 09:24:07 +08:00
QQ c9245a9d51 删除treesitter预设 2023-04-03 19:41:42 +08:00
QQ 3e318b17e8 增加copilot插件 2023-03-25 09:09:33 +08:00
QQ c471db8eeb 修改键位 2023-03-24 21:59:13 +08:00
QQ fa9ea104a2 整理位置 2023-03-19 15:41:15 +08:00
QQ 8918eeb8b4 将packer迁移到lazy.nvim 2023-03-19 00:22:18 +08:00
QQ 98902b2126 update 2023-02-24 22:35:57 +08:00
QQ 7af0657a6e 改进imchange 2023-02-24 22:16:06 +08:00
QQ e6841dd1f9 删除没用的插件 2023-02-18 19:56:42 +08:00
QQ 0cc9512218 更新vue语法高亮 2023-02-18 19:55:19 +08:00
QQ 0d6eeb667f 增加vue语法解析 2023-02-18 19:45:10 +08:00
QQ 408042f001 删除vimwiki,这个插件用不到 2023-02-18 19:28:45 +08:00
QQ 05c6e2a26b 删除无效插件 2023-02-18 10:07:14 +08:00
QQ c87b110b94 更新安装方法 2023-02-11 23:07:44 +08:00
QQ 38050c3689 更新coc-explorer插件 2023-02-11 14:31:48 +08:00
QQ 537bc1a03e 添加js语法高亮插件 2023-02-11 14:22:43 +08:00
QQ c04a378bc4 添加插件 2023-02-11 13:36:26 +08:00
QQ 81a308d75b 安装多光标 2023-02-10 17:24:19 +08:00
QQ bc3ea18e18 增加括号插件的选项 2023-02-08 17:32:24 +08:00
QQ 276dbbb065 增加括号的插件 2023-02-08 17:24:53 +08:00
QQ 3cad788692 增加高亮插件 2023-02-05 04:47:12 +08:00
QQ 798d3331e3 增加插件 2023-02-05 04:41:06 +08:00
QQ 24dc738d09 增加outline快捷键 2023-02-05 04:14:55 +08:00
QQ 2d33296bf7 修复md关闭不能关闭预览 2023-01-28 18:52:00 +08:00
QQ 63d15c0110 修复imchange 2023-01-28 18:50:00 +08:00
QQ 494c7d7a55 更新im插件 2023-01-28 18:15:05 +08:00
QQ cb2cef849b 修复markdown 2023-01-28 16:23:14 +08:00
QQ f0a0cce850 安装vimwiki 2023-01-28 16:20:45 +08:00
QQ f2fef63db9 update 2023-01-28 15:59:16 +08:00
QQ a4cfb715c0 更换插件管理器 2023-01-28 15:11:37 +08:00
QQ 1a2e068a8b update 2023-01-27 23:44:25 +08:00
QQ f0f1bd4146 update 2023-01-26 22:35:16 +08:00
QQ 1d1beda5e0 update 2023-01-25 01:02:33 +08:00
QQ 87f59ae9dd update 2023-01-24 22:27:07 +08:00
QQ dc612b402c update 2023-01-22 23:03:08 +08:00
QQ 2063fb519d update 2023-01-22 22:30:24 +08:00
QQ d7917f5236 update 2023-01-22 22:23:51 +08:00
QQ 6918e692bb update 2023-01-22 22:20:39 +08:00
QQ aa2ffcfaf5 update 2023-01-22 20:48:09 +08:00
QQ 965f5cf9de 更新README的文件结构 2023-01-22 20:24:58 +08:00
QQ 3fa1279ac1 update 2023-01-22 20:22:01 +08:00
QQ 76f1a2fdee update 2023-01-22 20:20:54 +08:00
QQ 9cf805a96e update 2023-01-22 17:20:38 +08:00
QQ 20ab814b8d update 2023-01-21 22:51:22 +08:00
QQ 1673881b9e update 2023-01-21 21:48:17 +08:00
QQ aa0c91b0a5 update 2023-01-20 21:36:34 +08:00
QQ 879f1065a2 update 2023-01-19 21:04:31 +08:00
QQ 00c68a0bee first commit 2023-01-19 20:34:49 +08:00
QQ 5e4d3df8ba update 2023-01-19 20:33:35 +08:00
QQ 95cd3fcde0 update 2023-01-19 19:11:37 +08:00
QQ f249120097 init 2023-01-19 18:14:43 +08:00
28 changed files with 803 additions and 476 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
lazy-lock.json
nvim.log

174
README.md Normal file
View File

@ -0,0 +1,174 @@
# Neovim 配置
基于 Neovim 0.12+lazy.nvim 管理插件,支持原生和 VSCode Neovim 双模式。
## 目录结构
```
init.lua # 入口:安装 lazy.nvim → keymaps → 分支判断
lua/
G.lua # 全局工具单例vim API 别名 + 映射/命令/自动命令封装)
keymap.lua # 基础快捷键
options.lua # vim.opt 基础设置
vsc.lua # VSCode Neovim 模式下的精简启动(仅编辑插件)
plugs.lua # 插件聚合器10 个模块)
plugs/
nvim-lspconfig.lua # LSP 核心7 个 server 注册 + LSP 快捷键
mason.lua # LSP server 自动安装Mason
nvim-cmp.lua # 补全引擎nvim-cmp + vsnip + lspkind + 命令行补全)
treesitter.lua # 语法高亮 + 自动安装 parser
symbols-outline.lua # 代码大纲侧边栏
winbar.lua # 顶部文件路径 + 函数标签
nvimtree.lua # 文件树
theme.lua # 主题tokyonight+ 状态栏lualine+ 标签栏tabline
edit-plugs.lua # 编辑增强fzf/surround/wildfire/多光标/对齐/Copilot/折叠/hop
dev.lua # 开发工具colorizer/go.nvim/conda/toggleterm
lsp/
lua.lua # Lua LSPLuaJIT + 全局变量声明)
c.lua # C/C++ LSPclangd+ :R 编译运行
bash.lua # Bash LSP + :R 运行
go.lua # Go LSPgopls+ :R / :Rgin 运行
basedpyright.lua # Python LSPbasedpyright+ :R 运行
yaml.lua # YAML LSP + GitHub Workflow schema
json.lua # JSON LSP
snippets/ # 代码片段C/Go/JSON/Lua
```
## 启动流程
```
G.lua → 克隆/定位 lazy.nvim → keymap.lua →
若 VSCode 环境 → vsc.lua仅编辑插件
若原生 Neovim → options.lua → lazy.setup(plugs.lua)
```
## 插件总表(~28 个)
| 分类 | 插件 | 用途 |
|------|------|------|
| LSP | nvim-lspconfig | LSP 客户端配置 |
| LSP | Mason + mason-lspconfig | LSP server 自动下载 |
| LSP | lua_ls, clangd, bashls, gopls, basedpyright, yamlls, jsonls | 7 种语言 LSP |
| 补全 | nvim-cmp + cmp-nvim-lsp + cmp-buffer + cmp-path + cmp-cmdline | 补全引擎 |
| 补全 | vim-vsnip + cmp-vsnip | 代码片段引擎 |
| 补全 | lspkind-nvim | 补全图标 |
| 语法 | nvim-treesitter | 语法高亮 + 缩进检测 |
| 语法 | nvim-autopairs | 自动括号配对 |
| 语法 | nvim-hlchunk | 括号层级和缩进色块 |
| 主题 | tokyonight.nvim | 配色方案 |
| UI | lualine.nvim | 状态栏 |
| UI | tabline.nvim | 顶部标签栏 |
| UI | winbar.nvim | 顶部文件名 + 函数路径 |
| UI | nvim-tree.lua | 侧边文件树 |
| UI | symbols-outline.nvim | 代码大纲 |
| UI | colorizer | 颜色值可视化 |
| 编辑 | nvim-fzf | 模糊搜索 |
| 编辑 | vim-surround | 环绕字符操作cs/ds/ys |
| 编辑 | wildfire.vim | 选区自动扩大/缩小 |
| 编辑 | vim-multiple-cursors | 多光标编辑 |
| 编辑 | vim-easy-align | 对齐排版 |
| 编辑 | hop.nvim | 快速跳转(替代 f/F/t/T |
| 编辑 | nvim-ufo | 现代折叠treesitter 驱动) |
| AI | copilot.vim | GitHub Copilot 行内补全 |
| 语言 | go.nvim | Go 开发增强test/coverage 等) |
| 语言 | nvim-conda | Conda 环境切换 |
| 终端 | toggleterm.nvim | 浮层终端 |
## 快捷键速查
### 基础操作
| 键 | 模式 | 功能 |
|----|------|------|
| `<leader>nh` | n | 清除搜索高亮 |
| `<leader>rp` | n | 全局替换 `:%s/` |
| `<leader>y` / `p` / `v` | n | 全文件复制/粘贴/全选 |
| `<A-h>` / `<A-l>` | n | 切换左右标签页 |
| `<c-j/h/k/l>` | n | 窗口间跳转 |
| `<c-c>` / `<c-q>` | n | 关闭窗口 / 强制关闭 |
| `<c-S>` | n | sudo 强制保存 |
| `<cs-y>` | v | 复制到系统剪切板 |
| `<c-e>` | n | 文件树开关 |
| `<cs-o>` | n | 代码大纲开关 |
| `<c-t>` | n/i | 终端开关 |
| `<C-i>` | n | Reasonix AI自适应分屏横屏→下方竖屏→右侧 |
| `<up/down/left/right>` | n | 调整窗口大小 |
### LSP
| 键 | 模式 | 功能 |
|----|------|------|
| `gd` | n | 跳转到定义 |
| `gh` | n | 悬浮文档 |
| `gD` | n | 跳转到声明 |
| `gi` | n | 跳转到实现 |
| `gr` | n | 查找引用 |
| `<cs-r>` | n | 重命名符号 |
| `<cs-i>` | n | 代码格式化 |
### 语言运行 `:R`
| 语言 | 命令 |
|------|------|
| C/C++ | 编译 → 运行 → 删二进制 |
| Bash | `sh %` |
| Go | `go run %``:Rgin` 运行 `main.go` |
| Python | `python3 %` |
### 补全(插入模式)
| 键 | 功能 |
|----|------|
| `<C-n>` / `<C-p>` | 选择补全项 / snippet 占位跳转 |
| `<CR>`(未选择时) | 换行 |
| `<CR>`(选择后) | 确认补全 |
| `Tab` | Copilot 接受建议 |
### 命令栏 / 搜索栏补全
| 键 | 功能 |
|----|------|
| `Tab` / `S-Tab` | 选择补全项 |
| `<CR>`(未选择时) | 直接执行命令/搜索 |
| `<CR>`(选择后) | 确认补全 |
### 编辑
| 键 | 模式 | 功能 |
|----|------|------|
| `f` / `F` / `t` / `T` | n | hop 行内跳转(覆盖原生) |
| `<c-f>` | n | hop 双字符跳转 |
| `ga` / `=` | v | EasyAlign 对齐 |
| `gc` / `gcc` | n | 注释切换Neovim 0.12 内置) |
| `zc` / `zo` / `za` / `zR` | n | 折叠ufo |
### 文件树内
| 键 | 功能 |
|----|------|
| `v` | 垂直分屏打开 |
| `s` | 水平分屏打开 |
## LSP 说明
- 使用 Neovim 0.11+ 新 API`vim.lsp.config` / `vim.lsp.enable`
- `capabilities``cmp_nvim_lsp` 统一在 `nvim-lspconfig.lua` 注入,各语言文件不重复 require
- `basedpyright` 替代了 `pyright`(类型检查更强)
- Mason 自动安装bashls、lua_ls、jsonls、yamllsbasedpyright 需手动装)
- Treesitter 关闭了 txt parser禁用了 Go恢复中由 go.nvim 处理)
## 安装
```bash
# 克隆到 Neovim 配置目录
git clone https://git.qyhhh.top/newbie/nvim.git ~/.config/nvim
# 首次启动会自动安装 lazy.nvim 及全部插件
nvim
```
## 许可
MIT

View File

@ -1,31 +1,31 @@
G = require('G')
-- Clone lazy.nvim (only needed for native Neovim, not VSCode)
if not G.g.vscode then
local lazypath = G.fn.stdpath("data") .. "/lazy/lazy.nvim"
-- lazy.nvim 必须在 VSCode 和原生环境都可用原生用它装插件VSCode 的 vsc.lua 也需要 require('lazy')
local lazypath = G.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not G.loop.fs_stat(lazypath) then
G.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
})
end
G.opt.rtp:prepend(lazypath)
end
require("keymap")
-- keymap 在两个环境都加载(基础键位都不依赖插件)
require('keymap')
if G.g.vscode then
-- VSCode Neovim 模式:只加载编辑插件,不加载 LSP/补全/主题/选项
require('vscode')
else
require("options")
local clone_prefix = G.use_ssh and "git@github.com:%s.git" or "https://github.com/%s.git"
require("lazy").setup(
require('options')
local clone_prefix = G.use_ssh and 'git@github.com:%s.git' or 'https://github.com/%s.git'
require('lazy').setup(
require('plugs'), {
lockfile = G.fn.stdpath("data") .. "/lazy/lazy-lock.json",
lockfile = G.fn.stdpath('data') .. '/lazy/lazy-lock.json',
git = {
url_format = clone_prefix,
}

View File

@ -13,28 +13,16 @@ G.lb = vim.lsp.buf
G.dic = vim.diagnostic
G.cgp = vim.nvim_create_augroup
-- 批量设置键映射3 元素自动加 { noremap = true }4 元素用传入的 opts
function G.map(maps)
for _, map in pairs(maps) do
if #map == 3 then
vim.keymap.set(map[1], map[2], map[3], { noremap = true })
elseif #map == 4 then
vim.keymap.set(map[1], map[2], map[3], map[4])
else
print("太多变量了")
end
--G.api.nvim_set_keymap(map[1], map[2], map[3], map[4])
vim.keymap.set(map[1], map[2], map[3], map[4] or { noremap = true })
end
end
function G.delmap(maps)
for _, map in pairs(maps) do
if #map == 2 then
vim.keymap.del(map[1], map[2], {})
elseif #map == 3 then
vim.keymap.del(map[1], map[2], map[3])
else
print("太多变量了")
end
vim.keymap.del(map[1], map[2], map[3] or {})
end
end
@ -54,6 +42,7 @@ function G.au(even, opts)
return G.api.nvim_create_autocmd(even, opts)
end
-- :R 命令工厂:在下方分屏开终端运行指定命令,省去 5 个 LSP 文件的重复代码
function G.run_cmd(cmd)
return function()
G.cmd [[set splitbelow | sp]]

View File

@ -1,46 +1,40 @@
local opt = { noremap = true }
-- base
G.map({
{ 'n', '<leader>nh', ':nohlsearch<CR>', opt },
{ 'n', '<leader>rp', ':%s/', opt },
{ 'n', '<leader>nh', ':nohlsearch<CR>' },
{ 'n', '<leader>rp', ':%s/' },
{ 'v', 'L', '$', opt },
{ 'v', 'H', '^', opt },
{ 'n', 'L', '$', opt },
{ 'n', 'H', '^', opt },
{ 'v', '>', '>gv', opt },
{ 'v', '<', '<gv', opt },
{ 'v', 'L', '$' },
{ 'v', 'H', '^' },
{ 'n', 'L', '$' },
{ 'n', 'H', '^' },
{ 'v', '>', '>gv' },
{ 'v', '<', '<gv' },
{ 'n', '>', '>>', opt },
{ 'n', '<', '<<', opt },
{ 'n', '?', ':set hlsearch<CR>?', opt },
{ 'n', '/', ':set hlsearch<CR>/', opt },
{ 'n', '>', '>>' },
{ 'n', '<', '<<' },
{ 'n', '?', ':set hlsearch<CR>?' },
{ 'n', '/', ':set hlsearch<CR>/' },
{ 'n', '<A-l>', ':tabn<CR>', opt },
{ 'n', '<A-h>', ':tabp<CR>', opt },
{ 'n', '<A-l>', ':tabn<CR>' },
{ 'n', '<A-h>', ':tabp<CR>' },
{ 'n', '<c-j>', '<c-w>j' },
{ 'n', '<c-h>', '<c-w>h' },
{ 'n', '<c-k>', '<c-w>k' },
{ 'n', '<c-l>', '<c-w>l' },
{ 'n', '<c-j>', '<c-w>j', opt },
{ 'n', '<c-h>', '<c-w>h', opt },
{ 'n', '<c-k>', '<c-w>k', opt },
{ 'n', '<c-l>', '<c-w>l', opt },
{ 'n', '<c-c>', ':q<CR>' },
{ 'n', '<c-S>', ':w !sudo tee %<CR>' },
{ 'n', '<c-q>', ':q!<CR>' },
{ 'v', '<cs-y>', '"+y' },
{ 'n', '<leader>y', 'ggyG' },
{ 'n', '<leader>p', 'ggpG' },
{ 'n', '<leader>v', 'ggVG' },
{ 'n', '<c-c>', ':q<CR>', opt },
{ 'n', '<c-S>', ':w !sudo tee %<CR>', opt },
{ 'n', '<c-q>', ':q!<CR>', opt },
{ 'v', '<cs-y>', '"+y', opt },
{ 'n', '<leader>y', 'ggyG', opt },
{ 'n', '<leader>p', 'ggpG', opt },
{ 'n', '<leader>v', 'ggVG', opt },
{ 'n', '<up>', ':res -5<CR>', opt },
{ 'n', '<down>', ':res +5<CR>', opt },
{ 'n', '<left>', ':vertical resize -5<CR>', opt },
{ 'n', '<right>', ':vertical resize +5<CR>', opt },
{ 'n', '<up>', ':res -5<CR>' },
{ 'n', '<down>', ':res +5<CR>' },
{ 'n', '<left>', ':vertical resize -5<CR>' },
{ 'n', '<right>', ':vertical resize +5<CR>' },
})

View File

@ -1,5 +1,5 @@
return {
capabilities = require("cmp_nvim_lsp").default_capabilities(),
-- basedpyrightpyright 的增强分支类型检查更强。capabilities 由 nvim-lspconfig.lua 统一注入
settings = {
basedpyright = {
analysis = {

View File

@ -1,5 +1,4 @@
return{
capabilities = require('cmp_nvim_lsp').default_capabilities(),
on_attach = function()
G.api.nvim_create_user_command('R', G.run_cmd('sh %'), {})
end

View File

@ -1,5 +1,4 @@
return {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
on_attach = function()
G.api.nvim_create_user_command('R', G.run_cmd('g++ "%" -o "%<" && ./"%<" && rm "%<"'), {})
end

View File

@ -1,5 +1,5 @@
return {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
-- gopls + :Rgo run %+ :Rgingo run ./main.go主入口专用
on_attach = function()
G.api.nvim_create_user_command('R', G.run_cmd('go run %'), {})
G.api.nvim_create_user_command('Rgin', G.run_cmd('go run ./main.go'), {})

View File

@ -1,3 +1 @@
return {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
}
return {}

View File

@ -5,8 +5,6 @@ table.insert(runtime_path, "lua/?/init.lua")
return {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
settings = {
Lua = {

2
lua/lsp/markdown.lua Normal file
View File

@ -0,0 +1,2 @@
return {
}

11
lua/lsp/pyright.lua Normal file
View File

@ -0,0 +1,11 @@
return {
on_attach = function()
G.api.nvim_create_user_command('R', function()
G.cmd [[set splitbelow]]
G.cmd [[sp]]
G.cmd [[term python3 %]]
G.cmd [[resize 10]]
G.cmd [[startinsert]]
end, {})
end
}

View File

@ -1,5 +1,4 @@
return {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
settings = {
yaml = {
schemas = {

View File

@ -1,4 +1,3 @@
--
G.opt.ttimeout = true
G.opt.ttimeoutlen = 100
@ -8,7 +7,6 @@ G.opt.rnu = true
G.opt.scrolloff = 999
-- 自动保存
G.opt.autowrite = true
G.opt.autowriteall = true
-- tab键
@ -31,24 +29,18 @@ G.opt.ignorecase = true
G.opt.incsearch = true
-- 不换行
G.opt.textwidth = 999
G.opt.textwidth = 0
G.opt.wrap = false
-- 文件判断
G.cmd("filetype plugin indent on")
-- 取消换行注释
G.au({ "BufEnter" }, {
pattern = { "*" },
callback = function()
-- vim.opt.formatoptions = vim.opt.formatoptions - { "c", "r", "o" }
G.opt.formatoptions = G.opt.formatoptions
- "o" -- O and o, don't continue comments
+ "r" -- But do continue when pressing enter.
end,
})
-- 取消换行注释o 和 O 不自动续注释回车继续续注释一次设定formatoptions 不会变)
G.opt.formatoptions = G.opt.formatoptions - "o" + "r"
-- 进入插入模式时自动关搜索高亮(个人偏好:打字时不想被高亮干扰)
G.au({ "InsertEnter" }, {
pattern = { "*" },
callback = function()
@ -56,6 +48,7 @@ G.au({ "InsertEnter" }, {
end,
})
-- .code-snippets 文件强制识别为 JSON方便编辑否则无法语法高亮
G.au({ "VimEnter", "BufEnter" }, {
pattern = { "*.code-snippets" },
callback = function()
@ -64,6 +57,7 @@ G.au({ "VimEnter", "BufEnter" }, {
})
-- 自动检测 Conda Python 环境,优先用 conda 里的 python
local function isempty(s)
return s == nil or s == ""
end

View File

@ -1,9 +1,13 @@
return {
require('plugs.nvim-lspconfig'),
require('plugs.nvimtree'), -- nvimtree
require('plugs.theme'), -- theme
require("plugs.edit-plugs"),
require("plugs.dev"),
require('plugs.mason'),
require('plugs.symbols-outline'),
require('plugs.nvim-cmp'),
require('plugs.treesitter'),
require('plugs.winbar'),
require('plugs.nvimtree'),
require('plugs.theme'),
require('plugs.edit-plugs'),
require('plugs.dev'),
require('plugs.ai'),
}

27
lua/plugs/ai.lua Normal file
View File

@ -0,0 +1,27 @@
-- 这里用来coplit AI的配置
return {
{
-- Copilot 懒加载:只在插入模式需要(和 nvim-cmp 共用 Tab 键cmp 改用 C-n/C-p 避让)
'github/copilot.vim', -- github copilot
event = "InsertEnter",
},
{
-- lazy.nvim
'newbieQQ/slot.nvim',
url = 'https://github.com/newbieQQ/slot.nvim',
config = function()
require('slot').setup({
commands = {
reasonix = 'reasonix -c || reasonix',
lazygit = 'lazygit',
},
keymaps = {
shell = { 'n', '<c-t>' },
shell_i = { 'i', '<c-t>' },
reasonix = { 'n', '<C-i>' },
lazygit = { 'n', '<leader>gg' },
},
})
end,
}
}

View File

@ -9,7 +9,7 @@ return {
-- end
-- },
{
-- go开发
-- go 开发:只对 go/gomod 文件加载build 时检测是否装了 Go无 Go 环境静默跳过)
"ray-x/go.nvim",
dependencies = {
"ray-x/guihua.lua",
@ -17,7 +17,11 @@ return {
"nvim-treesitter/nvim-treesitter",
},
ft = { "go", 'gomod' },
build = ':lua require("go.install").update_all_sync()',
build = function()
if vim.fn.executable('go') == 1 then
require("go.install").update_all_sync()
end
end,
config = function()
require("go").setup()
end,
@ -28,22 +32,18 @@ return {
dependencies = { "nvim-lua/plenary.nvim" },
},
{
-- 终端
-- toggleterm被 addons/QQdock 使用的底层终端
'akinsho/toggleterm.nvim',
version = "*",
config = function()
require("toggleterm").setup {
-- size can be a number or function which is passed the current terminal
size = 10,
open_mapping = [[<c-t>]],
hide_numbers = true, -- hide the number column in toggleterm buffers
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = 1, -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
shading_factor = 1,
start_in_insert = true,
insert_mappings = true, -- whether or not the open mapping applies in insert mode
persist_size = true,
direction = 'horizontal',
}
end
}

View File

@ -1,5 +1,4 @@
return {
'vijaymarupudi/nvim-fzf', -- fzf
{
-- surround 和 wildfire 配合有神奇的效果
'tpope/vim-surround',
@ -13,7 +12,6 @@ return {
{
'terryma/vim-multiple-cursors',
},
{
--格式整理
{
'junegunn/vim-easy-align',
@ -24,20 +22,13 @@ return {
})
end
},
},
{
-- 注释插件
{
'tpope/vim-commentary',
}
},
{
'github/copilot.vim', -- github copilot
},
-- 注释插件Neovim 0.12 内置 treesitter gc/gcc 注释切换,暂注释掉此插件测试
-- {
-- 'tpope/vim-commentary',
-- },
{
'windwp/nvim-autopairs',
event = "InsertEnter",
opts = {}, -- this is equalent to setup({}) function
config = function()
require('nvim-autopairs').setup({
disable_filetype = { "vim" },
@ -62,14 +53,14 @@ return {
end
},
{
-- hop
-- hop 快速跳转:用 f/F/t/T 做行内单字符跳转,<c-f> 做双字符跳转
-- 注意:这会覆盖 Vim 原生的 f/F/t/T
"phaazon/hop.nvim",
branch = "v2",
keys = {
"f", "F", "t", "T",
"<c-f>"
},
lazy = true,
config = function()
require("hop").setup { keys = 'asdfghjkl;' }
local hop = require('hop')

29
lua/plugs/mason.lua Normal file
View File

@ -0,0 +1,29 @@
return {
{
-- lsp 下载器
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
},
config = function()
require "mason".setup {
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
}
}
require("mason-lspconfig").setup({
ensure_installed = {
"bashls",
-- "basedpyright", -- Python LSP 需手动装(有的机器不用 Python
"lua_ls",
"jsonls",
"yamlls",
}
})
end
},
}

152
lua/plugs/nvim-cmp.lua Normal file
View File

@ -0,0 +1,152 @@
return {
{
-- lsp补全
"hrsh7th/nvim-cmp",
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
{
'hrsh7th/vim-vsnip',
config = function()
G.g.vsnip_snippet_dir = G.fn.stdpath("config") .. "/snippets"
end
},
'hrsh7th/cmp-vsnip',
'onsails/lspkind-nvim',
},
config = function()
local has_words_before = function()
local cursor = G.api.nvim_win_get_cursor(0)
local line, col = cursor[1], cursor[2]
return col ~= 0 and G.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local cmp = require('cmp')
local cmp_opt = {
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
-- 补全来源优先级LSP > 片段 > buffer > 路径
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
},
{ name = 'buffer' },
{ name = 'path' }
),
-- 插入模式映射C-n/C-p 选择CR 未选时换行(避免冲突 Copilot 的 Tab
mapping = cmp.mapping.preset.insert({
-- 回车:手动选择后确认,未选时 fallback 到换行
["<CR>"] = cmp.mapping({
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }),
c = function(fallback)
if cmp.visible() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
}),
-- C-n选下一个补全项 / 展开 vsnip 占位 / 手动触发补全
["<C-n>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<C-p>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
}),
window = {
completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = -3,
side_padding = 0,
border = "rounded",
scrollbar = false,
},
documentation = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
border = "rounded",
scrollbar = false,
},
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50, })(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. (strings[1] or "") .. " "
kind.menu = " (" .. (strings[2] or "") .. ")"
return kind
end,
},
}
require('cmp').setup(cmp_opt)
-- 命令栏补全Tab 导航,回车时若有手动选择则确认,否则直接执行命令(不卡住)
require('cmp').setup.cmdline(':', {
mapping = {
['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'c' }),
['<S-Tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'c' }),
['<CR>'] = cmp.mapping({
c = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ select = false })
else
fallback() -- 没选的时候 fallback = 直接执行命令
end
end,
}),
},
sources = {
{ name = 'cmdline' },
{ name = 'path' },
}
})
-- 搜索栏补全
require('cmp').setup.cmdline('/', {
mapping = {
['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'c' }),
['<S-Tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'c' }),
['<CR>'] = cmp.mapping({
c = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ select = false })
else
fallback()
end
end,
}),
},
sources = {
{ name = 'buffer' },
}
})
end,
},
}

View File

@ -9,7 +9,6 @@ return {
config = function()
require 'neodev'.setup {}
-- 定义需要启用的服务器列表及其对应的配置
local servers = {
lua_ls = require('lsp.lua'),
clangd = require('lsp.c'),
@ -20,332 +19,23 @@ return {
jsonls = require('lsp.json'),
}
-- 使用 Neovim 0.11+ 的新 API 进行配置和启用
-- capabilities 在此处统一注入,各 lsp/*.lua 不单独 require cmp_nvim_lsp
-- 避免模块层面 require 带来的隐式依赖
local capabilities = require('cmp_nvim_lsp').default_capabilities()
for server, config in pairs(servers) do
config.capabilities = capabilities
vim.lsp.config(server, config)
vim.lsp.enable(server)
end
-- require 'lspconfig'.lua_ls.setup(require('lsp.lua'))
-- require 'lspconfig'.clangd.setup(require('lsp.c'))
-- require 'lspconfig'.bashls.setup(require('lsp.bash'))
-- require 'lspconfig'.basedpyright.setup(require('lsp.basedpyright'))
-- require 'lspconfig'.yamlls.setup(require('lsp.yaml'))
-- require 'lspconfig'.gopls.setup(require('lsp.go'))
-- require 'lspconfig'.jsonls.setup(require('lsp.json'))
G.map({
{ 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>' },
{ 'n', '<cs-r>', '<cmd>lua vim.lsp.buf.rename()<CR>' },
{ 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>' },
{ 'n', 'gh', '<cmd>lua vim.lsp.buf.hover()<CR>' },
{ 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>' },
{ 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>' },
{ 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>' },
{ 'n', '<cs-i>', '<cmd>lua vim.lsp.buf.format()<CR>' },
})
end
},
{
-- lsp
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim", -- lsp 下载器
},
config = function()
require "mason".setup {
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
}
}
require("mason-lspconfig").setup({
ensure_installed = {
"bashls",
-- "basedpyright",
"lua_ls",
"jsonls",
"yamlls",
}
})
end
},
{ --
'simrat39/symbols-outline.nvim',
config = function()
local opts = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = false,
position = 'right',
relative_width = true,
width = 25,
auto_close = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = 'Pmenu',
autofold_depth = nil,
auto_unfold_hover = true,
fold_markers = { '', '' },
wrap = false,
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = { "<Esc>", "q" },
goto_location = "<Cr>",
focus_location = "h",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
fold = "o",
unfold = "l",
fold_all = "W",
unfold_all = "E",
fold_reset = "R",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = { icon = "", hl = "@text.uri" },
Module = { icon = "", hl = "@namespace" },
Namespace = { icon = "", hl = "@namespace" },
Package = { icon = "", hl = "@namespace" },
Class = { icon = "𝓒", hl = "@type" },
Method = { icon = "ƒ", hl = "@method" },
Property = { icon = "", hl = "@method" },
Field = { icon = "", hl = "@field" },
Constructor = { icon = "", hl = "@constructor" },
Enum = { icon = "", hl = "@type" },
Interface = { icon = "", hl = "@type" },
Function = { icon = "", hl = "@function" },
Variable = { icon = "", hl = "@constant" },
Constant = { icon = "", hl = "@constant" },
String = { icon = "𝓐", hl = "@string" },
Number = { icon = "#", hl = "@number" },
Boolean = { icon = "", hl = "@boolean" },
Array = { icon = "", hl = "@constant" },
Object = { icon = "⦿", hl = "@type" },
Key = { icon = "🔐", hl = "@type" },
Null = { icon = "NULL", hl = "@type" },
EnumMember = { icon = "", hl = "@field" },
Struct = { icon = "𝓢", hl = "@type" },
Event = { icon = "🗲", hl = "@type" },
Operator = { icon = "+", hl = "@operator" },
TypeParameter = { icon = "𝙏", hl = "@parameter" },
Component = { icon = "", hl = "@function" },
Fragment = { icon = "", hl = "@constant" },
},
}
require("symbols-outline").setup(opts)
G.map({
{ "n", "<cs-o>", "<cmd>SymbolsOutline<cr>", { noremap = true } },
})
end
},
{
-- lsp补全
{
"hrsh7th/nvim-cmp",
dependencies = {
'hrsh7th/cmp-nvim-lsp', -- { name = 'nvim_lua' }
'hrsh7th/cmp-buffer', -- { name = 'buffer' },
'hrsh7th/cmp-path', -- { name = 'path' }
'hrsh7th/cmp-cmdline', -- { name = 'cmdline' }
{
'hrsh7th/vim-vsnip',
config = function()
G.g.vsnip_snippet_dir = G.fn.stdpath("config") .. "/snippets"
end
},
'hrsh7th/cmp-vsnip',
'onsails/lspkind-nvim',
},
config = function()
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(G.api.nvim_win_get_cursor(0))
return col ~= 0 and G.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local cmp = require('cmp')
local cmp_opt = {
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
},
{ name = 'buffer' },
{ name = 'path' }
),
mapping = cmp.mapping.preset.insert({
["<CR>"] = cmp.mapping({
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
c = function(fallback)
if cmp.visible() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })
else
fallback()
end
end,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
}),
window = {
completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = -3,
side_padding = 0,
border = "rounded",
scrollbar = false,
},
documentation = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
border = "rounded",
scrollbar = false,
},
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50, })(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. (strings[1] or "") .. " "
kind.menu = " (" .. (strings[2] or "") .. ")"
return kind
end,
},
}
require('cmp').setup(cmp_opt)
end,
},
{
-- 语法高亮 --
'nvim-treesitter/nvim-treesitter',
config = function()
local treesitter_opt = {
ensure_installed = {
-- "c",
-- "cpp",
-- "python",
-- "java",
-- "lua",
-- "bash",
-- "vimdoc",
},
indent = { enable = true },
ignore_install = {
"txt"
},
sync_install = false,
auto_install = true,
highlight = {
enable = true,
disable = function(_, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(G.loop.fs_stat, G.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
additional_vim_regex_highlighting = false,
},
parsers = {
vue = {
install_info = {
url = "https://github.com/ikatyang/tree-sitter-vue",
files = { "src/parser.c" },
branch = "main",
},
},
},
}
require 'nvim-treesitter'.setup(treesitter_opt)
require 'nvim-treesitter.install'.prefer_git = true
if G.use_ssh then
local parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
for _, p in pairs(parsers) do
p.install_info.url = p.install_info.url:gsub("https://github.com/", "git@github.com:")
end
end
end
},
},
{
'fgheng/winbar.nvim',
config = function()
require('winbar').setup({
enabled = true, -- 是否启动winbar
-- show_file_path = true, -- 是否显示文件路径
show_symbols = true, -- 是否显示函数标签
-- 颜色配置,为空,将使用默认配色
colors = {
path = '#aaffff', -- 路径的颜色,比如#ababab
file_name = '#bbbbff', -- 文件名称的颜色,比如#acacac
symbols = '#aaffaa', -- 函数颜色
},
-- 图标配置
icons = {
seperator = '>', -- 路径分割符号
editor_state = '',
lock_icon = '',
},
-- 关闭winbar的窗口
exclude_filetype = {
'help',
'startify',
'dashboard',
'packer',
'neogitstatus',
'NvimTree',
'Trouble',
'alpha',
'lir',
'Outline',
'spectre_panel',
'toggleterm',
'qf',
}
})
end
},

View File

@ -1,10 +1,10 @@
return {
"nvim-tree/nvim-tree.lua",
dependencies = {
'kyazdani42/nvim-web-devicons'
'nvim-tree/nvim-web-devicons'
},
keys = {
"<c-e>"
{ "<c-e>", "<cmd>NvimTreeToggle<CR>", desc = "Toggle file tree" }
},
config = function()
require 'nvim-web-devicons'.setup {}
@ -33,8 +33,5 @@ return {
})
end
}
G.map({
{ "n", "<C-e>", ":NvimTreeToggle<CR>", { noremap = true } },
})
end
}

View File

@ -0,0 +1,74 @@
return {
{ --
'simrat39/symbols-outline.nvim',
config = function()
local opts = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = false,
position = 'right',
relative_width = true,
width = 25,
auto_close = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = 'Pmenu',
autofold_depth = nil,
auto_unfold_hover = true,
fold_markers = { '', '' },
wrap = false,
keymaps = {
close = { "<Esc>", "q" },
goto_location = "<CR>",
focus_location = "h",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
fold = "o",
unfold = "l",
fold_all = "W",
unfold_all = "E",
fold_reset = "R",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = { icon = "", hl = "@text.uri" },
Module = { icon = "", hl = "@namespace" },
Namespace = { icon = "", hl = "@namespace" },
Package = { icon = "", hl = "@namespace" },
Class = { icon = "𝓒", hl = "@type" },
Method = { icon = "ƒ", hl = "@method" },
Property = { icon = "", hl = "@method" },
Field = { icon = "", hl = "@field" },
Constructor = { icon = "", hl = "@constructor" },
Enum = { icon = "", hl = "@type" },
Interface = { icon = "", hl = "@type" },
Function = { icon = "", hl = "@function" },
Variable = { icon = "", hl = "@constant" },
Constant = { icon = "", hl = "@constant" },
String = { icon = "𝓐", hl = "@string" },
Number = { icon = "#", hl = "@number" },
Boolean = { icon = "", hl = "@boolean" },
Array = { icon = "", hl = "@constant" },
Object = { icon = "⦿", hl = "@type" },
Key = { icon = "🔐", hl = "@type" },
Null = { icon = "NULL", hl = "@type" },
EnumMember = { icon = "", hl = "@field" },
Struct = { icon = "𝓢", hl = "@type" },
Event = { icon = "🗲", hl = "@type" },
Operator = { icon = "+", hl = "@operator" },
TypeParameter = { icon = "𝙏", hl = "@parameter" },
Component = { icon = "", hl = "@function" },
Fragment = { icon = "", hl = "@constant" },
},
}
require("symbols-outline").setup(opts)
G.map({
{ "n", "<cs-o>", "<cmd>SymbolsOutline<cr>", { noremap = true } },
})
end
},
}

View File

@ -1,4 +1,41 @@
return {
{
-- git 修改标记sign column 增删改色块)
'lewis6991/gitsigns.nvim',
event = "BufReadPre",
config = function()
require('gitsigns').setup({
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '' },
topdelete = { text = '' },
changedelete = { text = '' },
untracked = { text = '' },
},
signcolumn = true,
numhl = true,
linehl = false,
word_diff = false,
watch_gitdir = {
interval = 1000,
follow_files = true,
},
current_line_blame = false,
-- on_attach = function(bufnr)
-- local gs = package.loaded.gitsigns
-- G.map({
-- { 'n', ']c', gs.next_hunk, { buffer = bufnr } },
-- { 'n', '[c', gs.prev_hunk, { buffer = bufnr } },
-- { 'n', '<leader>hs', gs.stage_hunk, { buffer = bufnr } },
-- { 'n', '<leader>hr', gs.reset_hunk, { buffer = bufnr } },
-- { 'n', '<leader>hp', gs.preview_hunk, { buffer = bufnr } },
-- { 'n', '<leader>hb', gs.blame_line, { buffer = bufnr } },
-- })
-- end,
})
end,
},
{
'folke/tokyonight.nvim',
config = function()
@ -7,8 +44,7 @@ return {
end
},
{
-- line插件
'kdheepak/tabline.nvim',
-- 状态栏
'nvim-lualine/lualine.nvim',
config = function()
require('lualine').setup {
@ -17,17 +53,13 @@ return {
theme = 'auto',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
statusline = 2000,
tabline = 2000,
winbar = 2000,
}
},
sections = {
@ -50,27 +82,26 @@ return {
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
end,
},
{
-- 标签栏
'kdheepak/tabline.nvim',
config = function()
require('tabline').setup {
-- Defaults configuration options
enable = true,
options = {
-- If lualine is installed tabline will use separators configured in lualine by default.
-- These options can be used to override those settings.
section_separators = { ' ', ' ' },
component_separators = { '', '' },
max_bufferline_percent = 66, -- set to nil by default, and it uses vim.o.columns * 2/3
show_tabs_always = false, -- this shows tabs only when there are more than one tab or if the first tab is named
show_devicons = true, -- this shows devicons in buffer section
show_bufnr = false, -- this appends [bufnr] to buffer section,
show_filename_only = true, -- shows base filename only instead of relative path in filename
modified_icon = "+ ", -- change the default modified icon
modified_italic = false, -- set to true by default; this determines whether the filename turns italic if modified
show_tabs_only = false, -- this shows only tabs instead of tabs + buffers
max_bufferline_percent = 66,
show_tabs_always = false,
show_devicons = true,
show_bufnr = false,
show_filename_only = true,
modified_icon = "+ ",
modified_italic = false,
show_tabs_only = false,
},
}
G.cmd [[

46
lua/plugs/treesitter.lua Normal file
View File

@ -0,0 +1,46 @@
return {
{
-- 语法高亮auto_install=true 自动装 parserignore_install 跳过 txt
'nvim-treesitter/nvim-treesitter',
config = function()
local treesitter_opt = {
indent = { enable = true },
ignore_install = {
"txt"
},
sync_install = false,
auto_install = true,
highlight = {
enable = true,
-- 大于 100KB 的文件关闭 treesitter 高亮(性能优化)
disable = function(_, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(G.loop.fs_stat, G.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
additional_vim_regex_highlighting = false,
},
-- 自定义 Vue parser上游 tree-sitter-html 不识别 .vue 单文件组件
parsers = {
vue = {
install_info = {
url = "https://github.com/ikatyang/tree-sitter-vue",
files = { "src/parser.c" },
branch = "main",
},
},
},
}
require 'nvim-treesitter'.setup(treesitter_opt)
require 'nvim-treesitter.install'.prefer_git = true
if G.use_ssh then
local parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
for _, p in pairs(parsers) do
p.install_info.url = p.install_info.url:gsub("https://github.com/", "git@github.com:")
end
end
end
},
}

40
lua/plugs/winbar.lua Normal file
View File

@ -0,0 +1,40 @@
return {
{
'fgheng/winbar.nvim',
config = function()
require('winbar').setup({
enabled = true,
show_symbols = true,
colors = {
path = '#aaffff',
file_name = '#bbbbff',
symbols = '#aaffaa',
},
icons = {
separator = '>',
editor_state = '',
lock_icon = '',
},
exclude_filetype = {
'help',
'startify',
'dashboard',
'packer',
'neogitstatus',
'NvimTree',
'Trouble',
'alpha',
'lir',
'Outline',
'spectre_panel',
'toggleterm',
'qf',
}
})
end
},
}

View File

@ -1,3 +1,91 @@
{
"plug": {
"prefix": "plug",
"body": [
"{",
" '${1:owner/repo}',",
" config = function()",
" require('${2}').setup({$3})",
" end,",
"},"
]
},
"plugkey": {
"prefix": "plugkey",
"body": [
"{",
" '${1:owner/repo}',",
" keys = { '${2}' },",
" config = function()",
" require('${3}').setup({$4})",
" end,",
"},"
]
},
"plugftp": {
"prefix": "plugftp",
"body": [
"{",
" '${1:owner/repo}',",
" ft = { '${2}' },",
" config = function()",
" require('${3}').setup({$4})",
" end,",
"},"
]
},
"map": {
"prefix": "map",
"body": "{ '${1:n}', '${2:<leader>}', '${3:cmd}', { noremap = true } },"
},
"mapl": {
"prefix": "mapl",
"body": [
"{ '${1:n}', '${2:<leader>}',",
" function()",
" ${3}",
" end,",
" { noremap = true }",
"},"
]
},
"func": {
"prefix": "func",
"body": [
"function ${1:name}(${2:args})",
" ${3}",
"end"
]
},
"localf": {
"prefix": "localf",
"body": [
"local ${1:name} = function(${2:args})",
" ${3}",
"end"
]
},
"Gmap": {
"prefix": "Gmap",
"body": [
"G.map({",
" { '${1:n}', '${2:<leader>}', '${3:cmd}', { noremap = true } },",
"})"
]
},
"req": {
"prefix": "req",
"body": "local ${1:name} = require('${1}')"
},
"au": {
"prefix": "au",
"body": [
"G.au({ '${1:BufEnter}' }, {",
" pattern = { '${2:*}' },",
" callback = function()",
" ${3}",
" end,",
"})"
]
}
}