zshify 1.0.49 → 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/prompt.zsh +1 -118
  2. package/package.json +1 -1
package/bin/prompt.zsh CHANGED
@@ -1,119 +1,2 @@
1
1
  #!/bin/zsh
2
- cat >>~/.zshrc <<ZSHRC
3
- HISTFILE=~/.zsh_history
4
- HISTSIZE=5000
5
- SAVEHIST=5000
6
-
7
- setopt EXTENDED_HISTORY
8
- setopt HIST_FIND_NO_DUPS
9
- setopt HIST_IGNORE_ALL_DUPS
10
- setopt INC_APPEND_HISTORY_TIME
11
- setopt RM_STAR_SILENT
12
-
13
- preexec() {
14
- TIMER=$(print -P %D{%s%3.})
15
- }
16
-
17
- precmd() {
18
- CURRENT_BRANCH=$(git branch --show-current 2>/dev/null)
19
- NEWLINE=$'\n'
20
- PROMPT="$newline%F{cyan}%~ %F{white}$CURRENT_BRANCH$NEWLINE%(?.%F{green}.%F{red})%B%(!.#.>)%b%f "
21
- newline=$NEWLINE
22
- if [ $TIMER ]; then
23
- NOW=$(print -P %D{%s%3.})
24
- local diff=$(($NOW - $TIMER))
25
- local ms=$((diff % 1000))
26
- local s=$(((diff / 1000) % 60))
27
- local m=$(((diff / 1000) / 60))
28
- if ((m > 0)); then
29
- local ELAPSED="${m}m ${s}s"
30
- else
31
- local ELAPSED="${s}.${ms}s"
32
- fi
33
- RPROMPT="%(?.%F{green}.%F{red})${ELAPSED}%f"
34
- fi
35
- unset TIMER
36
- }
37
-
38
- # aliases
39
- alias zshrc='code ~/.zshrc'
40
-
41
- # make and change to directory
42
- cdx() {
43
- mkdir -p $1 && cd $1
44
- }
45
-
46
- # better listing
47
- lsx() {
48
- tree --filesfirst -aCL 1 | sed -e 's/├── //g' -e 's/└── //g' | tail -n +2
49
- }
50
-
51
- # create github repository, pass --private to create private repository
52
- mkrepo() {
53
- command git init
54
- command git add -A 2>/dev/null
55
- command git commit -m "$(date)" 2>/dev/null
56
-
57
- if [[ "$#" == "0" ]]; then
58
- command gh repo create $(basename $(pwd)) -d '' --push -s . --public
59
- else
60
- command gh repo create $(basename $(pwd)) -d '' --push -s . "$@"
61
- fi
62
- }
63
-
64
- # git add & git commit at once | git push
65
- @git() {
66
- if [[ "$#" == "0" ]]; then
67
- command git add -A 2>/dev/null
68
- command git commit -m "$(date)" 2>/dev/null
69
- command git push
70
- elif [[ "$#" == "1" ]]; then
71
- command git add -A 2>/dev/null
72
- command git commit -m "$1" 2>/dev/null
73
- command git push
74
- fi
75
- }
76
-
77
- # manage npm packages using yarn (just add @ in front of npm)
78
- @npm() {
79
- if [[ "$1" == "install" ]]; then
80
- command yarn add ${@:2}
81
- elif [[ "$1" == "uninstall" ]]; then
82
- command yarn remove ${@:2}
83
- fi
84
- }
85
-
86
- # kill pid by port
87
- close() {
88
- lsof -i :$1 | awk '{print $2}' | tail +2 | xargs kill -9
89
- }
90
-
91
- # rename current working dir or an existing folder
92
- rename() {
93
- if [[ "$#" == "1" ]]; then
94
- command [ ! -d "../$1/" ] && rsync -a "$(pwd)/" "../$1" && rm -rf "$(pwd)/" && cd "../$1/"
95
- if [[ $? == 0 && "$TERM_PROGRAM" == "vscode" ]]; then
96
- code -r .
97
- fi
98
- elif [[ "$#" == "2" ]]; then
99
- command [ ! -d "$2/" ] && rsync -a "$1/" "$2" && rm -rf "$1/"
100
- else
101
- command echo "Usage:"
102
- command echo " rename new_dirname ~ renames current working dir"
103
- command echo " rename dirname new_dirname ~ renames existing dir to new"
104
- fi
105
- }
106
-
107
- source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
108
- ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="bg=#000000,fg=#333333"
109
-
110
- source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
111
-
112
- source /opt/homebrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh
113
- HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="fg=green,bold,underline"
114
- HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND="fg=red,bold,underline"
115
- bindkey '^[[A' history-substring-search-up
116
- bindkey '^[[B' history-substring-search-down
117
-
118
- echo "Hello"
119
- ZSHRC
2
+ curl -s https://raw.githubusercontent.com/nrjdalal/mac-setup/main/.zshrc | cat >~/.zshrc
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zshify",
3
- "version": "1.0.49",
3
+ "version": "1.0.52",
4
4
  "description": "A minimalistic touch to your prompt!",
5
5
  "bin": {
6
6
  "prompt": "bin/prompt.zsh"