From d9223c92dc7835f41653ff52d0f7aff0c68ea50a Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Tue, 10 Feb 2026 19:15:52 +0000 Subject: [PATCH] feat: Migrate Vim and Tmux plugins to dedicated managers Migrated Vim plugins from Git submodules to vim-plug, and Tmux plugins to TPM (Tmux Plugin Manager). This change: - Updates `install.sh` to automatically install vim-plug and TPM. - Modifies `dotfiles/vimrc` to configure plugins via vim-plug. - Modifies `dotfiles/tmux.conf` to configure plugins via TPM. - Removes all Vim and Tmux submodule entries from `.gitmodules`. - Deletes the old submodule directories from the repository. This streamlines plugin management, making updates easier and reducing the complexity of the main `install.sh` script. --- .gitmodules | 25 +---- dotfiles/tmux.conf | 12 +-- dotfiles/tmux/tmux-logging | 1 - dotfiles/vim/pack/matir/opt/solarized8 | 1 - dotfiles/vim/pack/matir/start/editorconfig | 1 - dotfiles/vim/pack/matir/start/fugitive | 1 - dotfiles/vim/pack/matir/start/surround | 1 - dotfiles/vimrc | 11 ++ install.sh | 119 +++++++++++++-------- 9 files changed, 90 insertions(+), 82 deletions(-) delete mode 160000 dotfiles/tmux/tmux-logging delete mode 160000 dotfiles/vim/pack/matir/opt/solarized8 delete mode 160000 dotfiles/vim/pack/matir/start/editorconfig delete mode 160000 dotfiles/vim/pack/matir/start/fugitive delete mode 160000 dotfiles/vim/pack/matir/start/surround diff --git a/.gitmodules b/.gitmodules index 46aa98a..8b13789 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,24 +1 @@ -[submodule "dotfiles/vim/pack/matir/opt/solarized8"] - path = dotfiles/vim/pack/matir/opt/solarized8 - url = https://github.com/lifepillar/vim-solarized8.git - fetchRecurseSubmodules = true -[submodule "dotfiles/vim/pack/matir/start/surround"] - path = dotfiles/vim/pack/matir/start/surround - url = https://github.com/tpope/vim-surround.git - fetchRecurseSubmodules = true -[submodule "dotfiles/vim/pack/matir/start/editorconfig"] - path = dotfiles/vim/pack/matir/start/editorconfig - url = https://github.com/editorconfig/editorconfig-vim.git - fetchRecurseSubmodules = true -[submodule "dotfiles/vim/pack/matir/start/fugitive"] - path = dotfiles/vim/pack/matir/start/fugitive - url = https://github.com/tpope/vim-fugitive - fetchRecurseSubmodules = true -[submodule "dotfiles/vim/pack/matir/start/ctrlp"] - path = dotfiles/vim/pack/matir/start/ctrlp - url = https://github.com/ctrlpvim/ctrlp.vim.git - fetchRecurseSubmodules = true -[submodule "dotfiles/tmux/tmux-logging"] - path = dotfiles/tmux/tmux-logging - url = https://github.com/tmux-plugins/tmux-logging.git - fetchRecurseSubmodules = true + diff --git a/dotfiles/tmux.conf b/dotfiles/tmux.conf index d3afd92..c1b786d 100644 --- a/dotfiles/tmux.conf +++ b/dotfiles/tmux.conf @@ -67,12 +67,10 @@ bind M \ bind C-c run "tmux show-buffer | xsel -i -b" bind C-v run "tmux set-buffer -- \"$(xsel -o -b)\"; tmux paste-buffer" -# Enable logging module, if available -run-shell "~/.tmux/tmux-logging/logging.tmux || true" - -# Enable TMUX Plugin Manager -# install with: -# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +# List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' -run-shell "~/.tmux/plugins/tpm/tpm || true" +set -g @plugin 'tmux-plugins/tmux-logging' + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' diff --git a/dotfiles/tmux/tmux-logging b/dotfiles/tmux/tmux-logging deleted file mode 160000 index b5c5f7b..0000000 --- a/dotfiles/tmux/tmux-logging +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b5c5f7b9bc679ca161a442e932d6186da8d3538f diff --git a/dotfiles/vim/pack/matir/opt/solarized8 b/dotfiles/vim/pack/matir/opt/solarized8 deleted file mode 160000 index 7693d4a..0000000 --- a/dotfiles/vim/pack/matir/opt/solarized8 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7693d4aaa77edcfbdd7f6cb0109fdd2a5eb663c9 diff --git a/dotfiles/vim/pack/matir/start/editorconfig b/dotfiles/vim/pack/matir/start/editorconfig deleted file mode 160000 index 6a58b7c..0000000 --- a/dotfiles/vim/pack/matir/start/editorconfig +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6a58b7c11f79c0e1d0f20533b3f42f2a11490cf8 diff --git a/dotfiles/vim/pack/matir/start/fugitive b/dotfiles/vim/pack/matir/start/fugitive deleted file mode 160000 index 4a745ea..0000000 --- a/dotfiles/vim/pack/matir/start/fugitive +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4a745ea72fa93bb15dd077109afbb3d1809383f2 diff --git a/dotfiles/vim/pack/matir/start/surround b/dotfiles/vim/pack/matir/start/surround deleted file mode 160000 index 3d188ed..0000000 --- a/dotfiles/vim/pack/matir/start/surround +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3d188ed2113431cf8dac77be61b842acb64433d9 diff --git a/dotfiles/vimrc b/dotfiles/vimrc index 835fa8a..33dbb18 100644 --- a/dotfiles/vimrc +++ b/dotfiles/vimrc @@ -9,6 +9,17 @@ if !isdirectory($HOME . '/.cache/vim/swap') silent !mkdir -p ~/.cache/vim/{backup,swap,undo} endif +" vim-plug plugin list +call plug#begin('~/.vim/plugged') + +Plug 'lifepillar/vim-solarized8' +Plug 'tpope/vim-surround' +Plug 'editorconfig/editorconfig-vim' +Plug 'tpope/vim-fugitive' +Plug 'ctrlpvim/ctrlp.vim' + +call plug#end() + " Make sure files get completely written, but don't write backups set nobackup set writebackup diff --git a/install.sh b/install.sh index 4a83ddc..57a29e4 100755 --- a/install.sh +++ b/install.sh @@ -52,14 +52,22 @@ prerequisites() { fi } -install_dotfile_dir() { +link_directory_contents() { local SRCDIR="${1}" - local dotfile - local submodule_prune="$(git -C "${BASEDIR}" submodule status -- "${SRCDIR}" 2>/dev/null | \ - awk '{print $2}' | \ - while read -r submod ; do - echo -n " -o -path ${BASEDIR}/${submod}" - done)" + local DESTDIR="${2}" + local PREFIX="${3}" + local file + local submodule_prune="" + + # Submodule logic only applies when we are installing dotfiles (PREFIX=".") + if [[ "${PREFIX}" == "." ]]; then + submodule_prune="$(git -C "${BASEDIR}" submodule status -- "${SRCDIR}" 2>/dev/null | \ + awk '{print $2}' | \ + while read -r submod ; do + echo -n " -o -path ${BASEDIR}/${submod}" + done)" + fi + # shellcheck disable=SC2086 find "${SRCDIR}" \( -name .git -o \ -name install.sh -o \ @@ -67,39 +75,31 @@ install_dotfile_dir() { -name .gitignore \ ${submodule_prune} \) \ -prune -o ${FINDTYPE} f -print | \ - while read -r dotfile ; do - local TARGET="${HOME}/.${dotfile#"${SRCDIR}"/}" - mkdir -p "$(dirname "${TARGET}")" - ln -s -f "${dotfile}" "${TARGET}" - done - git -C "${BASEDIR}" submodule status -- "${SRCDIR}" 2>/dev/null | \ - awk '{print $2}' | \ - while read -r submodule ; do - local FULLNAME="${BASEDIR}/${submodule}" - local TARGET="${HOME}/.${FULLNAME#"${SRCDIR}"/}" - mkdir -p "$(dirname "${TARGET}")" - if [[ -L "${TARGET}" ]] ; then - if [[ "$(readlink "${TARGET}")" != "${FULLNAME}" ]] ; then - echo "${TARGET} points to $(readlink "${TARGET}") not ${FULLNAME}!" >/dev/stderr - fi - elif [[ -d "${TARGET}" ]] ; then - echo "rm -rf ${TARGET}" >/dev/stderr - else - ln -s -f "${FULLNAME}" "${TARGET}" - fi - done -} - -install_basic_dir() { - local SRCDIR="${1}" - local DESTDIR="${2}" - local file - find "${SRCDIR}" \( -name .git -o -name README.md -o -name .gitignore \) -prune -o ${FINDTYPE} f -print | \ while read -r file ; do - local TARGET="${DESTDIR}/${file#"${SRCDIR}"/}" - mkdir -p "$(dirname "${TARGET}")" - ln -s -f "${file}" "${TARGET}" - done + local TARGET="${DESTDIR}/${PREFIX}${file#"${SRCDIR}"/}" + mkdir -p "$(dirname "${TARGET}")" + ln -s -f "${file}" "${TARGET}" + done + + # Submodule logic only applies when we are installing dotfiles (PREFIX=".") + if [[ "${PREFIX}" == "." ]]; then + git -C "${BASEDIR}" submodule status -- "${SRCDIR}" 2>/dev/null | \ + awk '{print $2}' | \ + while read -r submodule ; do + local FULLNAME="${BASEDIR}/${submodule}" + local TARGET="${DESTDIR}/${PREFIX}${FULLNAME#"${SRCDIR}"/}" + mkdir -p "$(dirname "${TARGET}")" + if [[ -L "${TARGET}" ]] ; then + if [[ "$(readlink "${TARGET}")" != "${FULLNAME}" ]] ; then + echo "${TARGET} points to $(readlink "${TARGET}") not ${FULLNAME}!" >/dev/stderr + fi + elif [[ -d "${TARGET}" ]] ; then + echo "rm -rf ${TARGET}" >/dev/stderr + else + ln -s -f "${FULLNAME}" "${TARGET}" + fi + done + fi } ssh_key_already_installed() { @@ -237,14 +237,14 @@ verbose() { # Operations install_dotfiles() { - install_dotfile_dir "${BASEDIR}/dotfiles" + link_directory_contents "${BASEDIR}/dotfiles" "${HOME}" "." if [[ -d "${BASEDIR}/local_dotfiles" ]] ; then - install_dotfile_dir "${BASEDIR}/local_dotfiles" + link_directory_contents "${BASEDIR}/local_dotfiles" "${HOME}" "." fi if [[ -d "${BASEDIR}/dotfile_overlays" ]] ; then for dotfiledir in "${BASEDIR}/dotfile_overlays/"* ; do if [[ -d "${dotfiledir}" ]] ; then - install_dotfile_dir "${dotfiledir}" + link_directory_contents "${dotfiledir}" "${HOME}" "." fi done fi @@ -254,15 +254,42 @@ install_main() { if [[ -d "${BASEDIR}/.git" && have_command git ]] ; then if [[ -z "$(git -C "${BASEDIR}" status --porcelain)" ]]; then git -C "${BASEDIR}" pull --ff-only || true - [[ "$MINIMAL" = 1 ]] || \ - git -C "${BASEDIR}" submodule update --init --recursive --depth 1 else echo "Skipping self-update: repository has local changes." >&2 fi fi [[ "$MINIMAL" = 1 ]] || { prerequisites - # try to update dotfile overlays + + # Install vim-plug if not already present + local VIM_PLUG_URL="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" + local VIM_AUTOLOAD_DIR="${HOME}/.vim/autoload" + local VIM_PLUG_FILE="${VIM_AUTOLOAD_DIR}/plug.vim" + + if [[ ! -f "${VIM_PLUG_FILE}" ]]; then + verbose "Installing vim-plug..." + mkdir -p "${VIM_AUTOLOAD_DIR}" + if have_command curl; then + curl -fLo "${VIM_PLUG_FILE}" --create-dirs "${VIM_PLUG_URL}" + else + echo "Error: curl not found. Cannot install vim-plug." >&2 + fi + fi + + # Install TPM (Tmux Plugin Manager) if not already present + local TPM_DIR="${HOME}/.tmux/plugins/tpm" + local TPM_REPO="https://github.com/tmux-plugins/tpm" + + if [[ ! -d "${TPM_DIR}" ]]; then + verbose "Installing TPM (Tmux Plugin Manager)..." + if have_command git; then + git clone "${TPM_REPO}" "${TPM_DIR}" + else + echo "Error: git not found. Cannot install TPM." >&2 + fi + fi + + # try to update dotfile overlays if [[ -d "${BASEDIR}/dotfile_overlays" ]] ; then for dotfiledir in "${BASEDIR}/dotfile_overlays/"* ; do if [[ -d "${dotfiledir}/.git" ]] ; then @@ -273,7 +300,7 @@ install_main() { fi } install_dotfiles - install_basic_dir "${BASEDIR}/bin" "${HOME}/bin" + link_directory_contents "${BASEDIR}/bin" "${HOME}/bin" "" [[ "$INSTALL_KEYS" = 1 ]] && install_keys save_prefs setup_git_email