Skip to content

Instantly share code, notes, and snippets.

@andersonsp
Created July 10, 2023 15:38
Show Gist options
  • Save andersonsp/2d12db1547aa5353ce196d30d8ca940c to your computer and use it in GitHub Desktop.
Save andersonsp/2d12db1547aa5353ce196d30d8ca940c to your computer and use it in GitHub Desktop.

Basic Neovim Configuration from scratch

The directory structure

nvim/
  after/
  | ftplugin/
  |   lua.lua
  |   rb.lua
  |   yaml.lua
  | plugin/
  | | defaults.lua
  | | keymaps.lua
  lua/
  | config/
  | | lsp/
  | | theme/
  | utils/
  | plugins/
  | | init.lua
  init.lua

Once we have a directory structure like the one shown above, we're ready to start.

init.lua

Installing and configuring Lazy and Meson

Directory after

Let's start with the after directory.

ftplugin

The directory ftplugin contains cofigurations specific for each filetype. I use these mainly to specify whether the filetype should use soft or hard tabs and what should be the size of the inserted tabs.

For example the configuration for Lua source files .lua looks like this:

vim.bo.shiftwidth = 2
vim.bo.tabstop = 2
vim.bo.softtabstop = 2
vim.bo.textwidth = 120

plugin

defaults

keymap

lua

With all that out of the way let's move on with the main configuration files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment