8c18f007131eb242eacae16db85b07f986b08063
- Author
- mapc <musikmichael@web.de>
- Committer
- mapc <musikmichael@web.de>
- Date
Message
Enhance handleing of spaces in filenames
Diff
1diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh
2index 51e48df5bff75c0833f961ab7a2fa67ff020fff2..775e9483e35c045b8cf6c6fbcefc042466d28feb 100644
3--- a/plugins/fastfile/fastfile.plugin.zsh
4+++ b/plugins/fastfile/fastfile.plugin.zsh
5@@ -32,14 +32,17 @@ default fastfile_var_prefix "§"
6 #
7 function fastfile() {
8 test "$2" || 2="."
9- 2=$(readlink -f "$2")
10- test "$1" || 1="$(basename "$2")"
11+ file=$(readlink -f "$2")
12+
13+ test "$1" || 1="$(basename "$file")"
14+ name=$(echo "$1" | tr " " "_")
15+
16
17 mkdir -p "${fastfile_dir}"
18- echo "$2" > "$(fastfile_resolv "$1")"
19+ echo "$file" > "$(fastfile_resolv "$name")"
20
21 fastfile_sync
22- fastfile_print "$1"
23+ fastfile_print "$name"
24 }
25
26 #
27@@ -85,9 +88,13 @@ function fastfile_print() {
28 # (=> fastfle_print) for each shortcut
29 #
30 function fastfile_ls() {
31- for f in $(ls "${fastfile_dir}"); do
32- fastfile_print "$f"
33- done | column -t
34+ for f in "${fastfile_dir}"/*; do
35+ file=`basename "$f"` # To enable simpler handeling of spaces in file names
36+ varkey=`echo "$file" | tr " " "_"`
37+
38+ # Special format for colums
39+ echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
40+ done | column -t -s "|"
41 }
42
43 #
44@@ -108,8 +115,11 @@ function fastfile_rm() {
45 # Generate the aliases for the shortcuts
46 #
47 function fastfile_sync() {
48- for f in $(ls "${fastfile_dir}"); do
49- alias -g "${fastfile_var_prefix}${f}"="$(fastfile_get "$f")"
50+ for f in "${fastfile_dir}"/*; do
51+ file=`basename "$f"` # To enable simpler handeling of spaces in file names
52+ varkey=`echo "$file" | tr " " "_"`
53+
54+ alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
55 done
56 }
57