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!
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
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
This config uses the Tokyo Night (Storm) theme.
WezTerm includes already a matching theme. For iTerm and the Windows terminal, matching color schemes can be found here:
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:
- Comment.nvim comment plugin
- alpha-nvim dashboard
- auto-session session manager
- barbar.nvim bufferline
- barbecue.nvim symbols breadcrumbs
- conform.nvim formatting
- diffview.nvim git diff view
- gitsigns.nvim git status gutter
- headlines.nvim markdown headings and codeblock highlighting
- indent-blankline.nvim indent guides
- lsp_signature.nvim signature help
- lspsaga.nvim language server functions
- lualine.nvim status line
- markdown-preview.nvim markdown preview in browser
- neogen docblocks
- nvim-autopairs auto pairing
- nvim-cmp autocompletion
- nvim-highlight-colors highlight colors
- nvim-lsp-file-operations lsp file operations for nvim-tree
- nvim-lspconfig language server config
- nvim-navbuddy symbols navigation
- nvim-notify notifications
- nvim-spectre project wide search and replace
- nvim-tmux-navigation navigate between NeoVim and Tmux panes
- nvim-tree.lua file explorer
- nvim-treesitter syntax highlighting
- nvim-web-devicons icons
- packer.nvim package manager
- tagalong.nvim update tags
- telescope.nvim fuzzy-serch menus
- toggleterm.nvim terminal
- trouble.nvim diagnostics overview
- typescript-tools.nvim TypeScript support
- vim-ReplaceWithRegister better replace functionality
- vim-markdown-toc markdown toc
- vim-maximizer maximize panes
- vim-pencil improve writing experience in Markdown
- vim-surround surround plugin
- which-key.nvim keymaps help
There are also some custom settings and extensions:
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.
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
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.
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
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
.
Run the following command in order to see all used highlight groups:
so $VIMRUNTIME/syntax/hitest.vim