Skip to content

Personal Vim configuration and plugins under version control

Notifications You must be signed in to change notification settings

neozenith/dotfiles

Repository files navigation

NeoZenith Vim dotFiles

Brief

Vim Bonsai SVG Logo

This is not intended as a public example of good management of VIM dotFiles although I do make every attempt to apply best practices in maintaining this configuration purely for my own ease of use and reference.

Like the Vim bonsai logo, it all starts with a seed and then you nurture and prune it for your own environment. Each person's Vim journey is different for this reason.


Quick Start

A lot of this has evolved since I first started so the tooling and dev dependencies need updating.

Some basics

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install neovim node python3 pyenv
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

The dotfiles

For now the thing that is constant is cloning this repo and copying some key dotfiles that source into this repo.

Symlinks aren't always available so I have chosen to always cop these files that act as the symlinks.

DOTFILES=$HOME/dotfiles
[ ! -d "$HOME/dotfiles/.git" ] && git clone https://github.com/neozenith/dotfiles $HOME/dotfiles
[ ! -d "$HOME/dotfiles/zsh/scripts/aliases_work.sh" ] && touch $HOME/dotfiles/zsh/scripts/aliases_work.sh
[ ! -d "$HOME/dotfiles/bash/aliases_work.sh" ] && touch $HOME/dotfiles/scripts/aliases_work.sh
[ ! -d "$HOME/dotfiles/.vim/autoload/.git" ] && git clone https://github.com/junegunn/vim-plug.git $HOME/dotfiles/.vim/autoload
cp -rv $DOTFILES/.gitconfig ~/.gitconfig

cp -rv $DOTFILES/.zshrc_link ~/.zshrc
cp -rv $DOTFILES/.bashrc_link ~/.bashrc

cp -rv $DOTFILES/.vimrc_link ~/.vimrc
cp -rv $DOTFILES/.tmux_link.conf ~/.tmux.conf
cp -rv $DOTFILES/nvim ~/.config/nvim
eval "$(pyenv init --path)"
curl -fsSL https://raw.githubusercontent.com/neozenith/python-onboarding-guide/main/latest_penv_versions.py | python3
# Plugins: Install / Update / Prune
nvim +PlugInstall +PlugUpdate +PlugClean! +qall
nvim +checkhealth

List latest available Python3 versions in PyEnv

curl -fsSL https://raw.githubusercontent.com/neozenith/python-onboarding-guide/main/latest_penv_versions.py | python3

From here you'll have to manually explore the respective <shell>/scripts/ folders for what is needed.

To change default shell to zsh.

sudo chsh -s /bin/zsh <myUserName>

Highlights


Screenshots

Vim sample with file explorer

Vim sample with autocomplete


Git Bash Prompt

Screenshot of Git Prompt

Inspired by the beautiful piece of bash scripting that is Git Radar yet having been in companies where due to their git security setup it made git-radar unusable.

So I have built out a basic version of git-radar. This version does not run git fetch automatically in the background so you will need to run that manually.

If you want it without my complete dotfiles setup then:

Download bash-scripts/function_parse_git_prompt.sh to your home directory

curl -o $HOME/function_parse_git_prompt.sh https://github.com/neozenith/dotfiles/blob/master/bash-scripts/function_parse_git_prompt.sh

and add the following to your .bash_profile or .bashrc.

source $HOME/function_parse_git_prompt.sh
export PS1="\e[0;32m\w\e[m"
export PS1="$PS1 \$(parse_git_prompt)"
export PS1="$PS1\nλ "

Developing and Maintaining

.vimrc

  • The key entry file for vim configuration.
  • This should only source vim scripts for features and commenting out one shouldn't affect others.

.vim/mysubcript.vim

  • Supporting files are located in .vim/ and are sourced using the runtime path.

install.sh / install.bat

  • These have 5-7 goals:
    • Install supporting tools like Ruby / Python / CMake / Node
    • (Optional) Install and build latest Vim from Source
    • Install .vimrc
    • Install .vim/ and associated .vim/*.vim scripts.
    • Install Vim-Plug into .vim/bundle/Plug.vim/autoload
    • Start Vim to run vim +PlugInstall +PlugUpdate +qall to install plugins managed by Plug.
    • (Optional) Build and install YouCompleteMe
  • Rerunning the install.sh / install.bat should shortcut the install and just update plugins.

nvim/init.vim

  • This file should not change but will get symlinked to ~/.config/nvim/init.vim
  • This file will source ~/.vimrc and match existing plugin configuration.

Plugins

Update Plugins

vim +PlugUpdate +qall

Adding Plugins

See Plug documentation


Resources and Training

Getting Started and Getting Advanced with Vim

These blogs have been hugely influential and informative in making the switch.

Onboarding

Core

Extending


Credits

Huge thanks for everything you have done for the VIM community.