Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

281 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Personal Neovim Configuration

This repository contains my personal Neovim configuration intented to be usually deployed in a NixOS environment.

Neovim

Requirements

  1. Neovim version 0.12 or later.
  2. Ghostty or Kitty terminal for image protocol support.
  3. python3-venv for some Mason packages.
  4. tmux with image support enabled. To do that make sure you have the following configuration enabled:
# Default configuration
set -g default-terminal "tmux-256color"
set -gq allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
set -g visual-activity off

# Allow OSC52
set -s set-clipboard on
set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007'

How to use

Add the following configuration into your default Neovim directory:

NVIM_CONFIG="~/.config/nvim/"
mkdir -p $NVIM_CONFIG
cp -r lua/ .stylua.toml init.lua $NVIM_CONFIG

Installation

If you are using a non-NixOS distribution, the Mason configuration should be enabled automatically so that you get all LSP's on your machine.

 Debian:

echo "1. Install all needed packages for basic functionality..."
sudo apt install -y cmake nodejs npm python3 python3-pip python3-venv clang ripgrep imagemagick tmux fd-find tree-sitter-cli

echo "2. Install all packages for the complete GUI functionality..."
curl -fsSL https://download.opensuse.org/repositories/home:clayrisser:sid/Debian_Unstable/Release.key | gpg --dearmor | sudo tee /etc/apt/keyrings/home_clayrisser_sid.gpg > /dev/null
ARCH="$(dpkg --print-architecture)"
sudo tee /etc/apt/sources.list.d/home:clayrisser:sid.sources > /dev/null <<EOF
Types: deb
URIs: http://download.opensuse.org/repositories/home:/clayrisser:/sid/Debian_Unstable/
Suites: /
Architectures: $ARCH
Signed-By: /etc/apt/keyrings/home_clayrisser_sid.gpg
EOF
sudo apt update -y
sudo apt install -y ghostty

 Fedora:

echo "1. Install all needed packages for basic functionality..."
sudo dnf install -y cmake nodejs npm python3 python3-pip clang ripgrep ImageMagick tmux tree-sitter-cli

echo "2. Install all packages for the complete GUI functionality..."
sudo dnf copr enable alternateved/ghostty
sudo dnf -y update
sudo dnf install -y ghostty

Common for non  NixOS distributions:

echo "1. Making sure we have the latest nvim version installed..."
TEMP_DIR=$(mktemp -d)
git clone --single-branch --branch master https://github.com/neovim/neovim.git "$TEMP_DIR"
cd "$TEMP_DIR" && make -j$(( $(nproc) * 3 / 4 )) CMAKE_BUILD_TYPE=RelWithDebInfo && sudo make install && cd -

echo "2. Cleaning nvim data and config directories..."
rm -rf "$HOME/.local/share/nvim" "$HOME/.local/state/nvim" "$HOME/.cache/nvim" "$HOME/.config/nvim"

echo "3. Get the latest personal nvim configuration..."
git clone https://github.com/Steinhagen/neovim-config $HOME/.config/nvim

Since Mason doesn't work for NixOS, we need to provide all LSPs that we are using ourselves.

 NixOS

packages = (
  with pkgs;
  [
    # Application packages
    ghostty
    imagemagick
    typst
    fzf
    tree-sitter

    # Language servers
    prettier
    prettierd
    rust-analyzer
    pyright
    sshfs
    ripgrep
    checkmake
    astyle
    lua-language-server
    haskell-language-server
    sumneko-lua-language-server
    elmPackages.elm-language-server
    bash-language-server
    vscode-langservers-extracted
    dockerfile-language-server
    python3Packages.python-lsp-server
    ruff
    tailwindcss-language-server
    terraform-ls
    typescript-language-server
    yaml-language-server
  ]
);

Theme

Neovim will automatically detect what theme you are currently using (dark/light) and will adapt to it. If you want to force a specific environment theme, set the variable NVIM_THEME_MODE to light or dark. You can also force a specific theme by setting the variable NVIM_THEME_NAME to one of the existing themes: tokyonight, catppuccin:

export NVIM_THEME_MODE='light'
export NVIM_THEME_NAME='tokyonight'

Plugins

General Configuration

  • init.lua: Entry file that includes all other used plugins.
  • keymaps.lua: Contains general Neovim keymaps. Plugins keymaps are in their own lua file.
  • options.lua: Contains general settings for Neovim.
  • menu.lua: Contains the right-click menu settings.
  • utils.lua: Contains common functions that are used in plugins.

Themes

  • folke/tokyonight.nvim colortheme.lua: Sets the default Neovim theme.

Completion

  • hrsh7th/nvim-cmp autocompletion.lua: Configures the cmp completion framework and LuaSnip snippet engine.

Editor Plugins and Configurations

  • nvim-treesitter/nvim-treesitter treesitter.lua: Configures the TreeSitter syntax highlighter.
  • lukas-reineke/indent-blankline.nvim indent-blankline.lua: Configures the Indent Blankline plugin for displaying indentation levels.
  • olimorris/codecompanion.nvim avante.lua: Configures the Code Companion plugin for interacting with different AI models.
  • windwp/nvim-autopairs misc.lua: Autoclose parentheses, brackets, quotes, etc.

UI Plugins

  • nvim-lualine/lualine.nvim lualine.lua: Configures the Lualine status line plugin.
  • y3owk1n/undo-glow.nvim undo-glow.lua: Adds a visual "glow" effect to your Neovim operations.
  • 3rd/image.nvim image.lua: Render images directly inside the terminal.
  • folke/which-key.nvim misc.lua: Hints keybinds.

LSP

  • neovim/nvim-lspconfig lsp.lua: Configures the Neovim LSP client.
  • stevearc/conform.nvim conform.lua: Configures the Conform plugin for automatic code formatting.
  • nvimtools/none-ls.nvim none-ls.lua: Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.

Git

  • lewis6991/gitsigns.nvim gitsigns.lua: Configures the GitSigns plugin for displaying Git diff information.

Utils

  • folke/snacks.nvim snacks.lua: Configures the Snacks plugin mostly for fuzzy finding and picking.
  • MeanderingProgrammer/render-markdown.nvim render-markdown.lua: Plugin to improve viewing Markdown files in Neovim.
  • akinsho/toogleterm.nvim toggleterm.lua: Configures Terminal plugin.
  • saxon1964/neovim-tips neovim-tips.lua: Displays common useful Neovim tips and allows you to save new ones.
  • christoomey/vim-tmux-navigator misc.lua: Tmux & split window navigation.

Please refer to the individual .lua files for more detailed configuration information.

Improvements

  1. Improve mouse menu
  2. Identify why images aren't displayed when conected via SSH

References

This configuration has taken inspiration from the following contributors:

About

Personal configuration for Neovim.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages