Skip to content

Josean Martinez's Neovim Setup in 2024

这个 Neovim 配置是我当前使用最多的版本,基于 Josean Martinez 的 YouTube 视频,一步一步,照虎画猫,依葫芦画瓢。

全部的配置使用 Lua 语言,所以新手需要学习一点点 Lua 的编程知识。

在 Neovim 中使用 Lua

配置结构

因为是最常用的配置版本,所以配置文件放置在 ~/AppData/Local/nvim/ 内。其他的 Neovim 配置版本则放置在以 nvim- 为前缀名称的不同文件夹内。以下是配置结构:

~/AppData/Local/nvim/
│   init.lua
│   lazy-lock.json
└───lua
    └───alowree
        │   lazy.lua
        ├───core
        │       init.lua
        │       keymaps.lua
        │       options.lua
        └───plugins
            │   alpha.lua
            │   auto-session.lua
            │   autopairs.lua
            │   bufferline.lua
            │   bullets.lua
            │   colorscheme.lua
            │   comment.lua
            │   dressing.lua
            │   formatting.lua
            │   gitsigns.lua
            │   indent-blankline.lua
            │   init.lua
            │   lazygit.lua
            │   linting.lua
            │   live-preview.lua
            │   lualine.lua
            │   nvim-cmp.lua
            │   nvim-tree.lua
            │   surround.lua
            │   telescope.lua
            │   todo-comments.lua
            │   treesitter.lua
            │   trouble.lua
            │   vim-maximizer.lua
            │   which-key.lua
            └───lsp
                    lspconfig.lua
                    mason.lua
  1. init.lua is the main entry file, which leads two modules:
    lua
    require("alowree.core")
    require("alowree.lazy")
  2. alowree/lazy.lua does 2 things a. loads lazy itself b. loads alowree.plugins
  3. alowree/core/init.lua combines 2 submodules keymaps.lua and options.lua
  4. alowree/plugins/init.lua, why are these codes needed?
    lua
    return {
    "nvim-lua/plenary.nvim", -- lua functions that many plugins use
    "christoomey/vim-tmux-navigator", -- tmux & split window navigation
                                     -- works for PowerShell on Windows too
    }