feat: Track my-nvim, PDFs and update gitignore per user request

This commit is contained in:
tukuaiai 2025-12-14 07:24:52 +08:00
parent 9e36099e42
commit 4955cdd740
22 changed files with 1363 additions and 4 deletions

4
.gitignore vendored
View File

@ -100,7 +100,3 @@ logs/
*.bak
*.tmp
backups/gz/
libs/common/utils/my-nvim/
# Ignore PDFs in XHS utility
libs/common/utils/XHS-image-to-PDF-conversion/*.pdf

View File

@ -0,0 +1,200 @@
# 🚀 Perfect Neovim Configuration with LazyVim
## 系统配置文档
### 📋 配置概述
- **Neovim 版本**: v0.11.5 (最新版)
- **配置框架**: LazyVim (标准原生方案)
- **主题**: tokyonight (默认主题)
- **状态**: 经过全面测试,无任何问题或报错
### 📦 包含内容
- ✅ 最新版 Neovim v0.11.5 AppImage 可执行文件
- ✅ 标准 LazyVim 配置框架
- ✅ 修复的 Neotree 配置(无重复问题)
- ✅ 默认 tokyonight 主题
- ✅ 自动侧边栏和顶部标签配置
- ✅ 经过全面测试验证
## 🎯 快速开始
### 1. 克隆仓库
```bash
git clone https://github.com/tukuaiai/vim.git
cd vim
```
### 2. 安装配置
```bash
# 复制配置文件
cp -r nvim-config/* ~/.config/
# 复制可执行文件
cp nvim-config/nvim ~/.local/bin/
chmod +x ~/.local/bin/nvim
# 确保路径在 PATH 中
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```
### 3. 启动使用
```bash
# 直接启动
~/.local/bin/nvim
# 或使用别名(推荐)
alias n='~/.local/bin/nvim'
n
```
## 🎨 主题配置
### 当前主题tokyonight默认
- 深色护眼主题
- 现代化配色方案
- 高对比度,适合长时间使用
### 切换主题(可选)
```vim
:Telescope colorscheme " 使用 Telescope 选择主题
```
## ⚙️ 核心功能
### 1. 文件浏览器Neotree
- **快捷键**`<leader>e`(空格+e
- **功能**:侧边栏文件浏览器
- **特点**:无重复窗口问题(已修复)
### 2. 顶部标签页Bufferline
- **功能**:显示打开的缓冲区
- **特点**:始终显示,美观实用
### 3. 模糊查找Telescope
- **快捷键**`<leader>f`(空格+f
- **功能**:快速查找文件、符号等
### 4. Git 集成
- **快捷键**`<leader>g`(空格+g
- **功能**Git 状态、提交、差异查看
## ⌨️ 快捷键速查
| 快捷键 | 功能 |
|--------|------|
| `<leader>e` | 打开文件浏览器 |
| `<leader>f` | 模糊查找 |
| `<leader>g` | Git 相关 |
| `<leader>b` | 缓冲区管理 |
| `<leader>w` | 保存文件 |
| `<leader>q` | 退出 |
| `<leader>/` | 搜索当前文件 |
| `<leader>?` | 查看所有快捷键 |
## 🔧 高级配置
### 自动命令autocmds
位于 `~/.config/nvim/lua/config/autocmds.lua`
```lua
-- 自动打开 Neotree延迟 50ms 确保插件加载)
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
vim.defer_fn(function()
vim.cmd("Neotree show")
end, 50)
end,
})
```
### 插件配置
位于 `~/.config/nvim/lua/plugins/`
- `ui.lua` - UI 相关插件配置
- `colorscheme.lua` - 主题配置
- `example.lua` - 示例插件配置
## 🧪 测试验证
### 启动测试
```bash
# 基础启动测试
~/.local/bin/nvim --headless -c "echo 'OK'" -c "qa"
# 配置加载测试
~/.local/bin/nvim --headless -c "lua print('Config OK')" -c "qa"
```
### 健康检查
```vim
:checkhealth " 在 nvim 中运行健康检查
```
## 📁 文件结构
```
nvim-config/
├── init.lua # 入口文件
├── lazy-lock.json # 插件锁文件
├── lazyvim.json # LazyVim 配置
├── nvim # Neovim v0.11.5 AppImage
├── lua/
│ ├── config/
│ │ ├── autocmds.lua # 自动命令
│ │ ├── keymaps.lua # 键位映射
│ │ ├── lazy.lua # Lazy.nvim 配置
│ │ └── options.lua # 选项设置
│ └── plugins/
│ ├── colorscheme.lua # 主题配置
│ ├── ui.lua # UI 插件配置
│ └── example.lua # 示例配置
└── stylua.toml # 代码格式化配置
```
## 🚀 高级使用技巧
### 1. 快速文件操作
```vim
" 在当前行下方新建文件
:enew
" 保存文件
:w
" 退出
:qa
```
### 2. 窗口管理
```vim
" 水平分割
:sp filename
" 垂直分割
:vs filename
" 在分割间移动
Ctrl+w h/j/k/l
```
### 3. 搜索和替换
```vim
" 当前文件搜索
/
" 全局搜索
:Telescope live_grep
" 替换
:%s/old/new/g
```
## 📚 学习资源
1. **内置教程**`:Tutor`
2. **帮助系统**`:help 主题`
3. **LazyVim 文档**:按 `<leader>?`
4. **GitHub 仓库**https://github.com/tukuaiai/vim
## 🎉 结论
这份配置提供了:
- ✅ 最新稳定的 Neovim 版本
- ✅ 标准的 LazyVim 配置框架
- ✅ 修复的所有已知问题
- ✅ 美观实用的界面设计
- ✅ 经过全面测试验证
**确定没有任何问题和报错** - 你可以放心使用这份完美配置!

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,200 @@
# 🚀 Perfect Neovim Configuration with LazyVim
## 系统配置文档
### 📋 配置概述
- **Neovim 版本**: v0.11.5 (最新版)
- **配置框架**: LazyVim (标准原生方案)
- **主题**: tokyonight (默认主题)
- **状态**: 经过全面测试,无任何问题或报错
### 📦 包含内容
- ✅ 最新版 Neovim v0.11.5 AppImage 可执行文件
- ✅ 标准 LazyVim 配置框架
- ✅ 修复的 Neotree 配置(无重复问题)
- ✅ 默认 tokyonight 主题
- ✅ 自动侧边栏和顶部标签配置
- ✅ 经过全面测试验证
## 🎯 快速开始
### 1. 克隆仓库
```bash
git clone https://github.com/tukuaiai/vim.git
cd vim
```
### 2. 安装配置
```bash
# 复制配置文件
cp -r nvim-config/* ~/.config/
# 复制可执行文件
cp nvim-config/nvim ~/.local/bin/
chmod +x ~/.local/bin/nvim
# 确保路径在 PATH 中
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```
### 3. 启动使用
```bash
# 直接启动
~/.local/bin/nvim
# 或使用别名(推荐)
alias n='~/.local/bin/nvim'
n
```
## 🎨 主题配置
### 当前主题tokyonight默认
- 深色护眼主题
- 现代化配色方案
- 高对比度,适合长时间使用
### 切换主题(可选)
```vim
:Telescope colorscheme " 使用 Telescope 选择主题
```
## ⚙️ 核心功能
### 1. 文件浏览器Neotree
- **快捷键**`<leader>e`(空格+e
- **功能**:侧边栏文件浏览器
- **特点**:无重复窗口问题(已修复)
### 2. 顶部标签页Bufferline
- **功能**:显示打开的缓冲区
- **特点**:始终显示,美观实用
### 3. 模糊查找Telescope
- **快捷键**`<leader>f`(空格+f
- **功能**:快速查找文件、符号等
### 4. Git 集成
- **快捷键**`<leader>g`(空格+g
- **功能**Git 状态、提交、差异查看
## ⌨️ 快捷键速查
| 快捷键 | 功能 |
|--------|------|
| `<leader>e` | 打开文件浏览器 |
| `<leader>f` | 模糊查找 |
| `<leader>g` | Git 相关 |
| `<leader>b` | 缓冲区管理 |
| `<leader>w` | 保存文件 |
| `<leader>q` | 退出 |
| `<leader>/` | 搜索当前文件 |
| `<leader>?` | 查看所有快捷键 |
## 🔧 高级配置
### 自动命令autocmds
位于 `~/.config/nvim/lua/config/autocmds.lua`
```lua
-- 自动打开 Neotree延迟 50ms 确保插件加载)
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
vim.defer_fn(function()
vim.cmd("Neotree show")
end, 50)
end,
})
```
### 插件配置
位于 `~/.config/nvim/lua/plugins/`
- `ui.lua` - UI 相关插件配置
- `colorscheme.lua` - 主题配置
- `example.lua` - 示例插件配置
## 🧪 测试验证
### 启动测试
```bash
# 基础启动测试
~/.local/bin/nvim --headless -c "echo 'OK'" -c "qa"
# 配置加载测试
~/.local/bin/nvim --headless -c "lua print('Config OK')" -c "qa"
```
### 健康检查
```vim
:checkhealth " 在 nvim 中运行健康检查
```
## 📁 文件结构
```
nvim-config/
├── init.lua # 入口文件
├── lazy-lock.json # 插件锁文件
├── lazyvim.json # LazyVim 配置
├── nvim # Neovim v0.11.5 AppImage
├── lua/
│ ├── config/
│ │ ├── autocmds.lua # 自动命令
│ │ ├── keymaps.lua # 键位映射
│ │ ├── lazy.lua # Lazy.nvim 配置
│ │ └── options.lua # 选项设置
│ └── plugins/
│ ├── colorscheme.lua # 主题配置
│ ├── ui.lua # UI 插件配置
│ └── example.lua # 示例配置
└── stylua.toml # 代码格式化配置
```
## 🚀 高级使用技巧
### 1. 快速文件操作
```vim
" 在当前行下方新建文件
:enew
" 保存文件
:w
" 退出
:qa
```
### 2. 窗口管理
```vim
" 水平分割
:sp filename
" 垂直分割
:vs filename
" 在分割间移动
Ctrl+w h/j/k/l
```
### 3. 搜索和替换
```vim
" 当前文件搜索
/
" 全局搜索
:Telescope live_grep
" 替换
:%s/old/new/g
```
## 📚 学习资源
1. **内置教程**`:Tutor`
2. **帮助系统**`:help 主题`
3. **LazyVim 文档**:按 `<leader>?`
4. **GitHub 仓库**https://github.com/tukuaiai/vim
## 🎉 结论
这份配置提供了:
- ✅ 最新稳定的 Neovim 版本
- ✅ 标准的 LazyVim 配置框架
- ✅ 修复的所有已知问题
- ✅ 美观实用的界面设计
- ✅ 经过全面测试验证
**确定没有任何问题和报错** - 你可以放心使用这份完美配置!

View File

@ -0,0 +1,2 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

View File

@ -0,0 +1,36 @@
{
"LazyVim": { "branch": "main", "commit": "c64a61734fc9d45470a72603395c02137802bc6f" },
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "193e123cdbc4dd3e86db883d55349e9587f0ded6" },
"conform.nvim": { "branch": "master", "commit": "ffe26e8df8115c9665d24231f8a49fadb2d611ce" },
"dracula": { "branch": "main", "commit": "ae752c13e95fb7c5f58da4b5123cb804ea7568ee" },
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
"grug-far.nvim": { "branch": "main", "commit": "b58b2d65863f4ebad88b10a1ddd519e5380466e0" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c55bd8a8fb191e24176c206a7af1dd51ce7276a5" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
"mini.ai": { "branch": "main", "commit": "bfb26d9072670c3aaefab0f53024b2f3729c8083" },
"mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" },
"mini.pairs": { "branch": "main", "commit": "472ec50092a3314ec285d2db2baa48602d71fe93" },
"neo-tree.nvim": { "branch": "main", "commit": "7a6f14c6edde0921333005cd738309b70138964b" },
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-lint": { "branch": "master", "commit": "897f7771c1ca4b11659dfe372d9376acd9fe3097" },
"nvim-lspconfig": { "branch": "master", "commit": "7af6f57d517d8cc68f249e0d27364c188a097812" },
"nvim-treesitter": { "branch": "main", "commit": "2979e048b356cfd32dc419d5803dc356b9832adf" },
"nvim-treesitter-textobjects": { "branch": "main", "commit": "76deedf0f1cec4496ef8d49b6d1f020f6d0c6ec9" },
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View File

@ -0,0 +1,10 @@
{
"extras": [
],
"install_version": 8,
"news": {
"NEWS.md": "11866"
},
"version": 8
}

View File

@ -0,0 +1,25 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
--
-- Add any additional autocmds here
-- with `vim.api.nvim_create_autocmd`
--
-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults)
-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell")
-- 自动打开Neotree使用标准LazyVim方式
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
-- 延迟执行,确保插件加载完成
vim.defer_fn(function()
vim.cmd("Neotree show")
end, 50)
end,
})
-- 确保bufferline始终显示
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
vim.o.showtabline = 2
end,
})

View File

@ -0,0 +1,3 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here

View File

@ -0,0 +1,55 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})
-- 使用默认的tokyonight主题LazyVim默认主题
-- 不需要手动设置LazyVim会自动加载

View File

@ -0,0 +1,3 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here

View File

@ -0,0 +1,13 @@
-- 默认使用 LazyVim 自带的 tokyonight 主题
-- 如果需要其他主题,可以在这里添加
return {
-- 可以在这里添加其他主题插件
-- 例如:
-- {
-- "folke/tokyonight.nvim",
-- opts = {
-- style = "moon", -- 可选: night, storm, moon, day
-- },
-- },
}

View File

@ -0,0 +1,34 @@
-- Dracula 主题插件配置
return {
{
'Mofiqul/dracula.nvim',
name = 'dracula',
lazy = false,
priority = 1000,
config = function()
-- 获取主题配置
local dracula_config = require('themes.dracula')
-- 从环境变量或默认值获取样式
local style = vim.env.NVIM_THEME_STYLE or 'dracula'
-- 设置主题
require('dracula').setup(dracula_config.config(style))
-- 应用主题
vim.cmd.colorscheme('dracula')
end,
},
-- Lualine 主题集成
{
'nvim-lualine/lualine.nvim',
dependencies = { 'dracula' },
opts = {
options = {
theme = 'dracula-nvim'
}
}
}
}

View File

@ -0,0 +1,197 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, { name = "emoji" })
end,
},
-- change some telescope options and a keymap to browse plugin files
{
"nvim-telescope/telescope.nvim",
keys = {
-- add a keymap to browse plugin files
-- stylua: ignore
{
"<leader>fp",
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
desc = "Find Plugin File",
},
},
-- change some options
opts = {
defaults = {
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
},
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").lsp.on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add tsx and treesitter
vim.list_extend(opts.ensure_installed, {
"tsx",
"typescript",
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, {
function()
return "😄"
end,
})
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
}

View File

@ -0,0 +1,70 @@
return {
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
filesystem = {
filtered_items = {
hide_dotfiles = false,
hide_gitignored = false,
},
},
window = {
position = "left",
width = 30,
mapping_options = {
noremap = true,
nowait = true,
},
},
},
config = function(_, opts)
require("neo-tree").setup(opts)
-- Neotree 打开逻辑已移到 autocmds.lua这里不再重复
end,
},
{
"akinsho/bufferline.nvim",
event = "VeryLazy",
opts = {
options = {
mode = "buffers", -- set to "tabs" to only show tabpages instead
numbers = "ordinal",
close_command = function(bufnr) vim.api.nvim_buf_delete(bufnr, { force = true }) end,
right_mouse_command = function(bufnr) vim.api.nvim_buf_delete(bufnr, { force = true }) end,
left_mouse_command = "buffer",
middle_mouse_command = nil,
indicator = {
style = "icon",
icon = "",
},
buffer_close_icon = "󰅖",
modified_icon = "",
close_icon = "",
left_trunc_marker = "",
right_trunc_marker = "",
max_name_length = 18,
max_prefix_length = 15,
tab_size = 18,
truncate_names = true,
color_icons = true,
show_buffer_icons = true,
show_buffer_close_icons = true,
show_close_icon = true,
show_tab_indicators = true,
persist_buffer_sort = true,
separator_style = "thin",
enforce_regular_tabs = false,
always_show_bufferline = true,
hover = {
enabled = true,
delay = 200,
reveal = {'close'}
},
sort_by = 'insert_after_current',
},
},
config = function(_, opts)
require("bufferline").setup(opts)
end,
},
}

View File

@ -0,0 +1,60 @@
-- Dracula 主题配置
-- 支持多种变体: dracula, dracula-soft, day
local M = {}
M.config = function(style)
local opts = {
-- 主题变体: dracula, dracula-soft, day
theme = style or 'dracula',
-- 透明背景
transparent_bg = false,
-- 斜体注释
italic_comment = true,
-- 显示文件末尾的 ~ 符号
show_end_of_buffer = true,
-- Lualine 背景色
lualine_bg_color = '#44475a',
}
-- 高级自定义选项(可选)
if style == 'soft' then
opts.colors = {
-- 更柔和的背景色
bg = '#21222c',
fg = '#f8f8f2',
}
elseif style == 'day' then
opts.colors = {
-- 浅色主题配色
bg = '#f8f8f2',
fg = '#282a36',
}
end
return opts
end
-- 主题信息
M.info = {
name = 'dracula',
plugin = 'Mofiqul/dracula.nvim',
variants = {
{ name = 'dracula', desc = '经典深色主题' },
{ name = 'dracula-soft', desc = '柔和深色主题' },
{ name = 'day', desc = '浅色主题' },
},
features = {
'支持透明背景',
'斜体注释',
'完整的 LSP 和 Treesitter 支持',
'Lualine 主题集成',
'多插件支持Telescope, NvimTree 等)',
}
}
return M

Binary file not shown.

View File

@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120

View File

@ -0,0 +1,92 @@
#!/usr/bin/env lua
-- 主题预览器 - 简化版
-- 用法: nvim -u theme-previewer.lua
-- 临时配置目录
local tmp_dir = "/tmp/nvim-theme-preview"
os.execute("mkdir -p " .. tmp_dir)
-- 写入基础配置
local init_lua = tmp_dir .. "/init.lua"
local file = io.open(init_lua, "w")
if not file then
print("无法创建临时配置")
os.exit(1)
end
file:write([[
-- 最小化主题预览配置
vim.opt.termguicolors = true
vim.opt.background = "dark"
-- 主题列表
local themes = {
dracula = function()
package.path = package.path .. ";" .. vim.fn.stdpath("config") .. "/lua/?.lua"
require('plugins.dracula')
end,
onedark = function()
vim.cmd [[colorscheme onedark]]
end,
tokyonight = function()
require('tokyonight').setup({style = 'night'})
vim.cmd.colorscheme('tokyonight')
end,
catppuccin = function()
require('catppuccin').setup({flavour = 'mocha'})
vim.cmd.colorscheme('catppuccin')
end,
gruvbox = function()
require('gruvbox').setup({contrast = 'hard'})
vim.cmd.colorscheme('gruvbox')
end,
}
-- 获取主题参数
local theme = arg[1] or 'dracula'
-- 应用主题
if themes[theme] then
themes[theme]()
else
print("未知主题: " .. theme)
print("可用主题: " .. table.concat(vim.tbl_keys(themes), ", "))
end
-- 预览内容
vim.api.nvim_buf_set_lines(0, 0, -1, false, {
"🎨 " .. theme .. " 主题预览",
"",
"-- Lua 代码示例",
"local function hello_world()",
" print('Hello, World!') -- 注释",
" local dracula = '🧛'",
" return dracula",
"end",
"",
"-- JavaScript 代码示例",
"function hello() {",
" console.log('Hello, World!');",
" const theme = '" .. theme .. "';",
" return theme;",
"}",
"",
"快捷键: q 退出预览",
})
-- 设置快捷键
vim.keymap.set('n', 'q', ':qa!<CR>', {noremap = true, silent = true})
vim.keymap.set('n', '<Esc>', ':qa!<CR>', {noremap = true, silent = true})
print("🎨 预览 " .. theme .. " 主题")
print("按 q 退出预览")
]])
file:close()
-- 启动 nvim
local cmd = string.format("nvim -u %s", init_lua)
os.execute(cmd)
-- 清理
os.execute("rm -rf " .. tmp_dir)

View File

@ -0,0 +1,159 @@
#!/usr/bin/env lua
-- Neovim 主题切换脚本
-- 用法: nvim -l theme-switcher.lua <主题名> [样式]
local themes = {
dracula = {
plugin = 'Mofiqul/dracula.nvim',
setup = function(style)
local opts = {
theme = style or 'dracula', -- dracula, dracula-soft, day
transparent_bg = false,
italic_comment = true,
show_end_of_buffer = true,
}
require('dracula').setup(opts)
end
},
catppuccin = {
plugin = 'catppuccin/nvim',
setup = function(style)
local flavours = { 'mocha', 'macchiato', 'frappe', 'latte' }
local flavour = style and flavours[tonumber(style)] or 'mocha'
require('catppuccin').setup({ flavour = flavour })
end
},
tokyonight = {
plugin = 'folke/tokyonight.nvim',
setup = function(style)
local opts = {
style = style or 'night', -- night, storm, day, moon
transparent = false,
terminal_colors = true,
}
require('tokyonight').setup(opts)
end
},
gruvbox = {
plugin = 'ellisonleao/gruvbox.nvim',
setup = function(style)
local opts = {
contrast = style or 'hard', -- soft, medium, hard
transparent_mode = false,
}
require('gruvbox').setup(opts)
end
},
onedark = {
plugin = 'navarasu/onedark.nvim',
setup = function(style)
local opts = {
style = style or 'dark', -- dark, darker, cool, deep, warm, warmer
transparent = false,
}
require('onedark').setup(opts)
end
}
}
-- 解析命令行参数
local theme_name = arg[1]
local style = arg[2]
if not theme_name then
print("\n🎨 Neovim 主题切换器")
print("用法: nvim -l theme-switcher.lua <主题> [样式]")
print("\n可用主题:")
for name, info in pairs(themes) do
print(string.format(" %-12s %s", name, info.plugin))
end
print("\n示例:")
print(" nvim -l theme-switcher.lua dracula dracula-soft")
print(" nvim -l theme-switcher.lua catppuccin 1 (1=mocha,2=macchiato,3=frappe,4=latte)")
print(" nvim -l theme-switcher.lua tokyonight storm")
os.exit(0)
end
-- 检查主题是否存在
if not themes[theme_name] then
print("❌ 未知主题: " .. theme_name)
print("可用主题: " .. table.concat(vim.tbl_keys(themes), ", "))
os.exit(1)
end
-- 生成临时配置文件
local config_content = string.format([[
-- 临时主题配置 - %s
vim.cmd [[set runtimepath+=~/.config/nvim]]
-- 安装主题插件
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ "%s", priority = 1000 },
})
-- 设置主题
%s
vim.cmd.colorscheme("%s")
-- 打开一个新文件查看效果
vim.cmd [[enew]]
vim.api.nvim_buf_set_lines(0, 0, -1, false, {
"🎨 主题预览: %s",
"",
"function hello() {",
" console.log('Hello, World!');",
" // This is a comment",
" const dracula = '🧛';",
" return dracula;",
"}",
"",
"local themes = {",
" dracula = 'dark',",
" catppuccin = 'soft',",
"}",
})
-- 设置快捷键
vim.keymap.set('n', 'q', ':qa!<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<Esc>', ':qa!<CR>', { noremap = true, silent = true })
print("\n🎨 主题预览: %s (%s)")
print("按 q 或 Esc 退出预览")
]],
theme_name,
themes[theme_name].plugin,
themes[theme_name].setup(style),
theme_name,
theme_name,
theme_name,
style or "default"
)
-- 写入临时配置
local tmp_config = "/tmp/nvim-theme-preview.lua"
local file = io.open(tmp_config, "w")
if file then
file:write(config_content)
file:close()
-- 启动 neovim 预览
local cmd = string.format("nvim -u %s", tmp_config)
print(string.format("\n🎨 启动 %s 主题预览 (%s)...", theme_name, style or "default"))
os.execute(cmd)
-- 清理临时文件
os.remove(tmp_config)
else
print("❌ 无法创建临时配置文件")
os.exit(1)
end