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.
install.mp4
-
If the following common command-line tools are missing,
git
,wget
,curl
,ripgrep
,nvim v0.9.x
, the installation may fail.- On Mac, you can use
brew install
to install these tools. - On Ubuntu, you can check the Ubuntu Installation Guide.
- On Mac, you can use
-
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
- A scientific network environment is required. It is recommended to enable global/enhanced mode, etc. If you encounter network issues, you can discuss them here.
- Clone this project to the Neovim configuration directory
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.
colorscheme.mp4
Copilot Configuration
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",
},
},
Codeium Configuration
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.
bufferline.mp4
Bufferline Configuration
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.
Super Windows Configuration
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.
Super Tab Configuration
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:
- A buffer is a file loaded into memory. We use the bufferline plugin to simulate the behavior of VSCode's tabs.
- A window displays a buffer. Familiarity with quick window splits and shortcuts for jumping between windows is key to improving development efficiency.
- A tab organizes window layouts. It is usually not needed, so it is disabled by default.
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.
JSON Editing
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:
- Treesitter's JSON syntax highlighting will be automatically installed.
- The jsonls Language Server will be automatically installed and configured.
Markdown Editing
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
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,
},
})
Solidity Development
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:
- TreeSitter syntax highlighting:
solidity
- Language Server: nomicfoundation-solidity-language-server
- Code snippets: solidity snippets
- If a linter is set, sohint will be automatically downloaded and started.
Golang Development
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,
},
})
Clangd Development
require("insis").setup({
clangd = {
enable = true,
lsp = "clangd",
-- linter = "clangd-tidy",
formatter = "clang-format",
format_on_save = false,
indent = 4,
},
})
Bash Development
require("insis").setup({
bash = {
enable = true,
lsp = "bashls",
-- brew install shfmt
formatter = "shfmt",
format_on_save = false,
indent = 4,
},
})
Python Development
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,
},
})
Ruby Development
require("insis").setup({
ruby = {
enable = true,
lsp = "ruby_ls",
-- gem install rubocop
formatter = "rubocop",
format_on_save = false,
indent = 2,
},
})
Docker Development
require("insis").setup({
docker = {
enable = true,
lsp = "dockerls",
indent = 2,
},
})
- Update plugins:
:Lazy restore
to update all plugins to the stable versions locked inlazy-lock.json
:Lazy update
to update all plugins to the latest versions, compatibility not guaranteed
- View error messages:
:Notifications
:messages
- View/install LSP:
:LspInfo
to view running status:Mason
for installation and updates
- Update syntax highlighting:
:TSUpdate
to update all:TSUpdate <json>
to update individually
- Markdown preview:
: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
- Neovim v0.9.x.
- Nerd Fonts.
MIT
WIP 🟡, PR is welcome.