Skip to content

BreitbandModem/neovim-lua

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

388 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TODO:

  • refactor lua autocommands
  • explore nvim-dap-virtual-text plugin
  • explore vim-test alternatives

neovim-lua_logo

Neovim KISS configuration with Lua

Plugins

packer.nvim - A use-package inspired plugin manager for Neovim

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

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

feline.nvim - A minimal, stylish and customizable statusline for Neovim written in Lua

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

nvim-telescope - A fuzzy finder

telescope-ui-select - Use telescope for vim ui.select

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

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

comment - Comment code

glow - Open glow markdown preview in popup window

vim-test - Unit Test execution from neovim

zen-mode - Distraction free coding by maximizing current buffer

which-key - Display key bindings for commands

nvim-dap - Debug Adapter Protocol client implementation for Neovim

nvim-dap-ui - Visual interface for the DAP plugin

yanky - Yank history

neovim-session-manager - Session Manager

nvim-lspconfig - Nvim LSP Config

nvim-cmp - LSP Autocompletion

LuaSnip - Snippet Tool

friendly-snippets - Snippet collection

nvim-treesitter - Treesitter language parser

nvim-treesitter-context - Show function context

nvim-autopairs - Auto pairs plugin

telescope-frecency - Index frecent files with telescope

harpoon - Quick access to bookmarked files

Tagbar - Tagbar to show file overview in sidebar

Directory Tree of Lua Files

${HOME}/.config/nvim

├── lua
│   ├── core
│   │   ├── colors.lua
│   │   ├── keymaps.lua
│   │   └── settings.lua
│   ├── plugins
│   │   └── pluginXYZ.lua
│   └── packer_init.lua
├── plugin
│   └── packer_compiled.lua
└── init.lua

Files and Settings

/nvim

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

  • coc-settings.json: Configuration file for coc framework

  • lua: Folder of lua modules, here reside all the Lua modules that needed. These modules are called from init.lua file (see below).

See: https://github.com/nanotee/nvim-lua-guide#where-to-put-lua-files

/nvim/lua

/nvim/lua/core

  • settings.lua: General Neovim settings and configuration

  • keymaps.lua: Keymaps configuration file, vim/neovim and plugins keymaps.

  • colors.lua: Define Neovim and plugins color scheme

Appearance

Colorschemes:

Fonts: Cozette

Icons: nvim-web-devicons

Screenshots

(Click to expand)

OneDark (darker)

onedark_1

onedark_2

Monokai

monokai_1

monokai_2

Rosé Pine

rose-pine_1

rose-pine-2

Installation

  1. Install neovim v0.6.x
brew install neovim
  1. Install npm (for download the packages of LSP language servers)

  2. Clone this repo and link it to the nvim config.

git clone https://github.com/BreitbandModem/neovim-lua.git /Users/****/github/neovim-lua
ln -s /Users/****/github/neovim-lua/lhnvim /Users/****/.config/lhnvim
export NVIM_APPNAME="lhnvim"
  1. Install some plugin dependencies
# ripgrep is required for telescope
brew install ripgrep

# glow is required for markdown preview
brew install glow

# Install a custom font to support icons
brew tap homebrew/cask-fonts
brew install font-jetbrains-mono-nerd-font

# Install universal ctags for the Tagbar plugin
brew install universal-ctags

Configure the newly installed font in the terminal app (e.g. iterm2).

  1. Install LSP language servers
npm install -g typescript typescript-language-server vscode-langservers-extracted vls @vue/language-server @vue/typescript-plugin
brew install lua-language-server
  1. Install packer.nvim for install and manage plugins:
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
 ~/.local/share/nvim/site/pack/packer/start/packer.nvim

Open Neovim and run :PackerSync command.

See: https://github.com/wbthomason/packer.nvim#quickstart

  1. Install treesitter language parsers
:TSInstall typescript javascript gitignore regex css json vim lua markdown_inline http vue yaml
  1. Specific fix for running mocha tests on a docker container using the vim-test plugin

Remove the additional arguments added by the vim-test mocha plugin source code:

~/.local/share/nvim/site/pack/packer/start/vim-test/autoload/test/javascript/mocha.vim

Languages Currently Supported

Lua - builtin

Bash - bashls

Python - pyright

C, C++, CSS - clangd

HTML, CSS, JSON - vscode-html

JavaScript, TypeScript - tsserver

See: nvim-lspconfig #doc/server_configurations.md

Set Color Scheme

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

-- Load colorscheme
require('onedark').setup {
    style = 'darker'
}
require('onedark').load()
-- Set colorscheme (from core/colors.lua/colorscheme_name)
local colors = require('core/colors').onedark

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

Guides and resources

Other Neovim Lua projects and examples

Lua resources

Disclaimer

As all my setups I try to follow the 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!


Thanks to all the authors of the sources mentioned above and to all the others from whom I "stole" some configs :)

About

Neovim KISS configuration with Lua

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Lua 100.0%