Skip to content

Lanttcat/nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

249 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fork from Allanman's nvim config

My Neovim Configuration

This is my first Lua based Neovim (>=0.6) configuration. My goal was to achieve the same functionality as my old vimrc and move onwards to a full Lua based configuration and Lua based plugins especially the promising builtin LSP and Treesitter.

💻 This configuration is working on my Manjaro Linux as well as on my macOS!

Have a look at my rice how my Linux machine is configured and at my mac-setup how my MacBook is configured. The Tmux configuration you can see in the image is here (as well as my other dotfiles).

Motivation

There is a number of great Neovim configurations online (see Inspiration) that give you a pleasant experience right out of the box. 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.

So I decided to move to a fresh Lua based Neovim on my own trying to accomplish the following principles:

Principles

  1. At least feature parity with my mentioned old vimrc (my lua config is superior almost since day one (or two 😉)).
  2. Migrate to Lua based alternative plugins.
  3. Keep the config as simple as possible knowing that this would possibly impact the code quality.
  4. Modular and meaningful directory structure and file naming.
  5. 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 🖥️

Structure

Each plugin to be installed is defined in plugins.lua and each plugin has its own configuration file (if necessary) in lua/config/ which is loaded by packer.

.
├── after
│   └── ftplugin      # file specific settings
├── init.lua          # main entry point
├── lua
│   ├── autocmd.lua   # vim autocommands
│   ├── config/       # each plugin configuration is in its own file
│   ├── mappings.lua  # Vim keymaps defintions -> config/which.lua for more
│   ├── options.lua   # non plugin related (vim) options
│   └── plugins.lua   # define plugins to be managed via Packer
├── plugin            # packer_compiled
├── snippets          # snippets for vsnip
└── spell             # my spell files linked from another repo

Useful non leader bindings

Mode key binding
n space  Leader key
v ga Easyalign
n gcc Toggle line comment
n/v gc Toggle line comment (works with movements like gcip)
n ⬆ ⬇ ⬅ ➡ Resize panes
i <c-l> Move out of closing bracket
n <c-h|j|k|l> change pane focus (including Tmux panes)
n <leader>space switch to previously opened buffer
v sa Add surrounding
n sd Delete surrounding
n sr Replace surrounding
n ss Search 2 char forward (lightspeed)
n S Search 2 char backward (lightspeed)

Top level leader key bindings

See ./lua/config/which.lua for details.

key cluster
b Buffer management
c Language specific actions (only in Go, e.g. run tests)
f File management
g Git actions 
h Harpoon integration
l LSP integration
m Misc stuff
s Searching
t Trouble integration
w Window management
x Languagetool integration
y YAML integration (only in YAML files)
z Spell bindings

Remove plugins

Basically, you can remove unwanted plugins by just removing the appropriate line in ./lua/plugins.lua and, if applicable, delete its configuration file in ./lua/config/.

ℹ️ Keep in mind that some plugins are configured to work in conjunction with other plugins. For instance, autopairs is configured in ./lua/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 simple:

In lua/plugins.lua add the config to Packer. You are free to use a name for the configuration file (should be a valid filenam)

use {"<Address-of-the-plugin>", config = get_config("<name-of-the-plugin>")}

Create lua/config/<name-of-the-plugin>.lua where you put the plugins settings. If your plugin does not require additional configuration or loading you can omit the config part.

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 PackerSync.

Requirements

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

Tools

Autoformatting

Language Servers

For the builtin LSP (see lspconfig for more info about LSP configuration)

  • sudo npm i -g bash-language-server dockerfile-language-server-nodejs yaml-language-server typescript typescript-language-server vscode-langservers-extracted
  • go get golang.org/x/tools/gopls (optional golangci-lint, gomodifytags, gorename)
  • terraform-ls
  • texlab and tectonic
  • lua-language-server
  • For advanced spell checks via vim-grammarous Java 8+ is required

UI

Inspiration

About

My Neovim Configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages