summaryrefslogtreecommitdiff
path: root/zsh/.zshrc-mk
blob: 22c12629003acaafe20f49f3cdbe180a36a50ad1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
wr() {
	nvim "$HOME/docs/wr/$1"
}

mnsec() { # Make an encrypted (secure entry).
	[ -z "$DEFAULT_GPG" ] && echo "DEFAULT_GPG not set" && return 
	mkdir -p "/tmp/mksec"
	nvim "/tmp/mksec/$1"
	gpg --encrypt --armor --symmetric -r "$DEFAULT_GPG"  --output "$HOME/docs/wr/sec/$1" "/tmp/mksec/$1"
	rm "/tmp/mksec/$1"
}

rdsec() { # Read a secure entry, will NOT write it back after. 
	[ ! -f "$HOME/docs/wr/sec/$1" ] && echo "File $1 does not exist" && return
	mkdir -p "/tmp/mksec"
	gpg -d --output "/tmp/mksec/$1.decrypted" "$HOME/docs/wr/sec/$1"
	nvim "/tmp/mksec/$1.decrypted"
	rm "/tmp/mksec/$1.decrypted"
}

mdsec() { # Modify a secure entry, writing it back after. 
	[ -z "$DEFAULT_GPG" ] && echo "DEFAULT_GPG not set" && return
	[ ! -f "$HOME/docs/wr/sec/$1" ] && echo "File $1 does not exist" && return
	mkdir -p "/tmp/mksec"
	gpg -d --output "/tmp/mksec/$1.decrypted" "$HOME/docs/wr/sec/$1"
	nvim "/tmp/mksec/$1.decrypted"
	gpg --encrypt --armor --symmetric -r "$DEFAULT_GPG" --output "$HOME/docs/wr/sec/$1" "/tmp/mksec/$1.decrypted"
	rm "/tmp/mksec/$1.decrypted"

}

lssec() {
	ls "$HOME/docs/wr/sec" $@
}

mnrec() {
	wr "rec/$1"
}

mnkic() {
	wr "kic/$1"
}

mndream() { # Dream Record: D~
	if [ -z $1 ] ; then DT="yesterday" else DT="$1" fi 
	mkdir -p "$HOME/docs/wr/dream"
	nvim "$HOME/docs/wr/dream/D$(date --iso-8601 -d $DT).txt"
}

rddream() {
	if [ -z "$1" ] ; then 
		nvim "$HOME/docs/wr/dream"
		return 
	else
		nvim "$HOME/docs/wr/dream/D$(date --iso-8601 -d $DT).txt"
	fi
}

mn() { # Make note 
	wr "mn/$1"
}

lle() { # Life Log Entry: L~
    if [ -z $1 ] ; then DT="today" else DT="$1" fi
    mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)"
    nvim "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)/L$(date --iso-8601 -d $DT).txt"
}

holc () { # Holiday Entry: H~
    if [ -z $1 ] ; then DT="today" else DT="$1" fi
    mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)"
    nvim "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)/H$(date --iso-8601 -d $DT).txt"
}

mer() { # Month End Recap: M~
    if [ -z $1 ] ; then DT="yesterday" else DT="$1" fi
    mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)"
    nvim "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)/M$(date +%Y-%m -d $DT).txt" 
}

yer() { # Year End Recap: Y~
    if [ -z $1 ] ; then DT="yesterday" else DT="$1" fi
    mkdir -p "$HOME/docs/wr/lle/$(date +%Y -d $DT)-12"
    nvim "$HOME/docs/wr/lle/$(date +%Y -d $DT)-12/Y$(date +%Y -d $DT).txt"
}

# old atd and cld, soon to be gotten rid of anyways
# todos... (changed to a~ so it doesn't clash with orgd binaries)
abbrev-alias atd="wr td/todos"
abbrev-alias atdcmp="wr td/todos-cmp"
abbrev-alias atdntd="wr td/todos-ntd"

abbrev-alias cld="wr cld/calendar" 
abbrev-alias cldcmp="wr cld/calendar-cmp"
abbrev-alias cldrec="wr cld/calendar-recurring"