{"id":16880098,"url":"https://github.com/huahuai23/nvim64","last_synced_at":"2025-03-22T07:32:14.838Z","repository":{"id":73764689,"uuid":"531915739","full_name":"HUAHUAI23/nvim64","owner":"HUAHUAI23","description":"我的neovim ide配置，portable neovim，neovim 配置，从 0到1配置指南，vim 配置","archived":false,"fork":false,"pushed_at":"2023-03-16T09:12:58.000Z","size":138473,"stargazers_count":85,"open_issues_count":2,"forks_count":13,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T09:37:19.430Z","etag":null,"topics":["language-server-protocol","lua","neovim","nvim","portable","vim","vimrc"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HUAHUAI23.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-02T12:25:33.000Z","updated_at":"2025-03-14T06:08:53.000Z","dependencies_parsed_at":"2023-09-21T07:32:06.235Z","dependency_job_id":null,"html_url":"https://github.com/HUAHUAI23/nvim64","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HUAHUAI23%2Fnvim64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HUAHUAI23%2Fnvim64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HUAHUAI23%2Fnvim64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HUAHUAI23%2Fnvim64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HUAHUAI23","download_url":"https://codeload.github.com/HUAHUAI23/nvim64/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244925175,"owners_count":20532873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["language-server-protocol","lua","neovim","nvim","portable","vim","vimrc"],"created_at":"2024-10-13T15:57:16.713Z","updated_at":"2025-03-22T07:32:14.829Z","avatar_url":"https://github.com/HUAHUAI23.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# neovim IDE基本使用说明\r\n\r\n---\r\n\r\n标准 `./config/nvim` 版本：\u003chttps://github.com/HUAHUAI23/myneovimlua\u003e  \r\n非 `lua` 版本: \u003chttps://github.com/HUAHUAI23/myneovim\u003e\r\n\r\n## 安装须知\r\n\r\n### 需要准备的东西\r\n\r\n- 请确保系统有`git`，`tar`，`curl`，`wget`，`unzip` （如果需要使用lazygit则请确保lazygit的安装） 和基本的编译环境例如 `gcc`和`libstdc++` 库（treesitter插件需要这些编译环境），ubuntu可以通过`sudo apt install git tar curl wget unzip build-essential` 安装上面所需软件。\r\n\r\n- 网络环境可以流畅的访问github\r\n\r\n- 如果已经有自己的nvim配置文件，务必确保自己的配置文件~/.config/nvim 不会干扰本nvim的配置文件，可以将自己的配置文件目录的名字进行修改，以免产生冲突\r\n\r\n### 如何安装\r\n\r\nnvim64.tar包的目录结构如下\r\n\r\n```plain\r\n├── initial.sh\r\n├── int42.sh\r\n├── nvim-linux64.tar\r\n├── open.sh\r\n├── runtime\r\n└── share\r\n```\r\n\r\nnvim-linux64.tar是neovim官方的portable版  \u003chttps://github.com/neovim/neovim/releases/download/v0.8.1/nvim-linux64.tar.gz\u003e\r\n\r\n将nvim64.tar包 \u003chttps://github.com/HUAHUAI23/nvim64/releases/download/v2.0/nvim64.tar\u003e 下载下来后执行如下命令\r\n\r\n```plain\r\ntar -xf nvim.tar\r\ncd nvim64\r\nbash initial.sh\r\nrm -rf trush\r\ncd nvim-linux64/bin/\r\n\r\n# 将为当前shell环境添加alias，即终端输入n就可以打开neovim，等效于nvim-linux64/bin/nvim\r\nsource int42.sh\r\n```\r\n\r\n或者下载打包好的版本 \u003chttps://github.com/HUAHUAI23/nvim64/releases/download/v2.0/nvim64.tar.gz\u003e，打包好的版本已经将插件和LSP相关的东西打包进去了，所以**不需要执行下面`:TSupdate` `:PackSync` `:MasonInstall` 等操作**，但是依然要保证系统有python venv和nodejs环境。\r\n\r\n```plain\r\n# 打包版本的使用\r\n\r\ntax -xf nvim64.packaged.tar.gz\r\ncd nvim64/nvim-linux64/bin\r\nsource int42\r\nn\r\n# 也可以直接 nvim64/nvim-linux64/bin/nvim\r\n\r\n```\r\n\r\nlite版本参考: \u003chttps://github.com/HUAHUAI23/nvim64lite\u003e\r\n\r\n第一次进入neovim后，neovim会自动下载插件,下载完插件后可以退出待第二次继续进入neovim，第二次进入neovim时请执行`:TSupdate` 更新treesitter和执行`:PackSync` 更新插件，为保证LSP正常工作，须执行`:Mason` 然后将这些全部安装`\"bash-language-server\", \"shfmt\", \"shellcheck\", \"stylua\", \"lua-language-server\", \"black\", \"pyright\", \"debugpy\", \"clang-format\", \"clangd\", \"cpptools\", \"node-debug2-adapter\", \"typescript-language-server\", \"quick-lint-js\", \"prettier\", \"sqls\", \"sql-formatter\", \"json-lsp\", \"html-lsp\", \"fixjson\", \"emmet-ls\", \"css-lsp\", \"gopls\", \"codelldb\", \"vim-language-server\"`\r\n\r\n在第二次进入neovim后 输入`:MasonInstall  bash-language-server shfmt shellcheck stylua lua-language-server black pyright debugpy clang-format clangd cpptools node-debug2-adapter typescript-language-server quick-lint-js prettier sqls sql-formatter json-lsp html-lsp fixjson emmet-ls css-lsp markdownlint gopls vim-language-server codelldb`\r\n\r\n如果没成功可以多执行几次 `:PackSync` 保证Mason插件成功安装，然后再执行 `:MasonInstall`\r\n\r\nMason安装上述**LSP** **DAP** **Linter** **Formatter** 可能需要安装**nodejs**，**python** **venv**，**golang**环境。\r\n\r\nubuntu下nodejs安装参考 **nvm**: \u003chttps://github.com/nvm-sh/nvm\u003e\r\n\r\ngolang: `sudo apt install golang`\r\n\r\npython venv: `sudo apt install python3 python3-venv`\r\n\r\n**javascript typescript** 的格式化插件用的是 `deno` 不是 `prettier`,需要单独安装 [deno](https://github.com/denoland/deno)\r\n\r\n**下面视频展示第一次安装我的neovim过程**\r\n\r\n\u003chttps://user-images.githubusercontent.com/43649186/205034422-2c2df144-e568-485b-8f7d-5c3a831b3536.mp4\u003e\r\n\r\n### 我的neovim可以做什么\r\n\r\n我的neovim配置了c，python，nodejs，lua，bash，ts，sql，go, vim的LSP，代码调试功能配置了python, c, nodejs，配置了markdown相关插件，方便markdown文件编辑和markdown文件预览，**对于大文件的优化**，当文件很大时，默认关闭了treesitter语法高亮，和一些插件，提高大文件的打开速度。\r\n\r\n#### 我的neovim首页\r\n\r\n![我的neovim首页](./picture/8.png)\r\n\r\n配置有三个配色，可以通过颜色插件进行选择 **`Telescope i42 color23`**\r\n\r\n对于终端背景与 nvim 有差距层次问题可以通过让终端背景色与 nvim 背景色一致解决，主题**背景色** `#2C323B` nvim 主题背景高亮组 **`Normal` `NormalNC` `NormalFloat`**，对于 **Syntax** 相关的内容，比如函数粗体显示，注释斜体显示，需终端开启相应的支持，我用的是**windows terminal +wsl2**环境\r\n\r\n![color manager](./picture/colormanager.png)\r\n\r\n**deus** \u003chttps://github.com/ajmwagar/vim-deus\u003e\r\n\r\n![deus](./picture/deus1.png)\r\n\r\n\u003e deus 有四套语法高亮选择，`:DeusSyntaxColor`\r\n\r\n![deus2](./picture/deus2.png)\r\n\r\n**tundra** \u003chttps://github.com/sam4llis/nvim-tundra\u003e\r\n\r\n![tundra1](./picture/tundra1.png)\r\n\r\n![tundra2](./picture/tundra2.png)\r\n\r\n**everforest** \u003chttps://github.com/sainnhe/everforest\u003e\r\n\r\n![everforest](./picture/everforest.png)\r\n\r\n---\r\n\r\n## neovim插件介绍\r\n\r\n### 写在前面,约定习俗 \u003c!-- omit from toc --\u003e\r\n\r\n- `\u003c\u003e` 表示必选项，例如`\u003cnumber\u003e` 表示必须选择一个数字。\r\n\r\n- `[]` 表示可选项。\r\n\r\n- `ctrl-i` 表示组合键 `ctrl` `i` ,`sp` 表示组合键 `s` `p` 。\r\n\r\n- `\u003cspace\u003e` 表示空格键 `\u003cCR\u003e` 表示enter键 `\u003cTab\u003e` 表示Tab键，本配置的`\u003cLeader\u003e`表示键位`;`。\r\n\r\n- `|` 表示或\r\n\r\n- `:h ZZ` 表示在vim normol模式下输入`:h ZZ` ，即进入command模式然后输入h ZZ，h是help的缩写，即help命令。\r\n\r\n## 目录\r\n\r\n- [1 vim](#1-vim)\r\n  - [1.1 vim基础](#11-vim基础)\r\n- [2 我的neovim插件配置](#2-我的neovim插件配置)\r\n  - [2.1 配置文件目录结构说明](#21-配置文件目录结构说明)\r\n  - [2.2 neovim键位映射说明](#22-neovim键位映射说明)\r\n  - [2.3 插件介绍](#23-插件介绍)\r\n\r\n## 1 vim\r\n\r\n### 1.1 vim基础\r\n\r\n- 常用模式\r\n\r\n  vim有四种常用模式，分别是命令模式（command），编辑模式（insert），普通模式（normal），视图模式（view）。\r\n\r\n- 模式切换\r\n\r\n  normal模式下通过`i` `I` `o` `O` `a` `A` 进入insert模式，insert模式通过`Esc` 进入normal模式，normal模式通过`V` `Ctrl-v` `v`  `ctrl-q` 进入view模式，normal模式通过`:` 进入命令模式。\r\n\r\n- normal模式下常见操作\r\n\r\n  `hjkl` 方向键上下左右\r\n\r\n  ```textile\r\n               k\r\n             h   l\r\n               j\r\n  ```\r\n\r\n  `0` `^` 光标跳到行首，`$` 光标跳到行尾，`gg` 光标跳到首行，`G` 光标跳到末行，`\u003cnumber\u003egg` 跳转到number行。\r\n\r\n  `ctrl-i` 光标跳转至上一个位置，`ctrl-o` 光标跳转至下一个位置，可通过`:jumps` 命令查看具体的跳转表。\r\n\r\n  `f \u003ca-z|A-Z\u003e` 在当前行查找字母，并把光标跳转至该字母。\r\n\r\n  `/\u003cword\u003e |?\u003cword\u003e` 在全文种搜索指定文字。\r\n\r\n  `ZZ` 退出vim，与`wq` 相似，但有一些差异，具体可参考`:h ZZ` 。\r\n\r\n  `r` 替换单个字母，`R` 连续替换，`x` 删除光标位置处字符，`X` 删除光标前面的一个字符，`D` 当光标处到行尾的字符剪切至vim剪切板寄存器中，`dd` 将当前行内容剪切至vim剪切板寄存器中，`yy` 复制当前行内容到vim剪切板寄存器中，`u` 回退至上一个状态，`p` 将寄存器剪切板中的内容粘贴到光标位置，`w` 光标跳转至下一个单词首字母，`b` 光标跳转至上一个单词首字母，`e` 光标跳转至当前单词尾字母。\r\n\r\n- 一些有关vim motion操作\r\n\r\n  normal模式下motion操作可以更方便的编辑文字，下面列举一些例子：\r\n\r\n  `dw` 将光标位置一直到该单词词尾剪切至vim剪切板寄存器中，该行为等同`de` ,`diw` 将光标位置单词剪切至vim剪切板寄存器中，`d5l` 从光标位置向左一共5个字符剪切至vim剪切板寄存器中，`di'` 将单引号内的内容剪切至vim剪切板寄存器中（i可以理解为in），类似的动作还有`dG` `dfl`(将光标位置到字符l间的内容剪切至vim剪切板寄存器中) `cw` `ciw`（将当前光标位置单词剪切至vim剪切板寄存器中，并进入insert模式） `ci'` `cfl` `y6j` (从光标位置开始向下复制6行内容至vim剪切板寄存器中)，`6j` (光标向下移动6行)更多参考`:h motion` 。\r\n\r\n- 有关光标跳转操作\r\n\r\n  `ctrl-f` 光标向下跳转半页，`ctrl-b` 光标向上跳转半页，`ctrl-u` 光标向上跳转多行，`ctrl-d` 光标向下跳转多行，`(` 和 `)`  jump statement，`{` 和 `}` jump section， `%` 跳转至对应闭合括号，`ctrl-i` 光标跳转至上一个位置，`ctrl-o` 光标跳转至下一个位置，可通过`:jumps` 命令查看具体的跳转表。\r\n\r\n- 与窗口相关操作\r\n\r\n  在vim中有着window tab buffer概念，buffer即缓存区，它存储着内容，比如当前编辑的文件，这涉及到Linux的一个概念**流**，在Linux中一切都是文件都是数据，你当前编辑的文件就是一个数据流，该数据流暂存在内存的一块地址中（buffer），最后发生一次io写入到硬盘中，在Linux中硬盘也是一个文件，可以通过`ls /dev/` 查看。buffer中的数据通过window展示，即在vim中打开一个窗口展示buffer中的数据，tab则为布局方式，组织排列窗口的布局。\r\n\r\n  ```plain\r\n                      vim\r\n  tab\r\n  +----------------------+-------------------------+\r\n  | window               | window                  |\r\n  | 10101010101010101010 |                         |\r\n  | 10010101010101010101 |                         |\r\n  | 11100001010101010101 |                         |\r\n  | 100000111~~~+--------------\u003ebuffer             |\r\n  |                      |                         |\r\n  +-------------------------------------------------+\r\n  | window               |                         |\r\n  |                      |                         |\r\n  |                      |                         |\r\n  |                      |                         |\r\n  |                      |                         |\r\n  |                      |                         |\r\n  +----------------------+-------------------------+\r\n  ```\r\n\r\n  `:split` 沿着水平方向打开一个新的window，`:vsplit` 沿着垂直方向打开一个新的window。\r\n\r\n  `:split \u003cfilename|path/to/file\u003e` 打开一个新的文件\r\n\r\n  `:vsplit \u003cfilename|path/to/file\u003e`\r\n\r\n- normal模式下一些查找操作\r\n\r\n  `#` 向上查找光标处单词，`*` 向下查找光标处单词，`/` 进入搜索，`?` 进入搜索，`N` 在搜索中向上跳转（上一个），`n` 在搜索中向下跳转（下一个）\r\n\r\n- 其他一些normal模式下常用功能\r\n\r\n  `:s/a/b` 将当前行找到的第一个a替换成b\r\n\r\n  `:s/a/b/g` 将一行中找到的a均换成b\r\n\r\n  `:%s/a/b/g` 将当前buffer中所有的找到的a替换成b (%代表当前文件名即当前buffer)\r\n\r\n  `:2,6s/a/b/g` 将2到6行的找到的a替换成b\r\n\r\n  `:set nohli` 取消搜索高亮，`:set past` 设置进入粘贴模式，`:set nopas` 退出粘贴模式。\r\n\r\n## 2 我的neovim插件配置\r\n\r\n### 2.1 配置文件目录结构说明\r\n\r\nneovim在启动阶段会加载目录 `$XDG_CONFIG_HOME/nvim` 下的init.vim文件或init.lua文件，sysinit.vim在neovim启动阶段也会被加载，一般这个文件在目录 `$VIM/sysinit.vim` 下，更详细的说明参考`:h config` 。在neovim启动过程中，sysinit.vim会拉起我的neovim配置,参考`:h startup`，sysinit.vim在目录 `nvim-linux64/share/nvim/` 下，我的配置文件在目录 `nvim-linux64/share/nvim/xray23/lua/` 下，下面是目录`nvim-linux64/share/nvim/xray23/lua/` 的目录结构。\r\n\r\n```plain\r\n├── autocmd.lua\r\n├── basic.lua\r\n├── cmp\r\n│   ├── cmp.lua\r\n│   └── snippets\r\n│       ├── lua\r\n│       └── vscode\r\n├── colorscheme.lua\r\n├── commConf.lua\r\n├── dap\r\n│   └── nvim-dap\r\n│       ├── config\r\n│       │   ├── codelldb.lua\r\n│       │   ├── cpptools.lua\r\n│       │   └── nodejs.lua\r\n│       └── setup.lua\r\n├── keybindingAlias.lua\r\n├── keybindings.lua\r\n├── lsp\r\n│   ├── common-config.lua\r\n│   ├── config\r\n│   │   ├── bash.lua\r\n│   │   ├── clangd.lua\r\n│   │   ├── css.lua\r\n│   │   ├── emmet-ls.lua\r\n│   │   ├── gopls.lua\r\n│   │   ├── html.lua\r\n│   │   ├── json.lua\r\n│   │   ├── lua.lua\r\n│   │   ├── pyright.lua\r\n│   │   ├── quick-lint-js.lua\r\n│   │   ├── sqls.lua\r\n│   │   ├── tsserver.lua\r\n│   │   └── vimls.lua\r\n│   ├── lsp-signature.lua\r\n│   ├── null-ls.lua\r\n│   ├── setup.lua\r\n│   ├── ui.lua\r\n│   └── vim-illuminate.lua\r\n├── plugin-config\r\n│   ├── bufferline.lua\r\n│   ├── comment.lua\r\n│   ├── dashboard.lua\r\n│   ├── fidget.lua\r\n│   ├── gitsigns.lua\r\n│   ├── hop.lua\r\n│   ├── indent-blankline.lua\r\n│   ├── lualine.lua\r\n│   ├── markdown-preview.lua\r\n│   ├── mkdnflow.lua\r\n│   ├── neoscrolL.lua\r\n│   ├── nvim-autopairs.lua\r\n│   ├── nvim-colorizer.lua\r\n│   ├── nvim-notify.lua\r\n│   ├── nvim-tree.lua\r\n│   ├── nvim-treesitter.lua\r\n│   ├── project.lua\r\n│   ├── telescope.lua\r\n│   ├── todo-comments.lua\r\n│   ├── toggleterm.lua\r\n│   ├── trouble.lua\r\n│   ├── twilight.lua\r\n│   ├── whichkey.lua\r\n│   ├── yanky.lua\r\n│   └── zen-mode.lua\r\n├── plugins.lua\r\n├── start42.lua\r\n└── usercmd.lua\r\n```\r\n\r\n**autocmd.lua**为定义的一些vim autocmd比如在yank的时候高亮yank的内容，对指定文件保存时进行格式化处理，**basic.lua**为对neovim一些基本编辑属性的配置，比如定义2个空格等于一个tab，**cmp**目录里的配置文件为neovim写代码时自动补全配置,**lsp**为lsp相关配置，**dap** 为调试器相关配置，**commConf** 文件定义一些公共的配置，比如是否要展示list char（控制字符），是否启动magic search等，**start42.lua** 文件为初始文件，sysinit.vim文件拉起start42.lua，start42.lua拉起后续配置文件。\r\n\r\n**neovim 代码补全**\r\n\r\n![neovim 代码补全](./picture/cmp.png)\r\n\r\n**colorscheme.lua**定义了neovim的主题，配色，**dap**目录里的文件为neovim代码调试器相关配置。\r\n\r\n**neovim 调试代码**\r\n\r\n![neovim调试代码](./picture/dap.png)\r\n\r\n**init.lua**为初始化配置文件，即sysinit.vim拉起init.lua，init.lua拉起后续的配置文件，**keybindings.lua**定义neovim一些键位映射，**lsp**目录下的配置文件为neovim LSP相关配置，neovim LSP包括neovim的一些代码定义跳转，引用跳转，代码提示等。\r\n\r\n**neovim—LSP**\r\n\r\n![neovim-LSP](./picture/lsp.png)\r\n\r\n**plugin-config**目录下的文件为各种插件的配置文件。\r\n\r\n### 2.2 neovim键位映射说明\r\n\r\n1. **基本键位映射**\r\n\r\n   *定义neovim的Leader键为空格键 `\u003cSPACE\u003e` ,leader 键是什么，详细可以参考`:h \u003cLeader\u003e`*\r\n\r\n   *可以通过修改**keybindingAlias.lua**文件定义自己的键位映射*\r\n\r\n   *配置定义的所有键位映射可以通过修改**keybindings.lua** 和**keybindingAlias.lua** 文件进行修改*\r\n\r\n   - normal 模式下键位映射\r\n\r\n     取消了normal模式下 `H` ，`L` ，`s` ，`\u003cF1\u003e` 键的默认功能。\r\n\r\n     `\u003cF1\u003e` 进入command模式\r\n\r\n     `H` , `L` 光标向左移动35个字符，光标向右移动35个字符\r\n\r\n     `sp` , `sP` 进入粘贴模式，退出粘贴模式，什么是粘贴模式参考 `:h 'paste'`\r\n\r\n     `ctrl-u` `ctrl-d` 向上向下移动多行光标\r\n\r\n     `ctrl-j` `ctrl-k` 向上向下移动多行光标\r\n\r\n     `qq` 关闭当前buffer `\u003cLeader\u003eq` 关闭当前window，`\u003cLeader\u003ew` 保存当前window的buffer（将当前window的内容保存），`\u003cLeader\u003eWQ` 关闭所有window，`\u003cLeader\u003eQ` 退出neovim并且不保存buffer\r\n\r\n     `sh` , `sv` 新建水平window，新建垂直window，`s←` ，`s→`，`s↑` ，`s↓` 上下左右切换window，`sw` 按顺时针方向依次切换window\r\n\r\n     `sk` ，`sj` ，`s,` ，`s.` 将window向上移动2点，将window向下移动2点，将window向左移动2点，将window向右移动2点，`s=` 将window恢复默认大小\r\n\r\n     `\u003cctrl-/\u003e` 行注释\r\n\r\n     `za`代码折叠与代码展开，`zr` `zm` 打开/关闭所有折叠，`zd` `zE` 删除当前/删除所有折叠 `zj` `zk` 移动至上一/下一折叠点。\r\n\r\n   - insert模式下键位映射\r\n\r\n     取消了insert模式下`ctrl-f` 的默认功能\r\n\r\n     `\u003cF1\u003e` 进入command模式\r\n\r\n     `\u003cctrl-/\u003e` 行注释\r\n\r\n   - visual模式下键位映射\r\n\r\n     `ctrl-j` `ctrl-k` 向上向下移动多行光标\r\n\r\n     `Y` 将内容复制到系统剪切板(非neovim剪切板)\r\n\r\n     `F1` 进入command模式\r\n\r\n   - command模式下键位映射\r\n\r\n     `ctrl-j` `ctrl-k` 在命令补全窗口中向上移动向下移动\r\n\r\n   - terminal模式下键位映射\r\n\r\n     normal模式下`st` 水平方向上打开终端window\r\n\r\n     normal模式下`stv` 垂直方向上打开终端window\r\n\r\n2. **插件键位映射**\r\n\r\n   *插件键位一般是在normal模式下*\r\n\r\n   \u003e **插件快捷键会经常出现变动，具体以文件 `keybindingAlias.lua` 为准**\r\n   - nvimTree\r\n\r\n     `\u003cspace\u003e1` 打开|关闭 nvimTree\r\n\r\n   - LSP\r\n\r\n     `\u003cleader\u003ern`，`\u003cleader\u003era` 重命名变量\r\n\r\n     `\u003cleader\u003eca` code action\r\n\r\n     `gd` 跳转至定义，`gh` 打开文档，`gr` 跳转至引用，`g←` ，`g→` 跳转至上一个语法检查，跳转至下一个语法检查，`gl` 打开语法检查列表，`;gl` goto type definitions, `;gi` goto implementations，`;gh` open signature-help，`\u003cLeader\u003ef` 格式化代码，`\u003cspace\u003e3` open code outline\r\n\r\n   - DAP\r\n\r\n     `\u003cF5\u003e` 打开代码调试，`\u003cF6\u003e` 执行下一步，`\u003cspace\u003ede` 关闭代码调试，`\u003cspace\u003edT` 去掉所有中断点，`\u003cspace\u003edt` 标记中断点，`\u003cspace\u003edh` 光标处表达式求值，visual模式下 `\u003cLeader\u003edh` 光标处表达式求值。\r\n\r\n   - bufferline\r\n\r\n     `\u003cLeader\u003ej` `\u003cLeader\u003ek` 切换到左边的buffer，切换到右边的buffer，`\u003cLeader\u003eh` `\u003cLeader\u003el` 向左交换buffer，向右交换buffer。\r\n\r\n   - telescope\r\n\r\n     normal模式和insert模式下 `ctrl-f` 在当前buffer中查找内容，`\u003cspace\u003e4` 查找项目文件，`\u003cspace\u003e5` 打开buffer列表，`\u003cspace\u003es` 打开会话列表。\r\n\r\n   - cmp\r\n\r\n     `\u003cTab\u003e` ，`shift\u003cTab\u003e`（代码snippet节点上下跳转），`ctrl-k` ，`ctrl-j`（代码snippet条件节点上下选择）  自动补全框向上选择，向下选择，`\u003cCR\u003e` 选中，`ctrl-u`，`ctrl-d` 自动补全扩展窗口向下移动，向上移动，`ctrl-\u003cSpace\u003e` 打开自动补全，`\u003cAlt\u003ek` 关闭自动补全。\r\n\r\n   - toggerterm\r\n\r\n     `\u003cLeader\u003eta` 打开|关闭 终端，`\u003cLeader\u003etb` 打开|关闭 终端，`\u003cLeader\u003etc` 打开|关闭 终端，`\u003cLeader\u003etd` 打开|关闭 终端`\u003cLeader\u003etg` 打开关闭特色终端[lazygit](https://github.com/jesseduffield/lazygit) 需要安装**lazygit**\r\n\r\n   - copilot\r\n\r\n     `\u003calt\u003ej` 接受copilot的建议，配置默认关闭了copilot，需要的自行启用\r\n\r\n   - hop\r\n\r\n     `\u003cLeader\u003egg` `\u003cLeader\u003egv` normal和insert模式下打开行跳转和word跳转，`\u003cLeader\u003egb` insert模式下打开 pattern\r\n\r\n   - yanky\r\n\r\n     `\u003cLeader\u003eyy` insert和normal模式打开yanky面板（剪切板历史）\r\n\r\n   - gitsigns\r\n\r\n     详细见插件介绍\r\n\r\n   - mkdnflow.nvim\r\n\r\n     详细见插件介绍\r\n\r\n### 2.3 插件介绍\r\n\r\n1. LSP\r\n\r\n   LSP相关详细内容参考 `:h lsp`\r\n   LSP: \u003chttps://github.com/neovim/nvim-lspconfig\u003e\r\n   null-ls: \u003chttps://github.com/jose-elias-alvarez/null-ls.nvim\u003e\r\n   mason: \u003chttps://github.com/williamboman/mason.nvim\u003e\r\n\r\n   `:LspInfo` `:LspLog` `:NullLsInfo` `:NullLsLog` 可以查看LSP client相关情况。\r\n\r\n2. bufferline\r\n\r\n   bufferline：\u003chttps://github.com/akinsho/bufferline.nvim\u003e\r\n\r\n   `:BufferLinePick` 切换至选中的buffer\r\n\r\n   `:BufferLinePickClose` 关闭选中的buffer\r\n\r\n   `:BufferLineCloseLeft` 关闭当前buffer左边的所有buffer\r\n\r\n   `:BufferLineCloseRight` 关闭当前buffer右边的所有buffer\r\n\r\n3. lspsaga\r\n\r\n   lspsage: \u003chttps://github.com/glepnir/lspsaga.nvim\u003e\r\n\r\n   `:LSoutlineToggle` 打开outline\r\n\r\n   **lspsage outline**\r\n\r\n   ![](./picture/4.png)\r\n\r\n   在lspsaga窗口中，`o` 可以跳转至对应变量处\r\n\r\n   lspsage提供很多有关LSP的东西，`:Lspsaga \u003crename|lsp_finder|code_action|hover_doc|...\u003e`\r\n\r\n4. nvim-tree\r\n\r\n   nvimTree: \u003chttps://github.com/kyazdani42/nvim-tree.lua\u003e\r\n\r\n   `:NvimTreeToggle` 打开|关闭nvimTree窗口，\r\n\r\n   下面列举nvimTree窗口一些常用的快捷键指令\r\n\r\n   ```plain\r\n   `\u003cCR\u003e`            edit                open a file or folder; root will cd to the above directory\r\n   `I`               toggle_git_ignored  toggle visibility of files/folders hidden via |git.ignore| option\r\n   `H`               toggle_dotfiles     toggle visibility of dotfiles via |filters.dotfiles| option\r\n   `U`               toggle_custom       toggle visibility of files/folders hidden via |filters.custom| option\r\n   `R`               refresh             refresh the tree\r\n   `a`               create              add a file; leaving a trailing `/` will add a directory\r\n   `d`               remove              delete a file (will prompt for confirmation)\r\n   `D`               trash               trash a file via |trash| option\r\n   `r`               rename              rename a file\r\n   `x`               cut                 add/remove file/directory to cut clipboard\r\n   `c`               copy                add/remove file/directory to copy clipboard\r\n   `p`               paste               paste from clipboard; cut clipboard has precedence over copy; will prompt for confirmation\r\n   `y`               copy_name           copy name to system clipboard\r\n   `Y`               copy_path           copy relative path to system clipboard\r\n   `gy`              copy_absolute_path  copy absolute path to system clipboard\r\n   `s`               system_open         open a file with default system application or a folder with default file manager, using |system_open| option\r\n   `f`               live_filter         live filter nodes dynamically based on regex matching.\r\n   `F`               clear_live_filter   clear live filter\r\n   `q`               close               close tree window\r\n   `W`               collapse_all        collapse the whole tree\r\n   `E`               expand_all          expand the whole tree, stopping after expanding |actions.expand_all.max_folder_discovery| folders; this might hang neovim for a while if running on a big folder\r\n   `S`               search_node         prompt the user to enter a path and then expands the tree to match the path\r\n   `.`               run_file_command    enter vim command mode with the file the cursor is on\r\n   `\u003cC-k\u003e`           toggle_file_info    toggle a popup with file infos about the file under the cursor\r\n   `g?`              toggle_help         toggle help\r\n   `m`               toggle_mark         Toggle node in bookmarks\r\n   `bmv`             bulk_move           Move all bookmarked nodes into specified location\r\n   ```\r\n\r\n5. treesitter\r\n\r\n   treesitter: \u003chttps://github.com/nvim-treesitter/nvim-treesitter\u003e\r\n\r\n   一些常用treesitter命令\r\n\r\n   `:TSupdate` 更新treesitter语法树\r\n\r\n   `:TSBufEnable \u003chighlight|moduleName...\u003e` 启用treesitter相应模块\r\n\r\n   `:TSBufDisable \u003chighlight|moduleName...\u003e` 不启用treesitter相应模块\r\n\r\n   `:TSmoduleInfo` 查看treesitter模块信息\r\n\r\n6. telescope\r\n\r\n   telescope: \u003chttps://github.com/nvim-telescope/telescope.nvim\u003e\r\n\r\n   telescope 窗口的默认键位映射\r\n\r\n   | Mappings       | Action                                               |\r\n   | -------------- | ---------------------------------------------------- |\r\n   | `\u003cC-n\u003e/\u003cDown\u003e` | Next item                                            |\r\n   | `\u003cC-p\u003e/\u003cUp\u003e`   | Previous item                                        |\r\n   | `j/k`          | Next/previous (in normal mode)                       |\r\n   | `H/M/L`        | Select High/Middle/Low (in normal mode)              |\r\n   | `gg/G`         | Select the first/last item (in normal mode)          |\r\n   | `\u003cCR\u003e`         | Confirm selection                                    |\r\n   | `\u003cC-x\u003e`        | Go to file selection as a split                      |\r\n   | `\u003cC-v\u003e`        | Go to file selection as a vsplit                     |\r\n   | `\u003cC-t\u003e`        | Go to a file in a new tab                            |\r\n   | `\u003cC-u\u003e`        | Scroll up in preview window                          |\r\n   | `\u003cC-d\u003e`        | Scroll down in preview window                        |\r\n   | `\u003cC-/\u003e`        | Show mappings for picker actions (insert mode)       |\r\n   | `?`            | Show mappings for picker actions (normal mode)       |\r\n   | `\u003cC-c\u003e`\\|`q`   | Close telescope                                      |\r\n   | `\u003cEsc\u003e`        | Close telescope (in normal mode)                     |\r\n   | `\u003cTab\u003e`        | Toggle selection and move to next selection          |\r\n   | `\u003cS-Tab\u003e`      | Toggle selection and move to prev selection          |\r\n   | `\u003cC-q\u003e`        | Send all items not filtered to quickfixlist (qflist) |\r\n   | `\u003cM-q\u003e`        | Send all selected items to qflist                    |\r\n\r\n   在insert模式下输入`ctrl-/` 和在normal模式下输入`?` 都可以获取对应模式下默认的键位映射。\r\n\r\n   `:Telescope` 会列举所有的telescope模块，键入模块名以调用相应模块\r\n\r\n   **:telescope**\r\n\r\n   ![](./picture/5.png)\r\n\r\n   常用telescope模块 `:Telescope [find_file|live_grep|buffers|env|diagnostics|keymaps|highlights|man_pages|help_tags...]`\r\n\r\n7. project\r\n\r\n   project: \u003chttps://github.com/ahmedkhalf/project.nvim\u003e\r\n\r\n   `:Telescope project` 打开项目窗口\r\n\r\n   项目窗口下的默认键位映射\r\n\r\n   | Normal mode | Insert mode | Action                     |\r\n   | ----------- | ----------- | -------------------------- |\r\n   | f           | \\\u003cc-f\\\u003e     | find\\_project\\_files       |\r\n   | b           | \\\u003cc-b\\\u003e     | browse\\_project\\_files     |\r\n   | d           | \\\u003cc-d\\\u003e     | delete\\_project            |\r\n   | s           | \\\u003cc-s\\\u003e     | search\\_in\\_project\\_files |\r\n   | r           | \\\u003cc-r\\\u003e     | recent\\_project\\_files     |\r\n   | w           | \\\u003cc-w\\\u003e     | change\\_working\\_directory |\r\n\r\n   通过在项目目录创建名为**project.md**的文件，包含**project.md**的目录将成为项目根目录，可通过修改project插件配置文件的**patterns**来自定义自己的项目跟目录匹配模式。\r\n\r\n   **project插件配置文件**\r\n\r\n   ![](./picture/6.png)\r\n\r\n8. comment todo\r\n\r\n   commentTodo: \u003chttps://github.com/folke/todo-comments.nvim\u003e\r\n\r\n   类似vscode的todotree\r\n\r\n   **触发todo的关键词**\r\n\r\n   ![](./picture/7.png)\r\n\r\n   ```plain\r\n   常用的todo命令\r\n   :TodoQuickFix\r\n   :TodoLocList\r\n   :TodoTrouble\r\n   :TodoTelescope\r\n   :TodoTrouble cwd=~/projects/foobar\r\n   ```\r\n\r\n9. trouble\r\n\r\n   trouble: \u003chttps://github.com/folke/trouble.nvim\u003e\r\n\r\n   Trouble comes with the following commands:\r\n\r\n   - `:Trouble [mode]`: open the list\r\n   - `:TroubleClose [mode]`: close the list\r\n   - `:TroubleToggle [mode]`: toggle the list\r\n   - `:TroubleRefresh`: manually refresh the active list\r\n\r\n   **mode** = `\"workspace_diagnostics\"|\"workspace_diagnostics\"|\"document_diagnostics\", \"quickfix\"|\"lsp_references\"|\"loclist\"`\r\n\r\n   trouble窗口默认键位映射\r\n\r\n   ```plain\r\n   close = \"q\", -- close the list\r\n   cancel = \"\u003cesc\u003e\", -- cancel the preview and get back to your last window / buffer / cursor\r\n   refresh = \"r\", -- manually refresh\r\n   jump = {\"\u003ccr\u003e\", \"\u003ctab\u003e\"}, -- jump to the diagnostic or open / close folds\r\n   open_split = { \"\u003cc-x\u003e\" }, -- open buffer in new split\r\n   open_vsplit = { \"\u003cc-v\u003e\" }, -- open buffer in new vsplit\r\n   open_tab = { \"\u003cc-t\u003e\" }, -- open buffer in new tab\r\n   jump_close = {\"o\"}, -- jump to the diagnostic and close the list\r\n   toggle_mode = \"m\", -- toggle between \"workspace\" and \"document\" diagnostics mode\r\n   toggle_preview = \"P\", -- toggle auto_preview\r\n   hover = \"K\", -- opens a small popup with the full multiline message\r\n   preview = \"p\", -- preview the diagnostic location\r\n   close_folds = {\"zM\", \"zm\"}, -- close all folds\r\n   open_folds = {\"zR\", \"zr\"}, -- open all folds\r\n   toggle_fold = {\"zA\", \"za\"}, -- toggle fold of current file\r\n   previous = \"k\", -- preview item\r\n   next = \"j\" -- next item\r\n   ```\r\n\r\n   `o` 经常用到\r\n\r\n10. toggleterm\r\n\r\n    toggleterm: \u003chttps://github.com/akinsho/toggleterm.nvim\u003e\r\n\r\n    ```plain\r\n    常用的toggleterm命令\r\n    :\u003ccount\u003eTermExec\r\n    :\u003ccount\u003eToggleTerm\r\n    :ToggleTermToggleAll\r\n    :ToggleTermSetName work\r\n    :ToggleTermSendCurrentLine \u003cT_ID\u003e\r\n    :ToggleTermSendVisualLines \u003cT_ID\u003e\r\n    :ToggleTermSendVisualSelection \u003cT_ID\u003e\r\n    ```\r\n\r\n11. cmp\r\n\r\n    cmp: \u003chttps://github.com/hrsh7th/nvim-cmp\u003e\r\n\r\n    `:CmpStatus` 查看cmp加载状态\r\n\r\n    默认加载了tabnine，不加载copilot（请自行启用）\r\n\r\n12. yanky\r\n\r\n    yanky: \u003chttps://github.com/gbprod/yanky.nvim\u003e\r\n\r\n    常用的yanky插件命令\r\n\r\n    `:YankyClearHistory` 清空剪切板历史\r\n\r\n    `:Telescope yank_history` 打开neovim剪切板历史\r\n\r\n    ![Telescope yank_history](./picture/9.png)\r\n\r\n    `:Telescope yank_history` 打开的面板中，insert模式（i）和normal模式（n）下的keymap如下所示\r\n\r\n    ```plain\r\n    mappings = {\r\n      default = mapping.put(\"p\"),\r\n      i = {\r\n        [\"\u003cc-p\u003e\"] = mapping.put(\"p\"),\r\n        [\"\u003cc-k\u003e\"] = mapping.put(\"P\"),\r\n        [\"\u003cc-x\u003e\"] = mapping.delete(),\r\n        [\"\u003cc-r\u003e\"] = mapping.set_register(utils.get_default_register()),\r\n      },\r\n      n = {\r\n        p = mapping.put(\"p\"),\r\n        P = mapping.put(\"P\"),\r\n        d = mapping.delete(),\r\n        r = mapping.set_register(utils.get_default_register())\r\n      },\r\n    ```\r\n\r\n    `p` `P` 粘贴剪切板内容到文本\r\n\r\n13. gitsigns\r\n\r\n    gitsigns: \u003chttps://github.com/lewis6991/gitsigns.nvim\u003e\r\n\r\n    常用命令\r\n\r\n    - `:Gitsigns toggle_current_line_blame` 展示或者不展示current line blame\r\n    - `:Gitsigns seqloclist` 展示hunk列表\r\n    - `:Gitsigns setqflist` 展示hunk列表\r\n      ![Gitsigns setqflist](./picture/11.png)\r\n\r\n    键位映射\r\n\r\n     ```plain\r\n     gitsigns = {\r\n      gs_next_hunk = \"\u003cleader\u003egj\",\r\n      gs_pre_hunk = \"\u003cleader\u003egk\",\r\n      stage_hunk = \"\u003cleader\u003egs\",\r\n      reset_hunk = \"\u003cleader\u003egr\",\r\n      stage_buffer = \"\u003cleader\u003egS\",\r\n      undo_stage_hunk = \"\u003cleader\u003egu\",\r\n      reset_buffer = \"\u003cleader\u003egR\",\r\n      preview_hunk = \"\u003cleader\u003egp\",\r\n      blame_line = \"\u003cleader\u003egb\",\r\n      diffthis = \"\u003cleader\u003egd\",\r\n      diffthiss = \"\u003cleader\u003egD\",\r\n      toggle_current_line_blame = \"\u003cleader\u003egtb\",\r\n      toggle_deleted = \"\u003cleader\u003egtd\",\r\n      select_hunk = \"ig\",\r\n     },\r\n     ```\r\n\r\n     常用的键位有`\u003cleader\u003egj` `\u003cleader\u003egk` 上下跳转hunk `\u003cleader\u003egp` `\u003cleadeer\u003egd` 预览hunk 和show diff。\r\n\r\n14. mkdnflow\r\n\r\n    markdown: \u003chttps://github.com/jakewvincent/mkdnflow.nvim\u003e\r\n\r\n    **visual模式下一些便捷操作**\r\n\r\n    `\u003cCR\u003e` 当文本以 #开头将创建anchor link（锚点链接） 当文本是uri时将创建 web link\r\n\r\n    **normal模式下一些便捷操作**\r\n\r\n    `\u003cCR\u003e` 创建链接 `md` 删除链接 `ya` `yfa` 给一个标题创建anchor link `\u003cTAB\u003e` `\u003cS-TAB\u003e` 上下跳转链接 `[[` `]]` 上下跳转标题 `+` `-` 增加标题层级\r\n\r\n    下面gif动图展示上述便捷操作\r\n\r\n    ![一些markdown便捷操作](./picture/2.gif)\r\n\r\n    `:MkdnTable x y` 创建x 行y 列的表 `:MkdnTableFormat` 格式化table\r\n\r\n    **一些键位映射**\r\n\r\n    ```plain\r\n    mkdnflow = {\r\n        enable = true,\r\n        mkdnDestroyLink = \"md\",\r\n        mkdnTagSpan = \"md\",\r\n        mkdnTablePrevRow = \"\u003cC-CR\u003e\",\r\n        mkdnToggleToDo = \"mt\",\r\n        mkdnFoldSection = \"mz\",\r\n        mkdnUnfoldSection = \"\u003cleader\u003emz\",\r\n        mkdnTableNextCell = \"\u003cLeader\u003emj\",\r\n        mkdnTablePrevCell = \"\u003cLeader\u003emk\",\r\n    }\r\n    ```\r\n\r\n15. markdown-preview\r\n\r\n    markdown-preview: \u003chttps://github.com/davidgranstrom/nvim-markdown-preview\u003e\r\n\r\n    常用的markdown-preview插件命令\r\n\r\n    `:MarkdownPreview` 打开markdown-preview\r\n\r\n    `:MarkdownPreviewStop` 关掉markdown-preview\r\n\r\n    ![markdown preview](./picture/10.png)\r\n\r\n16. hop\r\n\r\n    hop: \u003chttps://github.com/phaazon/hop.nvim\u003e\r\n\r\n    常用的hop命令\r\n\r\n    `:HopWord` 单词跳转\r\n\r\n    `:HopLine` 行跳转\r\n\r\n    `:HopAnywhere` 任意位置跳转\r\n\r\n    `:HopPattern` 打开模式匹配\r\n\r\n17. colorize\r\n\r\n    colorize: \u003chttps://github.com/norcalli/nvim-colorizer.lua\u003e\r\n\r\n    常用的colorize命令\r\n\r\n    `:ColorizerToggle` 开关colorize\r\n\r\n18. tabnine 和 copilot\r\n\r\n    tabnine: \u003chttps://github.com/tzachar/cmp-tabnine\u003e\r\n\r\n    copilot: \u003chttps://github.com/github/copilot.vim\u003e\r\n\r\n19. matchup\r\n\r\n    matchup: \u003chttps://github.com/andymass/vim-matchup\u003e\r\n\r\n    常用的matchup命令\r\n\r\n    `:MatchupReload` 插件重启\r\n\r\n    `:MatchupWhereAmI?` 我的位置\r\n\r\n20. whichkey\r\n\r\n    whichkey: \u003chttps://github.com/folke/which-key.nvim\u003e\r\n\r\n21. color manager\r\n\r\n    color manager: \u003chttps://github.com/HUAHUAI23/telescope-color.nvim\u003e\r\n\r\n    常用命令\r\n\r\n    `:Telescope i42 color23` 主题选择\r\n\r\n22. session manager\r\n\r\n    session manager: \u003chttps://github.com/HUAHUAI23/telescope-session.nvim\u003e\r\n\r\n    常用命令\r\n\r\n    `:Telescope xray23 list` 会话列表\r\n\r\n    `:Telescope xray23 save` 会话保存\r\n23. translate\r\n    translate: \u003chttps://github.com/uga-rosa/translate.nvim\u003e\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuahuai23%2Fnvim64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuahuai23%2Fnvim64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuahuai23%2Fnvim64/lists"}