• Stars
    star
    571
  • Rank 76,132 (Top 2 %)
  • Language
    Lua
  • License
    MIT License
  • Created almost 3 years ago
  • Updated 16 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Straightforward and pure Lua based Neovim configuration for my work as DevOps/Cloud Engineer with batteries included for Python, Golang, and, of course, YAML

My Nvim Configuration

πŸ’» This configuration works on my Manjaro Linux as well as on my macOS and requires Neovim >= 0.10 for all features. If you are running Neovim 0.9, dropbar.nvim is disabled, which only works in Neovim >= 0.10

Have a look at my rice how my Linux machine is configured and at my mac-setup how my MBP is configured. My dotfiles are also on GitHub.

More Screenshots

Terminal: alacritty

Font: Jetbrains Mono

Leader Key Clusters via which-key

See ./lua/core/config/ui/which-key.lua for details.

Go development

Debugging via DAP

Hydra modes for better shortcut handling

Motivation

There are many great Neovim configurations (see Inspiration), that give you a pleasant experience right out of the box, available. However, I am a long time (Neo)Vim user with a specific workflow and needs. Additionally, I do not have any Lua background and was not willing to spent too much time into that. Therefore, it was quite hard for me to customize and strip down the existing configs to my needs especially because the code is quite sophisticated.

I decided to move to my own fresh Lua based Neovim from my good old vimrc trying to accomplish the following principles.

Principles

  1. Migrate to Lua based alternative plugins respectively use only Lua based plugins (if possible).
  2. Keep the config as maintainable as possible knowing that this would possibly impact the code quality.
  3. Modular and meaningful directory structure and file naming.
  4. Just make it work and not make it beautiful πŸ˜ƒ. Of course, Neovim itself must look beautiful, but my focus is not on beautiful code or on utilizing all Lua features.

Features

General βš™οΈ

Navigation 🧭

Coding πŸ–₯️

Try out

If you have Docker on your system you can try out this config via the provided Dockerfile

πŸ’‘ Due to installing required tools like LSPs, CLI apps, etc. the image is approximately 3 GB large

Build the image

There are some issues with building a multi architecture Docker image via GitHub Action. Until I sorted that out, you can build the Docker image locally on your own

docker build -t nvim .

Just start nvim

docker run --name nvim --rm -it nvim

Mount a local directory (to ~/mount) and start nvim

docker run --name nvim --rm -it -v ${HOME}/tmp:/home/nvim/mount nvim

Start container in bash instead of nvim

docker run --name nvim --rm -it --entrypoint=/bin/bash nvim

Installation

I created an installation script that sets up all required tools on a fresh machine to work with my Neovim config.

For now, it works on Debian/Ubuntu and Arch. MacOS will be added soon.

USE AT YOUR OWN RISK!!

Requirements

There are some tools that are required in order to use some features/plugins:

Tools

For neo-tree delete functionality:

For Latex functionality:

LSPs, Formatting, Linters, DAP

The following programs should be installed on your system so that the appropriate tools can be installed:

  • Go
  • Python
  • NodeJs > 12
  • Cargo

Go

Go related dependencies are managed by go.nvim and are installed by running :GoInstallBinaries (when a Go file is loaded). They are installed in your $GOPATH.

All other

