From a62114c91f2070c8c8453d117f3d81dc113e41ff Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Mon, 25 Mar 2024 16:43:09 +0530 Subject: dotfile update --- zsh/oh-my-zsh/plugins/fastfile/README.md | 85 -------------- zsh/oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh | 128 --------------------- 2 files changed, 213 deletions(-) delete mode 100644 zsh/oh-my-zsh/plugins/fastfile/README.md delete mode 100644 zsh/oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh (limited to 'zsh/oh-my-zsh/plugins/fastfile') diff --git a/zsh/oh-my-zsh/plugins/fastfile/README.md b/zsh/oh-my-zsh/plugins/fastfile/README.md deleted file mode 100644 index 32f619f..0000000 --- a/zsh/oh-my-zsh/plugins/fastfile/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# Fastfile plugin - -This plugin adds a way to reference certain files or folders used frequently using -a global alias or shortcut. - -To use it, add `fastfile` to the plugins array in your zshrc file: - -```zsh -plugins=(... fastfile) -``` - -## Usage - -Example: you access folder `/code/project/backend/database` very frequently. - -First, generate a shortcut with the name `pjdb`: - -```zsh -$ fastfile pjdb /code/project/backend/database -``` - -Next time you want to access it, use `§pjdb`. For example: - -```zsh -$ cd §pjdb -$ subl §pjdb -``` - -where § is the fastfile prefix (see [below](#options) for how to change). - -**Note:** shortcuts with spaces in the name are assigned a global alias -where the spaces have been substituted with underscores (`_`). For example: -a shortcut named `"hello world"` corresponds with `§hello_world`. - -## Functions - -- `fastfile [path/to/file/or/folder]`: generate a shortcut. - If the second argument is not provided, the current directory is used. - -- `fastfile_print `: prints a shortcut, with the format - ` -> `. - -- `fastfile_ls`: lists all shortcuts. - -- `fastfile_rm `: remove a shortcut. - -- `fastfile_sync`: generates the global aliases for the shortcuts. - -### Internal functions - -- `fastfile_resolv `: resolves the location of the shortcut - file, i.e., the file in the fastfile directory where the shortcut path - is stored. - -- `fastfile_get `: get the real path of the shortcut. - -## Aliases - -| Alias | Function | -|--------|------------------| -| ff | `fastfile` | -| ffp | `fastfile_print` | -| ffrm | `fastfile_rm` | -| ffls | `fastfile_ls` | -| ffsync | `fastfile_sync` | - -## Options - -These are options you can set to change certain parts of the plugin. To change -them, add `=` to your zshrc file, before Oh My Zsh is sourced. -For example: `fastfile_var_prefix='@'`. - -- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the - created global aliases. - **Default:** `§` (section sign), easy to type in a german keyboard via the combination - [`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg), - or using `⌥ Option`+`6` in macOS. - -- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end - with a trailing slash. - **Default:** `$HOME/.fastfile/`. - -## Author - -- [Karolin Varner](https://github.com/koraa) diff --git a/zsh/oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh b/zsh/oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh deleted file mode 100644 index 896fed5..0000000 --- a/zsh/oh-my-zsh/plugins/fastfile/fastfile.plugin.zsh +++ /dev/null @@ -1,128 +0,0 @@ -########################### -# Settings - -# These can be overwritten any time. -# If they are not set yet, they will be -# overwritten with their default values - -default fastfile_dir "${HOME}/.fastfile" -default fastfile_var_prefix "§" - -########################### -# Impl - -# -# Generate a shortcut -# -# Arguments: -# 1. name - The name of the shortcut (default: name of the file) -# 2. file - The file or directory to make the shortcut for -# STDOUT: -# => fastfile_print -# -function fastfile() { - test "$2" || 2="." - file=$(readlink -f "$2") - - test "$1" || 1="$(basename "$file")" - name=$(echo "$1" | tr " " "_") - - - mkdir -p "${fastfile_dir}" - echo "$file" > "$(fastfile_resolv "$name")" - - fastfile_sync - fastfile_print "$name" -} - -# -# Resolve the location of a shortcut file (the database file, where the value is written!) -# -# Arguments: -# 1. name - The name of the shortcut -# STDOUT: -# The path to the shortcut file -# -function fastfile_resolv() { - echo "${fastfile_dir}/${1}" -} - -# -# Get the real path of a shortcut -# -# Arguments: -# 1. name - The name of the shortcut -# STDOUT: -# The path -# -function fastfile_get() { - cat "$(fastfile_resolv "$1")" -} - -# -# Print a shortcut -# -# Arguments: -# 1. name - The name of the shortcut -# STDOUT: -# Name and value of the shortcut -# -function fastfile_print() { - echo "${fastfile_var_prefix}${1} -> $(fastfile_get "$1")" -} - -# -# List all shortcuts -# -# STDOUT: -# (=> fastfile_print) for each shortcut -# -function fastfile_ls() { - for f in "${fastfile_dir}"/*(N); do - file=$(basename "$f") # To enable simpler handling of spaces in file names - varkey=$(echo "$file" | tr " " "_") - - # Special format for columns - echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")" - done | column -t -s "|" -} - -# -# Remove a shortcut -# -# Arguments: -# 1. name - The name of the shortcut (default: name of the file) -# STDOUT: -# => fastfile_print -# -function fastfile_rm() { - fastfile_print "$1" - rm "$(fastfile_resolv "$1")" - unalias "${fastfile_var_prefix}${1}" -} - -# -# Generate the aliases for the shortcuts -# -function fastfile_sync() { - for f in "${fastfile_dir}"/*(N); do - file=$(basename "$f") # To enable simpler handling of spaces in file names - varkey=$(echo "$file" | tr " " "_") - - alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'" - done -} - -################################## -# Shortcuts - -alias ff=fastfile -alias ffp=fastfile_print -alias ffrm=fastfile_rm -alias ffls=fastfile_ls -alias ffsync=fastfile_sync - -################################## -# Init - -fastfile_sync -- cgit v1.2.3-59-g8ed1b