From e111ba2e772ecddc697b8f31681141fd1a8381c5 Mon Sep 17 00:00:00 2001 From: Munif Tanjim Date: Fri, 29 Oct 2021 15:32:47 +0600 Subject: [PATCH] add copy-neovim-config --- copy-neovim-config | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 copy-neovim-config diff --git a/copy-neovim-config b/copy-neovim-config new file mode 100755 index 0000000..7214ac9 --- /dev/null +++ b/copy-neovim-config @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -eu + +declare -r red='\e[31m' +declare -r yellow='\e[33m' +declare -r blue='\e[34m' +declare -r magenta='\e[35m' +declare -r cyan='\e[36m' +declare -r normal='\e[39m' + +echo -e "${magenta}==========================================" +echo -e "${magenta}= ${blue}Copy Neovim Config to Remote Machine${magenta} =" +echo -e "${magenta}==========================================" +echo -e "${normal}" + +declare -a args=($@) + +if $(test ${#args[@]} -lt 1); then + echo -e "${red}[error]${normal} missing arg: TARGET" + echo -e "${normal}" + exit 1 +fi + +declare -r target="${args[${#args[@]}-1]%%:*}" + +unset args[${#args[@]}-1] + +set -- "${args[@]}" + +echo -e "${blue}TARGET: ${cyan}${target}" +echo -e "${normal}" + +echo -e "${blue}Copying ${cyan}~/.config/nvim/${normal}" +echo -e "${normal}" +ssh $@ ${target} 'mkdir -p ~/.config/nvim' +scp $@ -r "${XDG_CONFIG_HOME:-${HOME}/.config}/nvim" "${target}:~/.config/" +echo -e "${normal}" + +echo -e "${magenta}Done!${normal}" -- knotmirror 0.0.1