0. 安装nodejs最新版本
1. 安装neovim,根据链接安装最新版本
2.安装基本的配置模板NvChad
https://github.com/NvChad/NvChadhttps://github.com/NvChad/NvChad
3.定制自己的快捷键和插件
-- Just an example, supposed to be placed in /lua/custom/
local M = {}
-- make sure you maintain the structure of `core/default_config.lua` here,
-- example of changing theme:
M.ui = {
theme = "onedark",
}
M.plugins = {
user = {
["nvim-treesitter/nvim-treesitter"] = {},
["mattn/webapi-vim"] = {},
["mattn/vim-gist"] = {
after = "webapi-vim",
},
["neovim/nvim-lspconfig"] = {
config = function()
require "plugins.configs.lspconfig"
require "custom.plugins.lspconfig"
end,
},
}
}
M.mappings = require "custom.mappings"
return M
快捷键
- lua/custom/mappings
local M = {}
-- add this table only when you want to disable default keys
M.disabled = {
n = {
--["<leader>h"] = "",
--["<C-s>"] = ""
}
}
M.general = {
i = {
-- more keys!
["jj"] = { "<Esc>", "exit insert mode" },
}
}
return M
lsp 相关配置:MasonInstall 相关的lsp server
-- custom.plugins.lspconfig
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities
--require("plugins.configs.lspconfig").luau_lsp.setup{}
local lspconfig = require "lspconfig"
local servers = { "html",
"cssls",
"clangd",
"pyright",
"luau_lsp",
"cmake",
"bashls",
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
4.注意事项
4.1配置python lsp相关,其中python-type-stubs下载自microsoft stubs github
在項目根目錄下增加pyrightconfig.json文件,內容如下:
{
"stubPath": "xxx/python-type-stubs","reportMissingImports": true,
"reportMissingTypeStubs": false,"pythonPlatform": "Linux"
}
4.2如果同时安装有coc-nvim相关的插件的话,CocConfig中设置
{
"clangd.enabled":false,
"pyright.enable":false
}