aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin/log/shellrc
blob: a39e2917ba5c2efa13a75b650e2e3849307aaeb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# about vimwiki
alias cdl='cd ~/log'
alias chw='tig -C ~/log'
ww() { entry="${1:-plan.context}"; vim ~/log/${entry%%.md}.md; }
wj() { echo "$@" >>~/log/buffer.md; }
wg() { grep -r "$@" --color --exclude-dir={logseq,.git,.obsidian} ~/log; }
wi() { cat ~/log/${1%%.md}.md; }
wD() { rm ~/log/${1%%.md}.md; }
alias dia='diary'
alias dias='diary specify'
alias diaa='diary print'
alias diat='diary today'

# Filter frontmatter
wf() {
  grep -m1 --include='*md' -n -o "$@" -R ~/log | \
  while IFS=: read file number pattern; do
    end_of_frontmatter=$(grep -m2 -n -P '\-\-\-' $file | sed -n 2p | cut -d: -f1)
    [ $number -lt "${end_of_frontmatter:-0}" ] && echo $file
  done
}