mirror of
https://github.com/Matir/skel.git
synced 2026-05-25 21:19:09 -07:00
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.
This commit is contained in:
25
.gitmodules
vendored
25
.gitmodules
vendored
@@ -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
|
|
||||||
|
|||||||
@@ -67,12 +67,10 @@ bind M \
|
|||||||
bind C-c run "tmux show-buffer | xsel -i -b"
|
bind C-c run "tmux show-buffer | xsel -i -b"
|
||||||
bind C-v run "tmux set-buffer -- \"$(xsel -o -b)\"; tmux paste-buffer"
|
bind C-v run "tmux set-buffer -- \"$(xsel -o -b)\"; tmux paste-buffer"
|
||||||
|
|
||||||
# Enable logging module, if available
|
# List of plugins
|
||||||
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
|
|
||||||
set -g @plugin 'tmux-plugins/tpm'
|
set -g @plugin 'tmux-plugins/tpm'
|
||||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
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'
|
||||||
|
|||||||
Submodule dotfiles/tmux/tmux-logging deleted from b5c5f7b9bc
Submodule dotfiles/vim/pack/matir/opt/solarized8 deleted from 7693d4aaa7
Submodule dotfiles/vim/pack/matir/start/editorconfig deleted from 6a58b7c11f
Submodule dotfiles/vim/pack/matir/start/fugitive deleted from 4a745ea72f
Submodule dotfiles/vim/pack/matir/start/surround deleted from 3d188ed211
@@ -9,6 +9,17 @@ if !isdirectory($HOME . '/.cache/vim/swap')
|
|||||||
silent !mkdir -p ~/.cache/vim/{backup,swap,undo}
|
silent !mkdir -p ~/.cache/vim/{backup,swap,undo}
|
||||||
endif
|
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
|
" Make sure files get completely written, but don't write backups
|
||||||
set nobackup
|
set nobackup
|
||||||
set writebackup
|
set writebackup
|
||||||
|
|||||||
119
install.sh
119
install.sh
@@ -52,14 +52,22 @@ prerequisites() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dotfile_dir() {
|
link_directory_contents() {
|
||||||
local SRCDIR="${1}"
|
local SRCDIR="${1}"
|
||||||
local dotfile
|
local DESTDIR="${2}"
|
||||||
local submodule_prune="$(git -C "${BASEDIR}" submodule status -- "${SRCDIR}" 2>/dev/null | \
|
local PREFIX="${3}"
|
||||||
awk '{print $2}' | \
|
local file
|
||||||
while read -r submod ; do
|
local submodule_prune=""
|
||||||
echo -n " -o -path ${BASEDIR}/${submod}"
|
|
||||||
done)"
|
# 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
|
# shellcheck disable=SC2086
|
||||||
find "${SRCDIR}" \( -name .git -o \
|
find "${SRCDIR}" \( -name .git -o \
|
||||||
-name install.sh -o \
|
-name install.sh -o \
|
||||||
@@ -67,39 +75,31 @@ install_dotfile_dir() {
|
|||||||
-name .gitignore \
|
-name .gitignore \
|
||||||
${submodule_prune} \) \
|
${submodule_prune} \) \
|
||||||
-prune -o ${FINDTYPE} f -print | \
|
-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
|
while read -r file ; do
|
||||||
local TARGET="${DESTDIR}/${file#"${SRCDIR}"/}"
|
local TARGET="${DESTDIR}/${PREFIX}${file#"${SRCDIR}"/}"
|
||||||
mkdir -p "$(dirname "${TARGET}")"
|
mkdir -p "$(dirname "${TARGET}")"
|
||||||
ln -s -f "${file}" "${TARGET}"
|
ln -s -f "${file}" "${TARGET}"
|
||||||
done
|
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() {
|
ssh_key_already_installed() {
|
||||||
@@ -237,14 +237,14 @@ verbose() {
|
|||||||
# Operations
|
# Operations
|
||||||
|
|
||||||
install_dotfiles() {
|
install_dotfiles() {
|
||||||
install_dotfile_dir "${BASEDIR}/dotfiles"
|
link_directory_contents "${BASEDIR}/dotfiles" "${HOME}" "."
|
||||||
if [[ -d "${BASEDIR}/local_dotfiles" ]] ; then
|
if [[ -d "${BASEDIR}/local_dotfiles" ]] ; then
|
||||||
install_dotfile_dir "${BASEDIR}/local_dotfiles"
|
link_directory_contents "${BASEDIR}/local_dotfiles" "${HOME}" "."
|
||||||
fi
|
fi
|
||||||
if [[ -d "${BASEDIR}/dotfile_overlays" ]] ; then
|
if [[ -d "${BASEDIR}/dotfile_overlays" ]] ; then
|
||||||
for dotfiledir in "${BASEDIR}/dotfile_overlays/"* ; do
|
for dotfiledir in "${BASEDIR}/dotfile_overlays/"* ; do
|
||||||
if [[ -d "${dotfiledir}" ]] ; then
|
if [[ -d "${dotfiledir}" ]] ; then
|
||||||
install_dotfile_dir "${dotfiledir}"
|
link_directory_contents "${dotfiledir}" "${HOME}" "."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -254,15 +254,42 @@ install_main() {
|
|||||||
if [[ -d "${BASEDIR}/.git" && have_command git ]] ; then
|
if [[ -d "${BASEDIR}/.git" && have_command git ]] ; then
|
||||||
if [[ -z "$(git -C "${BASEDIR}" status --porcelain)" ]]; then
|
if [[ -z "$(git -C "${BASEDIR}" status --porcelain)" ]]; then
|
||||||
git -C "${BASEDIR}" pull --ff-only || true
|
git -C "${BASEDIR}" pull --ff-only || true
|
||||||
[[ "$MINIMAL" = 1 ]] || \
|
|
||||||
git -C "${BASEDIR}" submodule update --init --recursive --depth 1
|
|
||||||
else
|
else
|
||||||
echo "Skipping self-update: repository has local changes." >&2
|
echo "Skipping self-update: repository has local changes." >&2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[[ "$MINIMAL" = 1 ]] || {
|
[[ "$MINIMAL" = 1 ]] || {
|
||||||
prerequisites
|
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
|
if [[ -d "${BASEDIR}/dotfile_overlays" ]] ; then
|
||||||
for dotfiledir in "${BASEDIR}/dotfile_overlays/"* ; do
|
for dotfiledir in "${BASEDIR}/dotfile_overlays/"* ; do
|
||||||
if [[ -d "${dotfiledir}/.git" ]] ; then
|
if [[ -d "${dotfiledir}/.git" ]] ; then
|
||||||
@@ -273,7 +300,7 @@ install_main() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
install_dotfiles
|
install_dotfiles
|
||||||
install_basic_dir "${BASEDIR}/bin" "${HOME}/bin"
|
link_directory_contents "${BASEDIR}/bin" "${HOME}/bin" ""
|
||||||
[[ "$INSTALL_KEYS" = 1 ]] && install_keys
|
[[ "$INSTALL_KEYS" = 1 ]] && install_keys
|
||||||
save_prefs
|
save_prefs
|
||||||
setup_git_email
|
setup_git_email
|
||||||
|
|||||||
Reference in New Issue
Block a user