A user configuration template for AstroNvim
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bakPress the "Use this template" button above to create a new repository to store your user configuration.
You can also just clone this repository directly if you do not want to track your user configuration in GitHub.
git clone https://github.com/1538379200/astronvim-config-v4.git ~/.config/nvim/lua/usergit clone https://github.com/1538379200/astronvim-config-v4.git $env:LOCALAPPDATA\nvim\lua\usernvim
pack包大多是以community的方式加入的,如果你不需要,可以在community文件中注释
-
node.js
-
目标编程语言(从
commnunity的pack查找对应语言去安装) -
markmap(
npm install -g markmap-cli) -
code-minimap(使用小地图code-minimap会需要) -
fd (
python的envselect插件需要使用工具
进行 rust 项目时,你还需要加入 rust-analyzer 组件,之后才能通过其进行代码提示等操作
rustup compnent add rust-analyzer
astronvim 默认映射:https://astronvim.com/Basic%20Usage/mappings
-
s:flask插件文字搜索 -- normal -
Alt + j/k:函数间上下跳转 -- normal -
Alt + h/l:跳转左右标签(buffer)-- normal -
Ctrl + j/k/h/l:插入模式下光标移动 -- insert -
<leader>Tl:TODO列表 -- normal -
<leader>Tq:TODO快速修复 -- normal -
F7:水平方向打开toggleterm-- normal -
Ctrl+\:同 F7 相同的 terminal 窗口,使用Ctrl+\然后使用Ctrl+n可回到normal模式(当前已设置,可以直接使用ESC来返回普通模式,也可以直接使用Ctrl+w切换窗口,如Ctrl+w+l),normal模式下可以使用Ctrl+\或Ctrl+j/k或F7切换到编辑器中 --normal -
Shift+F7:打开外部的 ternimal,仅windows有效,默认pwsh-- normal- 默认会先查找
pwsh命令是否存在,如果存在,则使用pwsh命令(PowerShell 7),如果不存在,则打开的为cmd窗口 - 进入
polish.lua文件中,可以填写固定的terminal配置
- 默认会先查找
-
<leader>E:快速在当前文件位置打开系统文件管理器,仅在 windows 中有效 -- normal -
Ctrl+Shift+F10:运行代码/预览markdown等 -- normal -
Ctrl+F12:侧边栏展示页面中所有函数变量等(aerial) -- normal -
F12:使用telescope打开aerial-- normal<Enter>:跳转q:关闭
-
<leader>a:选择生成不同的注释结构(可以使用luasnip的跳转功能)-- normal- 常用如:
<leader>af,为当前函数生成注释
- 常用如:
-
Tab:- 在
luasnip片段中,并且当前属于 insert 模式,tab跳转下一个编辑,shift+tab 为跳转上一个编辑处 -- normal
- 在
-
Shift+Enter:普通模式下增加一行 -- normal -
Ctrl+s:插入和普通模式强制保存 -- normal, insert -
]e:跳转到下一个错误,[e跳转上一个错误 -- normal -
]d,[d: 同上,]e已改成]d的形式 -
]t/[t:上一个和下一个 todo 标记 -- normal -
<leader>I:lspsaga的incoming_calls,查看谁调用了此方法函数 -- normal -
<leader>O:lspsaga的outgoing_calls,查看此函数使用了那些方法 -- normal<Enter>:打开文件,跳转|:垂直分屏\:水平分屏t:tab形式打开q:退出<C-c>k:关闭<C-l>:在窗口间切换
-
K显示文档,再点击一次K进入弹窗,移动到链接,使用gx前往链接地址 -- normal -
<leader>fG:使用telescope增加参数过滤 --normal:"test" testcases:搜索testcases目录下的test字符"test" --iglob **/test_child/**:搜索所有test_child目录下文件中的test字符"test" -g "*.py":过滤文件格式- 依赖于
ripgrep的过滤,可以参考ripgrep/GUIDE.md at master · BurntSushi/ripgrep (github.com)
-
<leader>ZM:开始禅模式,ZenMode,更纯净的代码编写模式 - normal -
Ctrl+Shift+F10:快速运行当前文件(仅适用windows本地 环境) -- normal- python文件会自动设置临时
PYTHONPATH,并运行当前文件 - golang则使用
go run . - markdown使用
MarkdownPreview预览 - rust使用
cargo run.运行
- python文件会自动设置临时
-
Ctrl+Shift+Alt+F10:使用外部命令行工具运行文件 -- normal- 如果安装了
PowerShell 7的工具,能使用pwsh调用命令,则会优先使用pwsh命令 - 仅在
Windows中生效
- 如果安装了
-
F10:打开/关闭Overseer插件任务管理窗口 - normal -
<leader>fy:查找复制的文本,也可以使用Win+v拿windows的系统粘贴板,因为vim的寄存器和系统粘贴板是互通的,但是插件是没有系统粘贴板的历史内容的- 使用
<enter>直接粘贴 - 普通模式使用
d删除,输入模式使用ctrl+d删除 - 编辑普通模式使用
e,输入模式使用ctrl+e
- 使用
-
<leader>Rl:重启LSP服务,后续<leader>R前缀的将都作为重启/刷新某服务的前缀 -
F5:打开mundo窗口,显示文件差异,可进行撤销等操作 -- normal:p:可以在下方小窗口演示差异变化,使用r恢复P:在文件中显示当前节点的状态<enter>:选择当前节点,撤回到此节点的状态
-
Ctrl+k:插入模式下,快速将当前行切换到中间,相当于普通模式下zz-- normal -
ga:插件 EasyAlign 快捷方式,选中可使用例如ga=对齐=前后,常用vipga=-- n, x, v -
<leader>um:插件 code-minimap 切换按键,code-minimap需要安装软件才可以使用 -
lspsaga常用快捷键:<leader>la:code_action<leader>lS: outline<leader>lc: incoming_calls<leader>lC: outgoing_calls<leader>R: search references
-
<leader>s: 进行搜索替换 -- normal