diff --git a/dots/.config/zsh/config/profile/profile/env.zsh b/dots/.config/zsh/config/profile/profile/env.zsh index 717c00ad..9a63c7af 100644 --- a/dots/.config/zsh/config/profile/profile/env.zsh +++ b/dots/.config/zsh/config/profile/profile/env.zsh @@ -72,7 +72,6 @@ if command -v nvim >/dev/null 2>&1; then export EDITOR=nvim export VISUAL=nvim export MANPAGER="nvim +Man!" - export NVIM_ENVS_DIR="${HOME}/.nvim-environments" elif command -v vim >/dev/null 2>&1; then export EDITOR=vim export VISUAL=vim diff --git a/dots/.config/zsh/config/profile/profile/functions.zsh b/dots/.config/zsh/config/profile/profile/functions.zsh index 5cb28334..528548de 100644 --- a/dots/.config/zsh/config/profile/profile/functions.zsh +++ b/dots/.config/zsh/config/profile/profile/functions.zsh @@ -73,76 +73,6 @@ update_cargo_crates() { } ### Neovim ### -nvim-env() { - # If using ZSH uncomment the line below, requires emulate - emulate -L ksh - local nvim_env - local nvim_env_path - local nvim_env_full_path - - nvim_env="${1:-primary}" - nvim_env_path="${NVIM_ENVS_DIR}" - nvim_env_full_path="$nvim_env_path/$nvim_env" - - declare -A nvim_syml_paths=(["$HOME/.config/nvim"]="$nvim_env_full_path/config" ["$HOME/.local/share/nvim"]="$nvim_env_full_path/share") - mkdir -p "${nvim_env_full_path}/share" - - local red='\033[0;31m' - local cyan='\033[0;36m' - local green='\033[0;32m' - local light_green='\033[1;32m' - local reset='\033[0m' - - # Check that the given environment exists - if [[ ! -d "$nvim_env_full_path" ]]; then - printf "${red}Error:\n\tUnable to locate environment, ${reset}\"${cyan}%s\"\n\t\"%s\"\n${reset}" "$nvim_env" "$nvim_env_full_path" >&2 - return 1 - fi - - local symlink_src - local symlink_dst - for syml_key in "${!nvim_syml_paths[@]}"; do - symlink_src="${nvim_syml_paths[$syml_key]}" - symlink_dst="$syml_key" - - # Check that the configuration path exist from our env - if [[ ! -d "$symlink_src" ]]; then - printf "${red}ERROR:\n\tUnable to find configuration:${reset} \"${cyan}%s${reset}\"${red} in environment ${reset}\"${cyan}%s${reset}\"${red}\n\tConsider creating it with ${reset} \"${cyan}mkdir -p %s${reset}\"\n" "$symlink_src" "$nvim_env" "$symlink_src" >&2 - return 1 - fi - - # If a directory (not a symlink) exists in where we want to write a symlink refuse to overwrite - if [[ -r "$symlink_dst" ]] && [[ ! -L "$symlink_dst" ]]; then - printf "${red}ERROR:\n\tNeovim configuration to be replaced is not a symlink, please remove the files before proceeding, issue file:${reset}\n\t\"${cyan}%s${reset}\"\n" "$symlink_dst" >&2 - return 1 - fi - - # If we find an existing symlink, try to delete it - if [[ -L "$symlink_dst" ]]; then - local linked_sym - linked_sym="$(readlink "$symlink_dst")" - printf "${light_green}Attemping to remove symlink:${reset}\n\t${cyan}%s${reset} -> ${cyan}%s${reset}\n" "$linked_sym" "$symlink_dst" - if ! rm "$symlink_dst"; then - printf "${red}ERROR:\n\tFailed to remove symlink:${reset}\n\t${cyan}%s${reset} -> ${cyan}%s${reset}\n" "$linked_sym" "$symlink_dst" >&2 - return 1 - else - printf "${light_green}Successfully removed symlink:${reset}\n\t${cyan}%s${reset} -> ${cyan}%s${reset}\n" "$linked_sym" "$symlink_dst" - fi - fi - - # Actually write the env now we're past our guards - printf "${light_green}Linking:${reset}\n\t${cyan}%s${reset} -> ${cyan}%s${reset}\n" "$symlink_src" "$symlink_dst" - if ! ln -s "$symlink_src" "$symlink_dst"; then - printf "${red}ERROR:\n\tFailed to link:${reset}\n\t${cyan}%s${reset} -> ${cyan}%s${reset}\n" "$symlink_src" "$symlink_dst" >&2 - return 1 - else - printf "${light_green}Successfully linked:${reset}\n\t${cyan}%s${reset} -> ${cyan}%s${reset}\n" "$symlink_src" "$symlink_dst" - fi - printf "${green}%.s─${reset}" $(seq 1 $(tput cols)) - printf "\n" - done -} - DAP-Python-Gen() { local module module="${1}"