From d93f38bb93f6ebe2eb9763cdb3ccf75abdf8b8e1 Mon Sep 17 00:00:00 2001 From: xerus2000 <27jf@pm.me> Date: Sun, 3 Jan 2021 15:01:52 +0100 Subject: [PATCH] config/shell: some text processing aliases --- .config/shell/functions | 9 +++++---- .local/bin/mdoh | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100755 .local/bin/mdoh diff --git a/.config/shell/functions b/.config/shell/functions index 9fdf589..763f830 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -135,9 +135,10 @@ alias graphics='lspci -vnn | grep VGA --color=never' alias vlch="vlc -H | ${PAGER:-less}" alias usergroups="cat /etc/passwd | cut -d':' -f1 | xargs -n 1 id" alias omd="(echo '#+OPTIONS: tags:nil'; xclip -o -selection clipboard) | pandoc -f org-auto_identifiers -t markdown --wrap preserve | xclip -filter" -alias mdo="pandoc -f markdown -t org --wrap preserve" +alias mdo="pandoc -f gfm -t org --wrap preserve" alias mdox="xclip -o -selection clipboard | mdo | xclip -filter" -alias mdoh="sed '/^#\+ /{s/#/*/g;N;s/\n$//}'" + +alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index' alias sc='sudo systemctl' alias scu='systemctl --user' @@ -255,7 +256,7 @@ cl() { # FILES -alias f='noglob fd --hidden --color=always --no-ignore-vcs' +alias f='noglob fd --hidden --no-ignore-vcs' #alias f='find -not -path "*.sync*" -and -not \( -name daten -prune \)' #alias f1='find -mindepth 1 -maxdepth 1' @@ -373,7 +374,7 @@ pdiff() { genssh() { mkdir -p ~/.ssh - test -f ~/.ssh/id_rsa.pub || ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -q -N "" -C ${1:-$(hostname)} + test -f ~/.ssh/id_rsa.pub || ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -q -N "" cat ~/.ssh/id_rsa.pub if test "$OSTYPE" = "cygwin" then cat ~/.ssh/id_rsa.pub>/dev/clipboard diff --git a/.local/bin/mdoh b/.local/bin/mdoh new file mode 100755 index 0000000..167ceb2 --- /dev/null +++ b/.local/bin/mdoh @@ -0,0 +1,10 @@ +#!/bin/sh +# Transforms org to markdown using a simplified regex +sed ':o; s/_\(\w[^_]*\w\)_/\/\1\//g; + /^#\+ /{ + s/^#/*/; To; + :b; s/^\(\**\)#/\1*/g; tb; + n; s/^$//; To; D + }' "$@" +# echo "# one\n\n# two\n## under #two\n_hello under_two_\nnumber #1" | mdoh +