git.fiddlerwoaroof.com
Browse code

chore(zsh): update configuration

Ed Langley authored on 07/12/2019 07:59:53
Showing 10 changed files
... ...
@@ -8,7 +8,7 @@
8 8
 
9 9
 # echo "begin zshrc"
10 10
 
11
-interactive_echo "shell session started for $USER on $TTY at `date`" | tee /dev/stderr | logger
11
+interactive_echo "shell session started for $USER on $TTY at `date`" | logger
12 12
 
13 13
 source $HOME/.localzshrc.sh
14 14
 
... ...
@@ -150,3 +150,4 @@ export CPATH=$CPATH:$HOME/include
150 150
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib
151 151
 export VIMCLOJURE_SERVER_JAR="$HOME/lib/vimclojure/server-2.3.6.jar"
152 152
 export CLON_THEME=el
153
+
... ...
@@ -2,6 +2,11 @@
2 2
 autoload -U regexp-replace
3 3
 GIT_DEBUG=0
4 4
 
5
+
6
+git-bump() {
7
+  git commit -m "${SITE_PREFIX:-}(bump)" --allow-empty
8
+}
9
+
5 10
 git-update-repos() {
6 11
   find . -name .git | (
7 12
     while read -r repo; do
... ...
@@ -6,3 +6,4 @@ if [[ -d "$HOME/.zsh_help" ]]; then
6 6
 fi
7 7
 alias run-help >/dev/null && unalias run-help
8 8
 bindkey -v '^_' run-help
9
+
... ...
@@ -16,7 +16,6 @@
16 16
 
17 17
 # The following lines were added by compinstall
18 18
 
19
-
20 19
 # zstyle ':completion:*' completer _expand _complete #_match _prefix
21 20
 zstyle ':completion:*' completer _list _oldlist _expand _complete _match _prefix #_correct _prefix
22 21
 zstyle ':completion:*' keep-prefix true
... ...
@@ -41,8 +40,17 @@ zstyle :compinstall filename '/Users/elangley/.zsh.d/99-completion.zsh'
41 40
 
42 41
 source $HOME/.zsh.d/nix-zsh-completions/nix.plugin.zsh
43 42
 fpath=($HOME/.zsh.d/completion $fpath $HOME/.zsh.d/nix-zsh-completions)
44
-autoload -U compinit && compinit
45 43
 
46
-compinit
44
+autoload -Uz compinit
45
+
46
+if [[ -n $HOME/.zcompdump(#qN.mh+24) ]]; then
47
+
48
+  echo running compinit
49
+  compinit
50
+  touch $HOME/.zcompdump
51
+else
52
+  compinit -C
53
+fi;
54
+
47 55
 
48 56
 # # End of lines added by compinstall
... ...
@@ -0,0 +1,8 @@
1
+autoload -Uz surround
2
+zle -N delete-surround surround
3
+zle -N add-surround surround
4
+zle -N change-surround surround
5
+bindkey -a cs change-surround
6
+bindkey -a ds delete-surround
7
+bindkey -a ys add-surround
8
+bindkey -M visual S add-surround
... ...
@@ -1,16 +1,11 @@
1
-FORTUNE="$(command -v fortune)"
2
-if [ -x "$FORTUNE" ]; then
3
-  $FORTUNE -ec
4
-fi
1
+# FORTUNE="$(command -v fortune)"
2
+# if [ -x "$FORTUNE" ]; then
3
+#   $FORTUNE -ec
4
+# fi
5 5
 
6
-#zprof
7 6
 
8
-export NVM_DIR="/home/edwlan/.nvm"
9
-[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm
7
+# echo 'zshrc done'
10 8
 
11
-echo 'zshrc done'
9
+# echo plugins done
12 10
 
13
-#THIS MUST BE AT THE END OF THE FILE FOR GVM TO WORK!!!
14
-[[ -s "/Users/edwlan/.gvm/bin/gvm-init.sh" ]] && source "/Users/edwlan/.gvm/bin/gvm-init.sh"
15
-
16
-echo plugins done
11
+# zprof
... ...
@@ -1,7 +1,7 @@
1 1
 #:depends-on:utils
2 2
 export GNU_PREFIX=''
3 3
 platform="$(uname -s)"
4
-interactive_echo the platform is "$platform"
4
+# interactive_echo the platform is "$platform"
5 5
 if [[ $platform == 'Darwin' ]] && command -v gls 2>&1 >/dev/null; then
6 6
 	GNU_PREFIX='g'
7 7
 else
... ...
@@ -80,6 +80,15 @@ function get_forge_function() {
80 80
   echo "${forge}_url"
81 81
 }
82 82
 
83
+function get_forge_root() {
84
+  local forge="$1"
85
+  if command -v "${forge}_root" &>>-; then
86
+    "${forge}_root"
87
+  else
88
+    echo "$GIT_3DP_DIR"/
89
+  fi
90
+}
91
+
83 92
 alias_forge bb github
84 93
 alias_forge gh github
85 94
 alias_forge gl gitlab
... ...
@@ -100,7 +109,7 @@ function git-get() {
100 109
     package=$2
101 110
     shift
102 111
   else
103
-    echo 'usage: <forge> <user> <package> or <forge> <package>'
112
+    echo 'usage: <forge> <user> <package>'
104 113
     return 2
105 114
   fi
106 115
 
... ...
@@ -108,10 +117,12 @@ function git-get() {
108 117
 
109 118
   shift
110 119
 
111
-  cd "$GIT_3DP_DIR"
120
+  local target="$(get_forge_root "$forge")"
121
+  cd "$target"
112 122
 
113 123
   local forge_url_function="${$(get_forge_function "$forge"):?forge not recognized}"
114 124
   git-forge-clone "$forge_url_function"
115 125
   
116 126
   cd "$(basename "$package")"
117 127
 }
128
+
... ...
@@ -4,28 +4,35 @@ savedir() {
4 4
     truncfile 50 $HOME/.gtaliases
5 5
     echo $cmd >> $HOME/.gtaliases
6 6
 }
7
+source "$HOME/.gtaliases"
7 8
 
8 9
 hash -d "desktop=$HOME/Desktop"
9 10
 hash -d "downloads=$HOME/Downloads"
10 11
 hash -d "programming=$HOME/Programming"
11 12
 
13
+
12 14
 git_dir=($HOME/git*_repos)
13 15
 num_git_dirs="$git_dir[(I)$git_dir[-1]]" 
14 16
 if (( num_git_dirs > 0 )); then
15
-  hash -d "g=${git_dir[1]}"
17
+  hash -d "g=${${git_dir[1]}%/}"
18
+
19
+  if [[ -d $HOME/dotfiles ]]; then
20
+    hash -d zsh_conf=$HOME/dotfiles/zsh
21
+    hash -d dotfiles=$HOME/dotfiles
22
+  elif [[ -d ~g/dotfiles ]]; then
23
+    hash -d zsh_conf=~g/dotfiles/zsh
24
+    hash -d dotfiles=~g/dotfiles
25
+  fi
26
+
16 27
 else
17 28
   echo no git directories
29
+
30
+  if [[ -d $HOME/dotfiles ]]; then
31
+    hash -d zsh_conf=$HOME/dotfiles/zsh
32
+    hash -d dotfiles=$HOME/dotfiles
33
+  fi
34
+
18 35
 fi
19 36
 
20 37
 gtdo() { cd ~downloads/"${(j</>)*}" }
21 38
 
22
-if [[ -d $HOME/dotfiles ]]; then
23
-  hash -d zsh_conf=$HOME/dotfiles/zsh
24
-  hash -d dotfiles=$HOME/dotfiles
25
-elif [[ -d $HOME/git_repos ]]; then
26
-  hash -d zsh_conf=$HOME/git_repos/dotfiles/zsh
27
-  hash -d dotfiles=$HOME/git_repos/dotfiles
28
-elif [[ -d $HOME/github_repos ]]; then
29
-  hash -d zsh_conf=$HOME/github_repos/dotfiles/zsh
30
-  hash -d dotfiles=$HOME/github_repos/dotfiles
31
-fi
... ...
@@ -1,5 +1,5 @@
1 1
 # -*- mode: sh; sh-shell: zsh;-*-
2
-#zmodload zsh/zprof
2
+# zmodload zsh/zprof
3 3
 
4 4
 if [[ "$TERM" == "dumb" ]]; then
5 5
     unsetopt zle
... ...
@@ -8,7 +8,7 @@ if [[ "$TERM" == "dumb" ]]; then
8 8
     unfunction precmd
9 9
     unfunction preexec
10 10
     PS1='$ '
11
-else 
11
+else
12 12
   PLUGIN_DIR="${PLUGIN_DIR:-$HOME/.zsh.d}"
13 13
 
14 14
   local script_depends loaded_depends
... ...
@@ -21,6 +21,9 @@ else
21 21
   build_depends() {
22 22
     local -a depends
23 23
     depends=(${(@f)$(get_depends "$1")})
24
+    if [[ -z $depends ]]; then
25
+      script_depends[$1]=-
26
+    fi
24 27
     for depend in $depends; do
25 28
       script_depends[$1]+="$depend:"
26 29
     done
... ...
@@ -28,7 +31,7 @@ else
28 31
 
29 32
   load_depends() {
30 33
     for depend in ${(s<:>)script_depends[$1]}; do
31
-      if [[ -z $loaded_depends[$depend] ]]; then
34
+      if [[ -z $loaded_depends[$depend] && "$depend" != "-" ]]; then
32 35
           loaded_depends[$depend]=1
33 36
           local fn="$PLUGIN_DIR/dependencies/$depend.zsh"
34 37
           if [[ -f $fn ]]; then
... ...
@@ -45,13 +48,18 @@ else
45 48
     done
46 49
   }
47 50
 
48
-  init_scripts=( $PLUGIN_DIR/*.{,z}sh(N) ) 
51
+  init_scripts=( $PLUGIN_DIR/*.{,z}sh(N) )
49 52
 
50 53
   PATH="<<<:$PATH:>>>"
51 54
   for x in $init_scripts; do
52
-    build_depends "$x"
53
-    load_depends "$x"
55
+    if [[ -f ~/zshrc.depends ]]; then
56
+      source ~/zshrc.depends
57
+      load_depends "$x"
58
+    else
59
+      build_depends "$x"
60
+      load_depends "$x"
61
+      echo "script_depends=(${(kv)script_depends})" >| ~/zshrc.depends
62
+    fi
54 63
     source "$x"
55 64
   done
56 65
 fi
57
-