aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin/log/shellrc
blob: 504a1298143fd8b0a041ba9ca5ed387281bc3adf (plain)
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
# about vimwiki
alias cdl='cd ~/log'
alias chw='tig -C ~/log'
ww() {
  entry="${1:-inbox}"
  entry="${entry%.md}"
  file=$(find ~/log -name "${entry}*" | head -1)
  $EDITOR $file
}
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
}