All other dependencies are managed by Mason. Tools are installed by running :MasonToolsInstall (in vim.fn.std path("data") .. "mason"). [Mason requirements](https://GitHub.com/William beman/mason.nvim#requirements) must be available on your system.

Bindings

Mode key binding
n space Leader key
n <c-h | j | k | l> Change window focus (including Tmux panes)
n <leader>Tab Switch to previously opened buffer
n <Tab> Switch to next buffer (bnext)
n <S-Tab> Switch to previous buffer (bprevious)
n st Visual selection with Treesitter hint textobject
v sa Add surrounding
n sd Delete surrounding
n sr Replace surrounding
n <c-Tab> Start auto completion (without typing anything)
n/v ga Start mini.align (align text)
n gcc ToggleΒ line comment
n/v gc ToggleΒ line comment (works with movements like gcip)
n s Jump to character(s) (flash.nvim)
i/s <c-j> Luasnip expand/forward
i/s <c-k> Luasnip backward
i <c-h> Luasnip select choice
n <c-n> Toggleterm (opens/hides a full terminal in Neovim)
i <c-l> Move out of closing brackets
n <CR> Start incremental selection
v <Tab> Increment selection
v <S-Tab> Decrement selection
n <c-f> Search buffer
i/v/n/s <c-s> Save file

Hit <leader> to start which-key which gives you more mappings grouped by topic.

Structure

tree1 .

.
β”œβ”€β”€ after            # file specific settings
β”œβ”€β”€ init.lua         # main entry point
β”œβ”€β”€ lazy-lock.json   # Lockfile for Lazy.nvim
β”œβ”€β”€ lua/core         # lua configuration
β”œβ”€β”€ snippets         # snippets directory (luasnip style)
└── spell            # my spell files linked from another repo

tree1 lua/core

lua/core
β”œβ”€β”€ autocmd.lua      # autocmds for various things
β”œβ”€β”€ config           # configuration folder for plugins
β”œβ”€β”€ globals.lua      # global functions
β”œβ”€β”€ lazy.lua         # Lazy configuration
β”œβ”€β”€ mappings.lua     # key bindings
β”œβ”€β”€ options.lua      # vim options
β”œβ”€β”€ plugins          # plugins and their configuration
β”œβ”€β”€ settings.lua     # user settings to configure

Each plugin to be installed is defined in ./lua/core/plugins/ in a separate file.

User configuration

The intention of my Neovim configuration was never to be a fully customizable "distribution" like LunarVim, SpaceVim, etc. but from time to time I like to change my color scheme and the idea of making this configurable came to my mind. Based upon this idea I implemented some further lightweight configuration options that might be useful.

All options can be found in ./lua/core/settings.lua.

Adding LSPs

You can add LSPs via lsp_servers in settings.lua. The server will be installed by Mason und loaded by nvim-lspconfig. If you want to pass settings for the LSP have a look at ./lua/core/plugins/lsp/settings/ how to add settings for specific LSPs.

Remove plugins

You can remove unwanted plugins by just removing the appropriate file in ./lua/core/plugins/. Lazy will take care of removing the plugin.

Keep in mind that some plugins are configured to work in conjunction with other plugins. For instance, autopairs is configured in ./lua/vim/config/treesitter.lua. For now there is no logic implemented that cross-checks such dependencies.

Add plugins

If you want to follow my method adding a plugin is straight forward:

Create a file in ./lua/core/plugins/ following the expected format of Lazy.

Open another instance of Neovim (I always try to keep one running instance of Neovim open in case I messed up my config) and run Lazy sync.

Inspiration

More Repositories

1

emoji.nvim

A plugin to search for and insert emojis/kaomojis right from Neovim πŸ˜€
Lua
35
star
2

kustomize.nvim

A Neovim plugin with some useful functions for working with Kustomize
Lua
28
star
3

mac-setup

My Ansible Playbook to configure my MacBook
Shell
27
star
4

dotfiles

Dotfiles
Shell
12
star
5

rice

My "rice" that I use for automatic configuration of my systems via Ansible and my collection of Ansible roles.
Makefile
12
star
6

dots

Dotfiles for Linux and macOS. Managed by chezmoi. Includes i3, zsh, tmux, kitty, alacritty, yabai
Shell
9
star
7

toolbox

Scripts/Programs that helped me in various DevOps Tasks
Go
7
star
8

werkzeugkasten

Download your favorite command-line tools with ease!
Go
7
star
9

rootknecht.net

My personal homepage with my knowledge base and blog all around Linux, DevOps, Cloud, and workflows
AutoHotkey
4
star
10

chkRedis

A minimal helper tool written in Go to verify the connection to a Redis data store
Go
3
star
11

gstring

Swiss army knife for manipulating strings.
Go
3
star
12

problemsolver

An opiniated Docker image for troubleshooting purposes, especially within a Kubernetes cluster.
Dockerfile
3
star
13

go-cli-skeleton

A minimal but functional skeleton Go CLI application
Go
2
star
14

gin-demo

Showcasing single binary web app with Go and Gin-Gonic
Go
2
star
15

productivity

My presentation on increasing your productivity as an IT engineer
Shell
2
star
16

hands-on-nomad

Hands-on Nomad a "... simple and flexible scheduler and orchestrator for managing containers and non-containerized applications ..."
HCL
2
star
17

kustomize-demo

Demonstrating Kubernetes manifest generation with Kustomize.
Makefile
1
star
18

neovim-cookbock

1
star
19

nvim-docker

Dockerized Neovim in different flavours and architectures
Dockerfile
1
star