config/shell: some text processing aliases

This commit is contained in:
xerus2000 2021-01-03 15:01:52 +01:00
parent 19b66cfa46
commit d93f38bb93
2 changed files with 15 additions and 4 deletions

View File

@ -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

10
.local/bin/mdoh Executable file
View File

@ -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