|
@@ -1,15 +1,5 @@
|
|
|
-################################################################################
|
|
|
-# FILE: fastfile.plugin.zsh
|
|
|
-# DESCRIPTION: oh-my-zsh plugin file.
|
|
|
-# AUTHOR: Michael Varner (musikmichael@web.de)
|
|
|
-# VERSION: 1.0.0
|
|
|
-#
|
|
|
-# This plugin adds the ability to on the fly generate and access file shortcuts.
|
|
|
-#
|
|
|
-################################################################################
|
|
|
-
|
|
|
###########################
|
|
|
-# Settings
|
|
|
+# Settings
|
|
|
|
|
|
# These can be overwritten any time.
|
|
|
# If they are not set yet, they will be
|
|
@@ -33,7 +23,7 @@ default fastfile_var_prefix "§"
|
|
|
function fastfile() {
|
|
|
test "$2" || 2="."
|
|
|
file=$(readlink -f "$2")
|
|
|
-
|
|
|
+
|
|
|
test "$1" || 1="$(basename "$file")"
|
|
|
name=$(echo "$1" | tr " " "_")
|
|
|
|
|
@@ -51,7 +41,7 @@ function fastfile() {
|
|
|
# Arguments:
|
|
|
# 1. name - The name of the shortcut
|
|
|
# STDOUT:
|
|
|
-# The path
|
|
|
+# The path to the shortcut file
|
|
|
#
|
|
|
function fastfile_resolv() {
|
|
|
echo "${fastfile_dir}${1}"
|
|
@@ -88,12 +78,12 @@ function fastfile_print() {
|
|
|
# (=> fastfle_print) for each shortcut
|
|
|
#
|
|
|
function fastfile_ls() {
|
|
|
- for f in "${fastfile_dir}"/*; do
|
|
|
- file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
|
|
- varkey=`echo "$file" | tr " " "_"`
|
|
|
+ for f in "${fastfile_dir}"/*; do
|
|
|
+ file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
|
|
+ varkey=`echo "$file" | tr " " "_"`
|
|
|
|
|
|
- # Special format for colums
|
|
|
- echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
|
|
|
+ # Special format for colums
|
|
|
+ echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
|
|
|
done | column -t -s "|"
|
|
|
}
|
|
|
|
|
@@ -102,7 +92,6 @@ function fastfile_ls() {
|
|
|
#
|
|
|
# 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:
|
|
|
# => fastfle_print
|
|
|
#
|
|
@@ -115,11 +104,11 @@ function fastfile_rm() {
|
|
|
# Generate the aliases for the shortcuts
|
|
|
#
|
|
|
function fastfile_sync() {
|
|
|
- for f in "${fastfile_dir}"/*; do
|
|
|
- file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
|
|
- varkey=`echo "$file" | tr " " "_"`
|
|
|
+ for f in "${fastfile_dir}"/*; do
|
|
|
+ file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
|
|
+ varkey=`echo "$file" | tr " " "_"`
|
|
|
|
|
|
- alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
|
|
|
+ alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
|
|
|
done
|
|
|
}
|
|
|
|
|
@@ -133,6 +122,6 @@ alias ffls=fastfile_ls
|
|
|
alias ffsync=fastfile_sync
|
|
|
|
|
|
##################################
|
|
|
-# Init
|
|
|
+# Init
|
|
|
|
|
|
-fastfile_sync
|
|
|
+fastfile_sync
|