GNU General Public License v3.0

项目介绍

brainfucksec/neovim-lua 是一个托管在 GitHub 上的开源项目,主要使用 Lua 编写,采用 GNU General Public License v3.0 许可证,目前获得 829 个 Star、111 次 Fork。

仓库全名
brainfucksec/neovim-lua
开源许可证
GNU General Public License v3.0
Star 数
829
Fork 数
111

README 摘要

Neovim KISS configuration with Lua and LSP Table of Contents Plugins Directory Tree Files and Settings Installation LSP Configuration Appearance Keymaps Configuration Check Screenshots Guides and Resources Other Neovim Lua Project Lua Resources Disclaimer Thanks to Plugins lualine.nvim - A blazing fast and easy to configure neovim statusline plugin written in pure lua. nvim-lspconfig - A collection of common…

完整内容见 GitHub 原始 README 或本页 。

常见问题

neovim-lua 用什么语言开发?

主要使用 Lua 编写,采用 GNU General Public License v3.0 许可证,目前有 829 个 Star。

neovim-lua 可以免费商用吗?

仓库标注的许可证为 GNU General Public License v3.0,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 neovim-lua 的源码?

可以直接克隆仓库:git clone https://github.com/brainfucksec/neovim-lua.git,默认分支为 main;安装与运行步骤见仓库 README。

neovim-lua 最近还在维护吗?

仓库最近一次更新为 9月26日,当前没有未关闭的 Issue;Star 数为 829,可作为社区活跃度的参考。

关于

Neovim KISS configuration with Lua

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
1066
价值分
532
活跃状态
活跃

语言占比

Lua

README

neovim-lua_logo

Neovim KISS configuration with Lua and LSP


Table of Contents

Plugins

lualine.nvim - A blazing fast and easy to configure neovim statusline plugin written in pure lua.

nvim-lspconfig - A collection of common configurations for Neovim’s built-in language server client

nvim-cmp - Auto completion plugin

LuaSnip - Snippet Engine for Neovim written in Lua

nvim-tree.lua - A File Explorer written In Lua

indentBlankline - Adds indentation guides to all lines (including empty lines)

nvim-autopairs - A super powerful autopairs for Neovim

Tagbar - A class outline viewer for Vim

gitsigns - Super fast git decorations implemented purely in lua/teal

nvim-treesitter - Nvim Treesitter configurations and abstraction layer

alpha-nvim - A fast and highly customizable greeter for neovim.

nvim-web-devicons - A Lua fork of vim-devicons

Directory Tree

${HOME}/.config/nvim

alt text

Files and Settings

/nvim

  • init.lua: Main configuration file that call lua modules

  • lua: The directory of lua modules, these modules are called in the init.lua file (see below).

See: neovim.io/doc/user/lua-guide/#_lua-modules

/nvim/lsp/

Path for LSP configs lsp/*.lua files. See: Lsp - CONFIG

/nvim/lua/config

/nvim/lua/plugin

Installation

  1. Install Neovim v0.12.x.

  2. Install Nerd Fonts, (the font of the screenshots are JetBrainsMono Nerd Font).

  3. Install Node.js - npm for download packages of LSP language servers, see: LSP Configuration.

  4. Make a backup of your current nvim folder if necessary:

mv ~/.config/nvim ~/.config/nvim.backup
  1. Download neovim-lua with git and copy the nvim folder in the ${HOME}/.config directory:
git clone https://github.com/brainfucksec/neovim-lua.git
cd neovim-lua/
cp -Rv nvim ~/.config/
  1. Run Neovim and download/sync plugins with vim.pack, see: Pack - Plugin Manager
nvim

LSP Configuration

  1. Install LSP language servers with npm, see: LSP Default Language Servers
sudo npm install -g \
    bash-language-server \
    pyright \
    vscode-langservers-extracted \
    typescript typescript-language-server \
    rust-analyzer

For Lua language server see:

  1. Install additional packages for C, C++ and Python:

C, C++:

Python:

  1. Open a code file matching one of the filetypes specified in the config with Neovim, and check that LSP is active with :checkhealth vim.lsp command.

See: neovim.io/doc/user/lsp/

LSP Default Language Servers

neovim-lua by default has the following language servers installed:

Lua - lua_ls

Bash - bashls

Python - pyright

C, C++ - clangd

HTML, CSS, JSON - vscode-langservers-extracted

JavaScript, TypeScript - ts_ls

Rust - rust_analyzer

See nvim-lspconfig #doc/LSP configs

Appearance

Available Colorschemes

Fonts: See: Installation

Icons: nvim-web-devicons

See: Screenshots

The color scheme (default: OneDark) is defined in the following file:


-- Color scheme setup before load:
require('onedark').setup({
    -- color scheme settings here..
})

--[[
Load color scheme:
Note: The instruction to load the color scheme may vary depending on the
package.
See the README of the related color scheme (i.e. git package) for information,
Examples: require('color_scheme').setup{}, vim.cmd('color_scheme')
--]]
require('onedark').load()

Keymaps

These are the default keymaps, in the following shortcuts, the <leader> key is set up to , (comma) character, see: keymaps.lua.

Shortcut Mode Description
kk Insert Esc with kk
<leader>c Normal Clear search highlights
<F2> Normal Toggle Paste mode
<leader>tk/th Normal Change split orientation (vertical/horizontal)
<Ctrl> + {h,j,k,l} Normal Move around splits windows
<leader>r Normal Reload configuration file
<leader>s Normal Save file
<leader>q Normal Save (close all windows) and exit from Neovim
<Ctrl> + t Normal Open terminal (:Term)
<Esc> Terminal Exit terminal
<Ctrl> + n Normal Open NvimTree
<leader>t Normal Open/Close Tagbar

Configuration Check

  • Open nvim and run command checkhealth, you should not see any error in the output (except for the one related to the Python 2 interpreter if don’t have it):
:checkhealth

See: help checkhealth

alt text

  • You can also use the startuptime option to read the nvim startup logs:
nvim --startuptime nvim-start.log

nvim nvim-start.log

See: :help startuptime

Screenshots

Note: Screenshots may be out of date compared to the actual setup.

(Click to expand)

OneDark Darker

1-onedark_darker.png

OneDark Dark

2-onedark_dark.png

OneDark Cool

3-onedark_cool.png

OneDark Deep

4-onedark_deep.png

Kanagawa Wave (lualine theme: palenight)

5-kanagawa_wave.png

Kanagawa Dragon (lualine theme: seoul256)

6-kanagawa_dragon.png

Monokai (lualine theme: molokai)

7-monokai.png

Rosé Pine (lualine theme: nightfly)

8-rose-pine.png

vim.pack

pack.png

Neovim Guides and Resources

Lua Resources

Neovim Lua Docs


Disclaimer

This setup is based on KISS principle, probably some concepts may not be valid for everyone. Then feel free to take what you need but don’t install anything without checking first!

This setup is not a Framework but it is the configuration I use to work on Linux, it can be used by default as it can be a start point to understand how Neovim is structured and maybe improve this config. Is the base configuration I use, and it tries to stay as simple as possible, with each addition weighted along these lines.

Less is more

Thanks to:

  • All the contributors who helped improve this setup with their reports and advices and all the authors of the sources mentioned above.

评论

暂无评论