π An out-of-the-box Neovim IDE solution that setup development environment in an incredibly simple way.
MIT License
An out-of-the-box Neovim IDE layer that configures the development environment in an incredibly simple way. For example, to configure golang
, just:
require("insis").setup({
golang = {
enable = true,
lsp = "gopls",
linter = "golangci-lint",
formatter = "gofmt",
format_on_save = true,
},
})
After saving and restarting with :wq
, syntax highlighting, Golang Language Server, Linter, Formatter, etc., will be automatically installed.
https://github.com/nshen/InsisVim/assets/181506/ad36e1b1-05f6-47e9-bf2e-6738f539ccce
If the following common command-line tools are missing, git
, wget
, curl
, ripgrep
, nvim v0.9.x
, the installation may fail.
brew install
to install these tools.If you have previously installed other configurations, it is recommended to delete or back up the following directories:
~/.local/share/nvim
~/.cache/nvim
~/.config/nvim
git clone https://github.com/nshen/InsisVim.git ~/.config/nvim
Run nvim
and wait for all plugins to be installed
Restart
Custom configuration is very simple, just like configuring a plugin. You only need to modify ~/.config/nvim/init.lua
and save and restart.
require("insis").setup({
-- Set parameters as needed
})
The supported parameters are numerous, but they are basically divided into common configurations and programming environment configurations.
For example, to set the theme with colorscheme
, modify and save with :wq
to take effect.
require("insis").setup({
colorscheme = "tokyonight"
})
InsisVim uses the
tokyonight
theme by default and also includesnord
,onedark
,gruvbox
,nightfox
,nordfox
,duskfox
, anddracula
themes. You can preview the built-in themes with the:InsisColorPreview
command.
https://github.com/nshen/InsisVim/assets/181506/15517b20-acdf-45eb-9db6-9a0d0806cb4a
require("insis").setup({
cmp = {
-- Enable copilot completion for cmp
copilot = true,
},
})
InsisVim includes the following plugins, which will be activated upon enabling:
Since Copilot is a paid service, you need to run :Copilot auth
for authentication before it takes effect. However, if you are a student, teacher, or open-source project contributor, you can apply for free usage.
GitHub Copilot is free to use for verified students, teachers, and maintainers of popular open-source projects.
To enable Copilot Chat
and interact with your code:
copilot_chat = {
enable = true,
keys = {
-- Quick chat with your selection code
quick_chat = "<leader>cc",
-- Code Prompt to list various predefined prompts, such as explaining code, refactoring code, adding documentation, etc.
prompt_actions = "<leader>cp",
-- Code Help to fix selected errors
help_actions = "<leader>ch",
},
},
require("insis").setup({
cmp = {
-- Enable codeium completion for cmp
codeium = true,
},
})
InsisVim includes Codeium.nvim, which will be activated upon enabling.
You need to run :Codeium Auth
for authentication before it takes effect.
In the Vim world, a Buffer represents a file loaded into memory. It is very similar to Tabs in VSCode. When you see a tab in VSCode, it means a file is loaded into memory.
In InsisVim, the bufferline.nvim plugin is used to simulate this behavior, and the configuration is simplified, making it very easy to customize key bindings.
https://github.com/nshen/InsisVim/assets/181506/a639f05b-adab-4279-8482-e3088d2fae8f
require("insis").setup({
bufferLine = {
enable = true,
keys = {
-- left / right cycle
prev = "<C-h>",
next = "<C-l>",
-- close current buffer
close = "<C-w>",
-- close = "<leader>bc",
-- close all left / right tabs
close_left = "<leader>bh",
close_right = "<leader>bl",
-- close all other tabs
close_others = "<leader>bo",
close_pick = "<leader>bp",
},
},
})
Unlike VSCode, a Window in Vim is just a window displaying a Buffer, allowing multiple windows to simultaneously display or even modify a Buffer. In InsisVim, you can easily define a series of window-related shortcuts, including horizontal and vertical splits, quick window jumps, closing, etc., called Super Windows.
require("insis").setup({
s_windows = {
enable = true,
keys = {
split_vertically = "sv",
split_horizontally = "sh",
-- close current
close = "sc",
-- close others
close_others = "so",
-- jump between windows
jump_left = { "<A-h>", "<leader>h" },
jump_right = { "<A-l>", "<leader>l" },
jump_up = { "<A-k>", "<leader>k" },
jump_down = { "<A-j>", "<leader>j" },
-- control windows size
width_decrease = "s,",
width_increase = "s.",
height_decrease = "sj",
height_increase = "sk",
size_equal = "s=",
},
},
})
A Tab in Vim is used to save a combination of one or more windows, allowing you to switch to different Tabs without changing the window layout, using different window layouts for different tasks.
In InsisVim, you can also quickly define a set of tab-related shortcuts, called Super Tab.
Note that super tab is not commonly used, so it is disabled by default and needs to be manually enabled.
require("insis").setup({
s_tab = {
enable = true, -- Disabled by default
keys = {
split = "ts",
prev = "th",
next = "tl",
first = "tj",
last = "tk",
close = "tc",
},
},
})
In short, the relationship between Buffers, Windows, and Tabs is as follows:
For example, the Golang
environment. After setting enable
to true and saving and restarting with :wq
, Mason will automatically install the corresponding syntax highlighting, Language Server, Linter, Formatter, etc. After installation, restart and open the corresponding Golang project to take effect.
require("insis").setup({
colorscheme = "tokyonight"
golang = {
enable = true,
},
})
Enabling other language-related modules is similar. Modify ~/.config/nvim/init.lua
, save and restart to automatically complete the installation.
Since enabling the programming environment requires additional installation of LSP, Linter, Formatter, syntax highlighting, etc., by default, programming environment configurations are disabled and need to be manually enabled. Only Lua
is enabled by default because you will often use the Lua
language to modify configurations. Most common configurations are enabled by default.
The complete default parameter list is here config.lua
Enable language environment-related modules one by one, otherwise, restarting will install many services at once, requiring a long wait.
require("insis").setup({
json = {
enable = true,
-- The following are default values and can be omitted
lsp = "jsonls",
---@type "jsonls" | "prettier"
formatter = "jsonls",
format_on_save = false,
indent = 2,
}
})
After enabling json
and restarting:
require("insis").setup({
markdown = {
enable = true,
-- The following are default values and can be omitted
mkdnflow = {
next_link = "gn",
prev_link = "gp",
next_heading = "gj",
prev_heading = "gk",
-- Follow link
follow_link = "gd",
-- Go back from link
go_back = "<C-o>",
toggle_item = "tt",
},
formatter = "prettier",
-- Format on save is false by default
format_on_save = false,
-- Wrap text at the edge by default
wrap = true,
---:MarkdownPreview command opens article preview with dark theme by default
---@type "dark" | "light"
theme = "dark",
},
})
After enabling markdown and restarting, Treesitter's markdown syntax highlighting and prettier for formatting will be automatically installed.
Adds the :MarkdownPreview
command for real-time preview of markdown files.
Adds mkdnflow.nvim
related shortcuts.
Adds markdown-related shortcuts such as 5x5table
.
Frontend development configuration is relatively complex because it requires installing multiple LSPs, various file syntax highlighting, etc. Restarting will take a long time.
require("insis").setup({
frontend = {
enable = true,
---@type "eslint" | false
linter = "eslint", -- :EslintFixAll command added
---@type false | "prettier" | "ts_ls"
formatter = "ts_ls",
format_on_save = false,
indent = 4,
cspell = false,
tailwindcss = true,
prisma = false,
-- vue will take over typescript lsp
vue = false,
},
})
require("insis").setup({
solidity = {
enable = true,
--linter can be sohint or false
linter = "solhint",
format_on_save = true,
indent = 4,
},
})
When enable
is set to true
and restarted, the following will be installed:
solidity
require("insis").setup({
golang = {
enable = true,
-- The following are default values and can be omitted
lsp = "gopls",
linter = "golangci-lint",
formatter = "gofmt",
format_on_save = false,
indent = 4,
},
})
require("insis").setup({
clangd = {
enable = true,
lsp = "clangd",
-- linter = "clangd-tidy",
formatter = "clang-format",
format_on_save = false,
indent = 4,
},
})
require("insis").setup({
bash = {
enable = true,
lsp = "bashls",
-- brew install shfmt
formatter = "shfmt",
format_on_save = false,
indent = 4,
},
})
require("insis").setup({
python = {
enable = true,
-- can be pylsp or pyright
lsp = "pylsp",
-- pip install black
-- asdf reshim python
formatter = "black",
format_on_save = false,
indent = 4,
},
})
require("insis").setup({
ruby = {
enable = true,
lsp = "ruby_ls",
-- gem install rubocop
formatter = "rubocop",
format_on_save = false,
indent = 2,
},
})
require("insis").setup({
docker = {
enable = true,
lsp = "dockerls",
indent = 2,
},
})
:Lazy restore
to update all plugins to the stable versions locked in lazy-lock.json
:Lazy update
to update all plugins to the latest versions, compatibility not guaranteed:Notifications
:messages
:LspInfo
to view running status:Mason
for installation and updates:TSUpdate
to update all:TSUpdate <json>
to update individually:MarkdownPreview
Fold Shortcuts | Description |
---|---|
zc | Close fold |
zo | Open fold |
za | Toggle fold |
zM | Close all folds |
zR | Open all folds |
Updating...
If you have questions, please contect me.
How to extend
TODO
MIT
WIP π‘, PR is welcome.