Personal Vim and Git configuration repository.
This repository manages:
vimrc-> installs to~/.vimrcgitconfig-> installs to~/.gitconfiggitignore_global-> installs to~/.gitignore_globalautoload/plug.vim-> installs to~/.vim/autoload/plug.vim- Source Code Pro in
fonts/source-code-pro/-> links to~/.local/share/fonts/my_vimrc/ - Vim plugins declared in
vimrcthroughvim-plug
Install these tools on the new machine first:
bashgitvimfontconfig, recommended when installing fonts on Linuxcurlorwget, only needed whenautoload/plug.vimis missing from this repository
Do not run the installer with sudo. The script is intended to configure the
current user account only.
Clone the repository to the place where you want to keep the managed configuration:
git clone <repo-url> ~/my_vimrc
cd ~/my_vimrcIf this repository is managed as ~/.vim, clone it there instead:
git clone <repo-url> ~/.vim
cd ~/.vimAlways preview the changes on a new machine:
./install.sh --dry-run --skip-pluginsThe preview shows the files that would be backed up, replaced, linked, or
copied. It does not modify HOME.
Recommended first install:
./install.sh --skip-pluginsThis installs:
~/.vimrc~/.gitconfig~/.gitignore_global~/.vim/autoload/plug.vim
By default, ~/.vimrc, ~/.gitconfig, and ~/.gitignore_global are installed
as symlinks to this repository. This keeps later repository edits effective
immediately.
If you prefer plain files instead of symlinks:
./install.sh --copy --skip-pluginsThe Vim config no longer depends on Monaco on Linux. GUI Vim uses Source Code
Pro on Linux and Monaco on macOS. This repository includes Adobe Source Code Pro
under fonts/source-code-pro/.
Terminal Vim does not use guifont; set the font in your terminal application
instead after installing the font.
To install the repository fonts for the current Linux user:
./install_fonts.shOr include it in the main install:
./install.sh --install-fonts --skip-pluginsBy default, fonts are linked into:
~/.local/share/fonts/my_vimrc/
For example, a repository font at fonts/source-code-pro/SourceCodePro-Regular.ttf
is linked as:
~/.local/share/fonts/my_vimrc/SourceCodePro-Regular.ttf -> /path/to/this/repo/fonts/source-code-pro/SourceCodePro-Regular.ttf
If you prefer copies instead of symlinks:
./install_fonts.sh --copyThe script refreshes the user font cache with fc-cache when available. It is
fine to download an open-source font into fonts/ and link it from there. Do
not commit commercial fonts unless their license explicitly allows
redistribution.
After confirming that Vim starts correctly, install plugins:
vim +'PlugInstall --sync' +qaOr run the full installer:
./install.shThe full installer runs PlugInstall --sync. This downloads plugin repositories
and may execute plugin install hooks declared in vimrc, such as LeaderF's
./install.sh hook.
Before replacing existing config files, install.sh creates a timestamped
backup directory:
~/.config_backup/my_vimrc/YYYYmmdd-HHMMSS/
Typical backup contents:
.vimrc
.vimrc.replaced
.gitconfig
.gitconfig.replaced
.gitignore_global
.gitignore_global.replaced
To restore manually:
cp -a ~/.config_backup/my_vimrc/<timestamp>/.vimrc ~/.vimrc
cp -a ~/.config_backup/my_vimrc/<timestamp>/.gitconfig ~/.gitconfig
cp -a ~/.config_backup/my_vimrc/<timestamp>/.gitignore_global ~/.gitignore_globalIf the current files are symlinks and you want to replace them with the backups, move the symlinks away first:
mv ~/.vimrc ~/.vimrc.from-my_vimrc
mv ~/.gitconfig ~/.gitconfig.from-my_vimrc
mv ~/.gitignore_global ~/.gitignore_global.from-my_vimrc
cp -a ~/.config_backup/my_vimrc/<timestamp>/.vimrc ~/.vimrc
cp -a ~/.config_backup/my_vimrc/<timestamp>/.gitconfig ~/.gitconfig
cp -a ~/.config_backup/my_vimrc/<timestamp>/.gitignore_global ~/.gitignore_global./install.sh [options]
Options:
--link Install config files as symlinks (default).
--copy Install config files as plain file copies.
--install-fonts Link font files from fonts/ into the user font directory.
--skip-vim-plug Do not install ~/.vim/autoload/plug.vim.
--skip-plugins Do not run Vim PlugInstall.
--dry-run Print actions without changing files.
-h, --help Show help.
install.sh only writes under the current user's HOME:
~/.vimrc
~/.gitconfig
~/.gitignore_global
~/.vim/autoload/plug.vim
~/.local/share/fonts/my_vimrc/
~/.config_backup/my_vimrc/
It does not write system directories and does not remove existing config files
without first placing a backup under ~/.config_backup/my_vimrc/.
Plugin installation has a wider trust boundary because Vim plugins are cloned
from the network and plugin install hooks may execute code. Use
./install.sh --skip-plugins first if you want to inspect the environment
before installing plugins.
After installation:
readlink ~/.vimrc
readlink ~/.gitconfig
readlink ~/.gitignore_global
test -f ~/.vim/autoload/plug.vim
vim +'PlugStatus' +qa
git config --global --listIf config files are installed with --copy, readlink will not print anything
for those files. In that case, compare the files directly:
cmp vimrc ~/.vimrc
cmp gitconfig ~/.gitconfig
cmp gitignore_global ~/.gitignore_global