mox669 / barebones-nvim

Minimal configuration for neovim with set up LSP + Formatter + Neotree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

barebones-nvim 🦴

A minimal setup for Neovim - your personal development environment!



Introduction

This repository should allow for a quick, easy and unbloated setup for neovim with sane presets. The main goal is to help beginners get quickly into neovim configuration.

The following plugins and features come preinstalled:


  • Neotree file browsing and all dependencies
    • in addition Devicons is installed, although this plugin will only work if you have a patched Nerd Font installed and ready to go for your terminal
  • Treesitter for highlighting
  • Null-ls to setup formatters, linters and spellchecker
  • LSP (Language Server Protocol)
    • lspconfig to enable LSP
    • Mason plugin to install language servers via UI inside of neovim
    • Compe plugin for auto completion, utilizing the installed LSP and LuaSnip
  • LuaSnip snippet engine to add custom snippets and/or enable snippet collections
  • FriendlySnippets snippet collection used by LuaSnip
  • TabNine AI assistent for additional suggestions for Compe

Plugins are managed by Packer. On first launch of neovim, packer will install itself. Afterwards, you can use the command PackerInstall, to install all predefined plugins. As an alternative, PackerSync runs after each save of /plugin/init.lua.


As an entrypoint for LSP and Null-ls, the sumneko-lua-language-server and stylua are predefined with this setup. The language server will be installed after the first launch of neovim as a result of defining it inside the ensure_installed property in after/plugin/lsp/setup.lua. Stylua needs to be installed manually. See the github repo for more details. Once the formatter is installed, lua files are being formatted upon saving the file. You can change the formatter options in the stylua.toml configuration file.




Installation

Before you follow the installation process you may want to backup your existing nvim configuration. The following installation steps will otherwise overwrite them.

Linux

Clone the repository to $HOME/.config

cd ~/.config
git clone https://github.com/olekatpyle/barebones-nvim.git nvim

First step after installation

Run the command checkhealth in commandmode, to identify any unsatisfied dependencies or misconfigurations (in general, it is a good idea to run this command every now and then.).


Plugin suggestions for install, if you are new to neovim

  • WhichKey displays possible key bindings of the command you started typing

  • A theme if you get annoyed by the barebones look. A good place to look for themes -> Vim Color Schemes

    • most theme repositories will give you detailed explanation on how to enable the theme inside your setup
    • in general as an example:
        " inside /lua/barebones/options.lua vim.cmd([[..]])
        colorscheme gruvbox-baby 



File Tree

This setup has the following files tree:

nvim
β”œβ”€β”€ after
β”‚   β”œβ”€β”€ ftplugin
β”‚   └── plugin
β”‚       └── lsp
β”‚           └── setup.lua
β”œβ”€β”€ ftdetect
β”œβ”€β”€ init.lua
β”œβ”€β”€ lua
β”‚   └── barebones
β”‚       β”œβ”€β”€ keys.lua
β”‚       β”œβ”€β”€ lsp
β”‚       β”‚   └── on_attach.lua
β”‚       └── options.lua
β”œβ”€β”€ plugin
β”‚   β”œβ”€β”€ cmp.lua
β”‚   β”œβ”€β”€ init.lua
β”‚   β”œβ”€β”€ luasnip.lua
β”‚   β”œβ”€β”€ mason.lua
β”‚   β”œβ”€β”€ neotree.lua
β”‚   β”œβ”€β”€ null.lua
β”‚   β”œβ”€β”€ tree-sitter.lua
β”œβ”€β”€ stylua.toml
└── undodir

Explanation

In general there are five important directories to understand when it comes to configuring neovim.

/lua

Contains lua files that are being loaded at startup of neovim. This is the place where you want to set your options for the editor, configure your keymaps aswell as other lua code, that needs to be loaded at start, i.e custom functionalities for your setup.

/plugin

Contains the packer init.lua to specify, which plugins to install. Further, the directory is being used to define plugin specific configuration files, where the call to the plugins setup-function is being made (most plugins need to be initialized with this call). Inside the setup-function, you can configure native settings for the plugin. If you want to add your own plugins, this is a good place to do so.

/ftplugin

If you have filetype specific plugins - i.e a plugin, that is only used with lua files - you should put the configuration file (like the ones in /plugin) inside this directory. This has the advantage, that the modules defined inside /ftplugin are only being loaded, when you open a file of the specific filetype, making the editor more performant.

/ftdetect

Inside /ftdetect you may put modules, that help you detect filetypes. Since there are some niche filetypes cruising around, neovim may not detect them.

/after

If you want to expand functionalities of plugins, you want to put those changes inside this directory. This makes sure, that instead of replacing the native plugin, you add to it.



Options

All options for the editor are set in /lua/barebones/options.lua. The comments for each option should be sufficient. Of course, if you need a detailed explanation, use the built-in help system in commandmode:

:h <option_you_need_help_for>


If more information is needed, something is unclear or something is not working correctly, please file an issue and feel free to ask. PROST!

About

Minimal configuration for neovim with set up LSP + Formatter + Neotree


Languages

Language:Lua 100.0%