Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Spacevim | 19,705 | 6 hours ago | 1 | July 02, 2022 | 34 | gpl-3.0 | Lua | |||
A community-driven modular vim/neovim distribution - The ultimate vimrc | ||||||||||
Nvchad | 15,460 | 8 hours ago | 2 | August 19, 2021 | 1 | gpl-3.0 | Lua | |||
An attempt to make neovim cli functional like an IDE while being very beautiful, blazing fast startuptime | ||||||||||
Lunarvim | 13,687 | 6 hours ago | 76 | gpl-3.0 | Lua | |||||
🌙 LunarVim is an IDE layer for Neovim. Completely free and community driven. | ||||||||||
Oni | 11,477 | 1 | 3 years ago | 6 | April 02, 2017 | 518 | mit | TypeScript | ||
Oni: Modern Modal Editing - powered by Neovim | ||||||||||
Astronvim | 8,205 | 5 hours ago | 3 | gpl-3.0 | Lua | |||||
AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins | ||||||||||
Haskell Ide Engine | 2,435 | 2 years ago | 302 | other | Haskell | |||||
The engine for haskell ide-integration. Not an IDE | ||||||||||
Goneovim | 2,032 | 3 hours ago | 51 | June 21, 2022 | 93 | mit | Go | |||
A GUI frontend for neovim. | ||||||||||
Vim Config | 1,672 | 18 days ago | 35 | Vim Script | ||||||
Lean mean Neovim machine, carefully crafted with :heart: Use with latest Neovim. | ||||||||||
Solidoak | 894 | 6 years ago | 17 | unlicense | Rust | |||||
An IDE for Rust | ||||||||||
Codeium.vim | 872 | 4 days ago | 6 | mit | Vim Script | |||||
Free, ultrafast Copilot alternative for Vim and Neovim |
自从 NeoVim 支持LSP并转用Lua作为首席插件语言代替又丑又慢 VimL 后,使用体验直接翻倍。 LunarVim就是基于全新 Neovim Lua 生态打造的配置集合,旨在将 Neovim 打造成高性能的 IDE。迁移到 LunarVim 后,nvim 的启动时间也大幅降低。
这个项目其实做了过多的适用于我个人的定制化,同时因为上游总是提交不兼容更新而我维护也不是很及时,所以其实本仓库更大的价值是用来学习和摘抄。
首先你需要安装LunarVim
官方的安装脚本会提示你是否需要自动安装依赖,可能会有如下问题:
记得挂梯子 (✿◡‿◡)
记得设置 npm 的 prefix 以设置可访问的全局安装路径
npm config set perfix ~/.local
你可能需要将 ~/.cargo/bin 加入你的环境变量PATH
然后,安装本配置:
# backup original config
mv ~/.config/lvim{,.bak}
# install my config
git clone https://github.com/mrbeardad/MyLunarVim ~/.config/lvim
# install all plugins
lvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
lvim
是 LunarVim 官方提供的启动脚本,可以与原来的配置隔离开来。
lvim/
config.lua 配置入口和一些LunarVim内建配置
lua/user/
plugin.lua 插件加载
keybinding.lua 快捷键定义
neovim.lua neovim原生配置
alpha.lua alpha启动页面配置,包含大量字符画
statusline.lua lualine状态栏配置
treesitter.lua treesitter相关配置
setup/ 在插件加载前的插件配置
config/ 在插件加载后的插件配置
有两个颜色主题,catppuccin和tokyonight,根据启动时间选择其中一款加载。
左边:
右边:
\n
还是\r\n
)总之插件列表都在lua/user/plugin.lua
中,也分了类,你可以浏览并尝试修改。
搭建一个语言的开发环境,你需要什么?
最初由微软提议的语言服务协议(LSP)现在可谓百花齐放,它运行在后台解析代码符号并指导客户端编辑器的行为: 代码补全,语法提示,代码格式化,类型提示,文档提示,代码导航,符号搜索,重构等等功能.
现在 Neovim 已内建支持 LSP,不再像以前那样,有许多配置提供都能提供以上功能,要想获取结果就要针对每个插件都做适配. Neovim 内建 LSP 后提供了同一接口获取有关信息,极大方便了插件生态发展.
相关插件:
提示: 快捷键
Space L i
或命令:LvimInfo
可查看当前语言服务信息
LunarVim 默认当你打开文件时自动下载对应 Language Server,你可能有如下情景:
有些时候自动安装会有问题,可尝试手动安装:LspInstall <language server>
查看一下报错信息.(按 Tab 会自动补全 language server)
对于某种语言换用非默认 lanuage server,以 python 为例
在 config.lua 中添加,
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers,{ "pyright" }) -- 关闭默认的pyright
保存执行:LvimCacheReset
重置原有 language server 配置缓存
在~/.config/lvim/after/ftplugin/python.lua 中添加:(文件不存在则手动创建)
require("lvim.lsp.manager").setup("jedi_language_server")
修改 language server 启动参数等,执行:LspSettings <language server>
(Tab 补全),这会以 json 格式编写配置,示例见(安装 jsonls 可有自动补全功能哦)
静态分析器可以为你的代码提供额外的提醒警告,例如指出某些代码风格的问题,以及一些常见的 bug. 大多数语言服务提供的语法警告功能并不强大,也仅仅是语法级别的错误提示,所以才需要额外的静态解析器.
LunarVim 默认均未启动 Linter 与 Formatter,创建~/.config/lvim/after/ftplugin/<lang_type>.lua
,并添加启动代码即可,示例可见LunarVim.
你可以执行:NulllsInfo
查看当前文件类型对应可用的 Linter 和 Formatter
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
{ command = "black" },
{
command = "prettier",
args = { "--print-width","100" },
filetypes = { "typescript","typescriptreact" },
},
}
local linters = require "lvim.lsp.null-ls.linters"
linters.setup {
{ command = "flake8" },
{
command = "shellcheck",
args = { "--severity","warning" },
},
{
command = "codespell",
filetypes = { "javascript","python" },
},
}
local code_actions = require "lvim.lsp.null-ls.code_actions"
code_actions.setup {
{
command = "proselint"
},
}
代码格式化工具,一些 Language Server 并未内置格式化功能,此时需要借助外部工具. 配置同上Linter
良好的语法高亮可以让我们的代码看起来更舒服,让我们更容易区分语句,函数,变量等.
nvim-treesitter为此而生,它会对代码进行语法解析,高亮更加精准.
在 lua/user/treesitter.lua
中设置添加你的语言:
-- 默认配置
lvim.builtin.treesitter.ensure_installed = {
"bash",
"vim",
"lua",
"c",
"make",
"cpp",
"cmake",
"go",
"gomod",
"python",
"javascript",
"typescript",
"tsx",
"http",
"html",
"css",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"comment",
"regex",
"dockerfile",
}
快捷键几乎与我的 VSCode 配置相同,为了在终端中使用 ctrl+shift 开头的按键,以及区分 Tab 和 Ctrl+i,我重映射了我的终端按键。
我的 Windows Terminal 部分配置
"actions": [
{
"keys": "ctrl+shift+f",
"command": {
"action": "sendInput",
"input": "\u001b[70;6u"
}
},
{
"keys": "ctrl+shift+h",
"command": {
"action": "sendInput",
"input": "\u001b[72;6u"
}
},
{
"keys": "ctrl+alt+enter",
"command": {
"action": "sendInput",
"input": "\u001b[13;7u"
}
},
{
"keys": "ctrl+i",
"command": {
"action": "sendInput",
"input": "\u001bI"
}
},
{
"keys": "ctrl+shift+j",
"command": {
"action": "sendInput",
"input": "\u001b[74;6u"
}
},
{
"keys": "ctrl+shift+k",
"command": {
"action": "sendInput",
"input": "\u001b[75;6u"
}
},
{
"keys": "ctrl+shift+l",
"command": {
"action": "sendInput",
"input": "\u001b[76;6u"
}
},
{
"keys": "ctrl+shift+s",
"command": {
"action": "sendInput",
"input": "\u001b[83;6u"
}
},
{
"keys": "ctrl+shift+e",
"command": {
"action": "sendInput",
"input": "\u001b[69;6u"
}
},
{
"keys": "ctrl+shift+o",
"command": {
"action": "sendInput",
"input": "\u001b[79;6u"
}
},
{
"keys": "ctrl+shift+t",
"command": {
"action": "sendInput",
"input": "\u001b[84;6u"
}
},
{
"keys": "ctrl+shift+m",
"command": {
"action": "sendInput",
"input": "\u001b[77;6u"
}
},
{
"keys": "ctrl+shift+p",
"command": {
"action": "sendInput",
"input": "\u001b[80;6u"
}
}
],
如果你也使用 tmux,需要添加以下配置:
# ----------------------------=== General ===--------------------------
set -g default-terminal "screen-256color"
if 'infocmp -x tmux-256color > /dev/null 2>&1' 'set -g default-terminal "tmux-256color"'
# true color support
set -ga terminal-overrides ",*256color:RGB"
# undercurl support
set -ga terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# underscore colours support
set -ga terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# cursor style support
set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[1 q'
set -g extended-keys always # enable extended keys in escape sequence, for example, ctrl+shift+letter
set -g escape-time 10
set -g focus-events on
set -g mouse on
set -g set-clipboard on
set -g mode-keys vi