neovim安装配置

0. 安装nodejs最新版本

Installing Node.js via package manager | Node.jsNode.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.https://nodejs.org/en/download/package-manager/#nvm

1. 安装neovim,根据链接安装最新版本

Release Nvim v0.7.2 · neovim/neovim · GitHubVim-fork focused on extensibility and usability. Contribute to neovim/neovim development by creating an account on GitHub.https://github.com/neovim/neovim/releases/tag/v0.7.2

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

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值