nvim-TE, structural config for neovim. it can works on WSL and Windows through Windows Terminal, or on iOS & iPadOS through Blink Shell.
平台 | 终端工具 | 系统版本 |
---|---|---|
Windows |
Windows Terminal |
Windows 10 |
WSL |
Windows Terminal |
Ubuntu 20.+ |
iOS&iPadOS |
Blink Shell |
iOS15 |
Windows & WSL
-
安装
nerd font
在https://www.nerdfonts.com/font-downloads中选择一个
nerd font
下载后解压,双击打开安装 -
在
Windows Terminal
设置中选择对应的终端,在外观的字体中进行选择设置并保存
iOS & iPadOS
-
安装
nerd font
在https://github.com/blinksh/fonts中选择一个
nerd font
,复制它的"raw"
地址,设置到Blink Shell
的Settings->Appeareance->FONTS->Add a new font
中的CSS FONT-FAMILY STYLESHEET
中,点击Import
,并在FONT-FAMILY NAME
设置一个字体名,再进行Save
.在Settings->Appeareance->FONTS
中选择这个设置的这个字体名
Windows
- 在
PowerShell
中打开远程权限Set-ExecutionPolicy RemoteSigned -scope CurrentUser;
- 下载并安装
scoop
iwr -useb get.scoop.sh | iex scoop update
- 下载并安装
neovim
scoop bucket add versions scoop install neovim
Ubuntu
- 需要安装
Clang
或GCC 4.4+
,CMake 2.8.12+
- 安装依赖库
sudo apt install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl doxygen
- 下载并安装
neovim
sudo wget https://github.com/neovim/neovim/archive/refs/tags/v0.6.1.tar.gz tar -xzvf v0.6.1.tar.gz cd neovim-0.6.1 make CMAKE_BUILD_TYPE=Release sudo make install
-
Windows
scoop install ripgrep scoop install fd
-
Ubuntu
sudo apt install ripgrep sudo apt install fd-find
-
Windows
scoop install llvm
scoop install Python pip install cmake-language-server
- 需要使用
Developer Command Prompt for VS
中执行以下命令
git clone https://github.com/llvm/llvm-project.git cd llvm-project cmake -Hllvm -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PROJECTS=clang ninja -C Release clangFormat clangFrontendTool clangIndex clangTooling clang git clone --depth=1 --recursive https://github.com/MaskRay/ccls cd ccls cmake -H. -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=cl -DCMAKE_PREFIX_PATH="llvm-project/Release" ninja -C Release
- 增加
ccls\Release
到环境变量Path
中
- 需要使用
-
Ubuntu
sudo apt install clang-12 sudo apt install clangd-12
pip install cmake-language-server
apt install ccls
Lua
语言LSP
依赖库sumneko_Lua
Windows
- Install ninja
scoop install ninja
- Clone project
mkdir (system disk):\Users\(you user name)\AppData\Local\nvim-data\lsp\ cd (system disk):\Users\(you user name)\AppData\Local\nvim-data\lsp\ git clone https://github.com/sumneko/lua-language-server cd lua-language-server git submodule update --init --recursive
- Build
cd 3rd\luamake compile\install.bat cd ..\.. 3rd\luamake\luamake.exe rebuild
Ubuntu
- Install ninja
sudo apt install ninja-build
- Clone project
mkdir -p ~/.local/share/nvim/lsp/ cd ~/.local/share/nvim/lsp/ git clone https://github.com/sumneko/lua-language-server cd lua-language-server git submodule update --init --recursive
- Build
cd 3rd/luamake ./compile/install.sh cd ../.. ./3rd/luamake/luamake rebuild
-
Windows
git clone https://github.com/iPengBo/nvim-TE.git (system disk):\Users\(you user name)\AppData\Local\nvim
-
Ubuntu
git clone https://github.com/iPengBo/nvim-TE.git ~/.config/nvim
按键 | 模式 | 功能 | 来源插件 |
---|---|---|---|
<A-h> | insert | 插入模式左移光标 | neovim |
<A-l> | insert | 插入模式右移光标 | neovim |
<A-k> | insert | 插入模式上移一行 | neovim |
<A-j> | insert | 插入模式下移一行 | neovim |
<A-d> | insert | 插入模式删除 | neovim |
<C-u> | insert | 插入模式向上移动半页 | neovim |
<C-d> | insert | 插入模式向下移动半页 | neovim |
<C-s> | normal,insert | 保存文件 | neovim |
<C-h> | normal,insert | 插入模式移动光标至行首 | neovim |
<C-l> | normal,insert | 插入模式移动光标至行尾 | neovim |
<leader>h | normal | c/c++头文件源文件切换 | lspconfig |
gd | normal | 转到定义 | lspconfig |
gs | normal | 转到声名 | lspconfig |
gt | normal | 转到类型定义 | lspconfig |
gr | normal | 转到引用 | lspconfig |
gi | normal | 转到实现 | lspconfig |
K | normal | 显示悬停文档 | lspconfig |
<space>f | normal | 自动格式化 | lspconfig |
gh | normal | 查找光标词定义和引用 | lspsaga |
[e | normal | 转到前一个诊断提示 | lspsaga |
]e | normal | 转到下一个诊断提示 | lspsaga |
<C-t> | normal,tnoremap | 悬浮终端 | lspsaga |
<leader>pd | normal | 预览定义 | lspsaga |
<leader>rf | normal | 重命名 | lspsaga |
]] | normal,visual | 移动至下一个函数开始行 | treesitter-textobjects |
][ | normal,visual | 移动至下一个函数结束行 | treesitter-textobjects |
[[ | normal,visual | 移动至上一个函数开始行 | treesitter-textobjects |
[] | normal,visual | 移动至上一个函数结束行 | treesitter-textobjects |
]m | normal,visual | 移动至下一个类开始行 | treesitter-textobjects |
]n | normal,visual | 移动至下一个类结束行 | treesitter-textobjects |
[m | normal,visual | 移动至上一个类开始行 | treesitter-textobjects |
[n | normal,visual | 移动至上一个类结束行 | treesitter-textobjects |
af | select | 选择整个函数 | treesitter-textobjects |
if | select | 只选择函数内部实现 | treesitter-textobjects |
ac | select | 选择整个类 | treesitter-textobjects |
ic | select | 只选择类内部实现 | treesitter-textobjects |
<C-n> | normal | 开关文件浏览器 | nvim-tree |
v | nvim-tree action | vsplit方式打开 | nvim-tree |
<C-x> | nvim-tree action | split方式打开 | nvim-tree |
<Tab> | nvim-tree action | 预览 | nvim-tree |
<BS> | nvim-tree action | 关闭文件夹 | nvim-tree |
R | nvim-tree action | 刷新 | nvim-tree |
a | nvim-tree action | 创建 | nvim-tree |
d | nvim-tree action | 删除 | nvim-tree |
r | nvim-tree action | 重命名 | nvim-tree |
x | nvim-tree action | 剪切 | nvim-tree |
c | nvim-tree action | 拷贝 | nvim-tree |
p | nvim-tree action | 粘贴 | nvim-tree |
y | nvim-tree action | 拷贝名称 | nvim-tree |
q | nvim-tree action | 关闭 | nvim-tree |
[b | normal | 下一个标签页 | bufferline |
b] | normal | 上一个标签页 | bufferline |
gb | normal | 激活标签页切换选取功能 | bufferline |
bd | normal | 激活标签页关闭选取功能 | bufferline |
bh | normal | 关材左侧标签页 | bufferline |
bl | normal | 关材右侧标签页 | bufferline |
<A-(1-9)> | normal | 按序号顺序切换标签页 | bufferline |
<leader>xx | normal | 激活诊断列表 | trouble |
<leader>xd | normal | 关闭诊断列表 | bufferline |
<leader>xr | normal | 刷新诊断列表 | bufferline |
<leader>fb | normal | 列出当前neovim实例中打开的缓冲区 | telescope |
<leader>ff | normal | 列出当前工作目录中的文件 | telescope |
<leader>fg | normal | 在当前工作目录中搜索字符串 | telescope |
<leader>fh | normal | 列出可用的帮助标签 | telescope |
<C-p> | nvim-cmp action | 选择上一个 | nvim-cmp |
<C-n> | nvim-cmp action | 选择下一个 | nvim-cmp |
<C-b> | nvim-cmp action | 前上滚动文档 | nvim-cmp |
<C-f> | nvim-cmp action | 前后下动文档 | nvim-cmp |
<C-y> | nvim-cmp action | 完成 | nvim-cmp |
<C-e> | nvim-cmp action | 关闭 | nvim-cmp |
<CR> | nvim-cmp action | 确认 | nvim-cmp |
<C-j> | nvim-cmp action | 跳下一个 | nvim-cmp |
<C-k> | nvim-cmp action | 跳上一个 | nvim-cmp |
m | normal,visual | 代码注释 | nvim-comment |
<A-m> | insert | 代码注释 | nvim-comment |
jk | insert | 退出插入模式 | better-escape |
- 使用代理进行访问,如下
git clone https://github.com/iPengBo/nvim-TE.git
修改为
git clone https://mirror.ghproxy.com/https://github.com/iPengBo/nvim-TE.git
- 将
git clone
到本地的nvim-TE
中的init.lua
,解开以下注释代码
proxyMirror.proxyURL = "https://mirror.ghproxy.com/"
packer.nvim
- 功能:
neovim
插件/软件包的管理工具- 地址:
wbthomason/packer.nvim
nvim-lspconfig
- 功能:
neovim
内置语言服务客户端- 地址:
neovim/nvim-lspconfig
lsp_signature.nvim
- 功能:显示函数信息的浮动窗口
- 地址:
ray-x/lsp_signature.nvim
- 需要:
nvim-lspconfig
lspsaga.nvim
功能:一个轻量级、高性能的的LSP UI
插件地址:glepnir/lspsaga.nvim
需要:nvim-lspconfig
lspsaga.nvim
- 功能:一个轻量级、高性能的的
LSP UI
插件- 地址:
tami5/lspsaga.nvim
- 需要:
nvim-lspconfig
nvim-treesitter
- 功能:语法高亮插件
- 地址:
nvim-treesitter/nvim-treesitter
nvim-treesitter-textobjects
- 功能:文本对象的选择及移动(支持函数及类方式)
- 地址:
nvim-treesitter/nvim-treesitter-textobjects
- 需要:
nvim-treesitter
nvim-treesitter-context
- 功能:在上下文窗口中,显示正在查看的函数、类、方法
- 地址:
romgrk/nvim-treesitter-context
- 需要:
nvim-treesitter
vim-matchup
- 功能:高亮显示、导航及操作符的文本匹配
- 地址:
andymass/vim-matchup
- 需要:
nvim-treesitter
nvim-web-devicnos
- 功能:图标及颜色
- 地址:
kyazdani42/nvim-web-devicons
lualine.nvim
- 功能:状态行
- 地址:
nvim-lualine/lualine.nvim
- 需要:
nvim-web-devicons
,nvim-gps
nvim-tree.lua
- 功能:文件浏览器
- 地址:
kyazdani42/nvim-tree.lua
- 需要:
nvim-web-devicons
bufferline.nvim
- 功能:标签页
- 地址:
akinsho/bufferline.nvim
- 需要:
nvim-web-devicons
trouble.nvim
- 功能:用于显示诊断结果列表
- 地址:
folke/trouble.nvim
- 需要:
nvim-web-devicons
telescope.nvim
- 功能:文件模糊搜索
- 地址:
nvim-telescope/telescope.nvim
- 需要:
nvim-lua/plenary.nvim
,nvim-telescope/telescope-fzy-native.nvim
- 依赖库:
ripgrep
,fd
LuaSnip
- 功能:代码段引擎
- 地址:
L3L3MON4D3/LuaSnip
- 需要:
rafamadriz/friendly-snippets
nvim-cmp
nvim-autopairs
- 功能:自动配对
- 地址:
windwp/nvim-autopairs
- 需要:
nvim-cmp
nvim_comment
- 功能:代码注释
- 地址:
terrortylor/nvim-comment
indent-blankline.nvim
- 功能:缩进显示
- 地址:
lukas-reineke/indent-blankline.nvim
better-escape.nvim
- 功能:插入模式退出
Esc
映射至jk
- 地址:
max397574/better-escape.nvim
lsp-colors.nvim
- 功能:补充配色
- 地址:
folke/lsp-colors.nvim
sonokai
- 功能:主题
- 地址:
sainnhe/sonokai
encode
encoding
内部使用的编码方式filenecoding
多行文本的文件编码file
backup
覆盖文件时保留备份文件swapfile
缓冲区是否使用交换文件autoread
在Vim
之外改动时会自动重读文件autowrite
使切换文件时,修改的文件被自动保存cursor line
cursorline
高亮光标所在屏幕行relativenumber
每行前显示相对行号number
行前显示行号scrolloff
光标上下的最少行数sidesrolloff
光标左右最少出现列数tab
expandtab
键入<Tab>
时使用空格shiftwidth
自动缩进使用的步进空格数tabstop
<Tab>
在文件中使用的空格数smarttab
插入<Tab>
时使用shiftwidth
search
ignorecase
搜索模式时忽略大小写insearch
输入搜索模式时同时高亮部份的匹配wrapscan
搜索在文件尾折回文件头ui
showmode
在状态行上显示当前模式showtagline
是否显示标签页行showcmd
在状态行里显示命令splitbelow
分割窗口时新窗口在当前窗口之下splitright
新窗口在肖前窗口之右pumheight
弹出窗口的最大高度foldenable
显示所用打开的折叠foldmethod
折叠类型foldexpr
折叠表达式other
backspace
退格键的处理模式completeopt
插入补全使用的选项conceallevel
是否显示可隐藏文本history
记住的命令行的行数smartcase
模式中有大写字母时不忽略大小写smartindent
智能缩进clipboard
使用剪切板mouse
允许使用鼠标redrawtime
在hlsearch
和match
时高亮超时timeout
映射和键盘代码等待超时timeoutlen
超时时间timeout
映射等待超时ttimeoutlen
键盘代码超时时间wildignorecase
匹配文件名时忽略大小写wrap
长行回绕并在下一行继续
在lua/pluginList.lua
中增加扩展插件配置
- 在
lua/languageServer/
目录下可增加对应所需的扩展语言服务。 - 在
lua/languageConfig.lua
中的setup
方法中加入扩展语言服务设置,在list
方法中加入需nvim-treesitter
安装的扩展语言。