Awesome
<p align="center"> <img src="img/logo.png" alt="neovim-lua_logo"> </p> <h3 align="center"> Neovim KISS configuration with Lua </h3>Table of Contents
- Plugins
- Directory Tree
- Files and Settings
- Installation
- LSP Configuration
- Appearance
- Keymaps
- Configuration Check
- Screenshots
- Guides and Resources
- Other Neovim Lua Projects and Examples
- Lua Resources
Plugins
lazy.nvim - A modern plugin manager for Neovim
feline.nvim (freddiehaddad Fork) - A minimal, stylish and customizable statusline for Neovim written in 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
Files and Settings
/nvim
-
init.lua: Main configuration file that call
lua
modules -
lua: The directory of
lua
modules, these modules are called in theinit.lua
file (see below).
See: nanotee/nvim-lua-guide: Where to put Lua files
/nvim/lua/core
-
autocmds.lua: Define autocommands with Lua APIs
-
colors.lua: Define Neovim and plugins color scheme
-
keymaps.lua: Keymaps configuration file, Neovim and plugins keymaps
-
lazy.lua: Plugin manager configuration file
-
options.lua: General Neovim settings
-
statusline.lua: Statusline configuration file
/nvim/lua/lsp
- lspconfig.lua: LSP configuration (language servers, keybinding)
/nvim/lua/plugins
-
alpha-nvim.lua: Dashboard
-
indent-blankline.lua: Indent line
-
nvim-cmp.lua: Autocompletion settings
-
nvim-tree.lua: File manager settings
-
nvim-treesitter: Treesitter interface configuration
Installation
-
Install Neovim v0.10.x.
-
Install Nerd Fonts, (the font of the screenshots are
JetBrainsMono Nerd Font
). -
Install Node.js - npm for download packages of LSP language servers, see: LSP Configuration.
-
Make a backup of your current
nvim
folder if necessary:
mv ~/.config/nvim ~/.config/nvim.backup
- Download neovim-lua with
git
and copy thenvim
folder in the${HOME}/.config
directory:
git clone https://github.com/brainfucksec/neovim-lua.git
cd neovim-lua/
cp -Rv nvim ~/.config/
-
Install lazy.nvim for install and manage the plugins, see: lazy.nvim - Installation
-
Run Neovim for download/sync plugins with
lazy
nvim
LSP Configuration
- Install LSP language servers with
npm
, see: Languages Currently Supported
sudo npm install -g \
bash-language-server \
pyright \
vscode-langservers-extracted \
typescript typescript-language-server
- Install additional packages for plugins support:
C, C++:
Python:
- Open a source file of one of the supported languages with Neovim, and run command :LspInfo for verify the LSP support.
See: nvim-lspconfig - Quickstart
Languages Currently Supported
Lua - builtin
Bash - bashls
Python - pyright
C, C++ - clangd
HTML, CSS, JSON - vscode-langservers-extracted
JavaScript, TypeScript - ts_ls
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:
- Neovim UI - nvim/lua/core/colors.lua:
--[[
Set Neovim UI color scheme.
Insert preferred color scheme in the `color_scheme` variable.
Color scheme is loaded at "Load color scheme" after settings sections, setup
must be called before loading.
--]]
local status_ok, color_scheme = pcall(require, 'onedark')
-- Load color scheme:
require('onedark').load()
-- Set status line color scheme
return M.onedark_dark
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>z | Normal | Open 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
- You can also use the
startuptime
option to read the nvim startup logs:
nvim --startuptime > /tmp/nvim-start.log
nvim /tmp/nvim-start.log
See: :help startuptime
Also you can check the plugins configuration and startup time with lazy
:
:checkhealth lazy
:Lazy profile
See: lazy.nvim - Usage
Screenshots
<p align="center"> <img src="img/banner.png"> </p> <details><summary> <b>(Click to expand)</b></summary>OneDark Darker
OneDark Dark
OneDark Cool
OneDark Deep
Kanagawa Wave
Kanagawa Dragon
Monokai
Rosé Pine
lazy.nvim
</details>Guides and Resources
Other Neovim Lua Projects and Examples
Lua Resources
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.
Thanks to:
-
All the contributors who helped improve this setup with their reports and advices.
-
All the authors of the sources mentioned above.
-
The users of /r/Neovim subreddit for the support of the configuration.