Skip to content

marcantondahmen/nvim-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nvim Config

Screenshot

This is the personal Neovim configuration of Marc Anton Dahmen. It provides a solid setup for TypeScript, PHP and Automad development based on terminal focused workflows.

Feel free to fork this config or use parts of it for inspiration. However, issues and pull-request will be ignored!


Installation

Just clone the repository into the ~/.config directory as follows:

git clone git@github.com:marcantondahmen/nvim-config.git ~/.config/nvim

Or using https:

git clone https://github.com/marcantondahmen/nvim-config.git ~/.config/nvim

Dependencies

The following dependecies have to be installed in order to make all plugins work correctly:

  • ripgrep
  • sed
  • wget
  • fd
  • fzf
  • sad
  • bat
  • Python3 provider (see below)
  • node neovim package (see below)
  • unzip (probably only WSL)
  • Gitui
  • Lazydocker
  • Tig
  • PHP (for Composer)
  • Composer (for Psalm)

In order to install the basic dependecies, assuming that PHP and Composer are installed anyways, run the following commands on macOS for example:

brew install ripgrep
brew install fd
brew install fzf
$(brew --prefix)/opt/fzf/install
brew install gnu-sed
brew install sad
brew install bat
brew install wget
brew install gitui
brew install tig
brew install lazydocker
python3 -m pip install --user --upgrade pynvim
npm install -g neovim

Theme

This config uses the Tokyo Night (Storm) theme.

Terminal

WezTerm includes already a matching theme. For iTerm and the Windows terminal, matching color schemes can be found here:

Plugins

All plugins in this config are managed by packer.nvim. Plugins that don't require configuration are defined in plugins/init.lua. Plugins that require configuration or a function to run after being loaded are defined in separate files inside the plugins directory. The following plugins are included:

There are also some custom settings and extensions:

Adding Plugins

In order to add a new plugin, simply add a lua module that returns a packer.nvim plugin spec, first reload Neovim and run the following command afterwards:

PackerSync

Make sure to also update the lock file as described below.

Lock File

This config uses a lock file to prevent breaking changes on re-installs or config updates. In order to update a plugin, simply update its commit hash inside the plugins-lock.json. When adding a new plugin, run the following Neovim command to update the lock file:

PackerSnapshot plugins-lock.json

Compiling Plugins

Whenever a plugin config is written, all plugins are compiled automatically running PackerCompile in a separate headless Neovim instance in order to make sure that all modules a refreshed before compilation. However, in case something looks wrong when editing a plugin config, which can be the case when editing the event option of a plugin, a simple restart followed by running PackerSync manually should fix most issues.

Tmux

In order to be able to navigate between Tmux and NeoVim panes, the following configuration has to be added to ~/.config/tmux/tmux.conf:

is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"

bind-key -n 'M-Up' if-shell "$is_vim" 'send-keys M-Up' 'select-pane -U'
bind-key -n 'M-Left' if-shell "$is_vim" 'send-keys M-Left' 'select-pane -L'
bind-key -n 'M-Down' if-shell "$is_vim" 'send-keys M-Down' 'select-pane -D'
bind-key -n 'M-Right' if-shell "$is_vim" 'send-keys M-Right' 'select-pane -R'

bind-key -T copy-mode-vi 'M-Up' select-pane -U
bind-key -T copy-mode-vi 'M-Left' select-pane -L
bind-key -T copy-mode-vi 'M-Down' select-pane -D
bind-key -T copy-mode-vi 'M-Right' select-pane -R

Fonts

Good looking fonts that also works well with symbols are JetBrainsMono Nerd Font and Hack Nerd Font that can be downloaded here. Note, that on macOS, nerd fonts can be installed using brew.

Highlights

Run the following command in order to see all used highlight groups:

so $VIMRUNTIME/syntax/hitest.vim