commit c70ac1789284ad1e1566c28147849a561ea80051
parent 093618287d6cb1fba5246238c48de1be358723b9
Author: Sven Möller <sven-moeller@outlook.de>
Date: Tue, 21 Dec 2021 07:53:54 +0100
Improvements
Diffstat:
4 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/bash/.bashrc b/bash/.bashrc
@@ -6,3 +6,4 @@ alias vim="nvim"
alias nb="newsboat"
alias gs="git status"
alias gd="git diff"
+alias o="xdg-open"
diff --git a/bin/.local/bin/bm b/bin/.local/bin/bm
@@ -1,5 +1,7 @@
#!/bin/sh
+selector=fzf
+
[ -z "$BM_DIR" ] \
&& echo "No directory specified!" \
&& exit 1
@@ -49,9 +51,9 @@ interactive () {
list="$1"
actions="open\narchive\nfavorite\nunread\ndelete\n"
while :; do
- line="$(list "$list" | fzf | awk '{print $1}')"
+ line="$(list "$list" | "$selector" | awk '{print $1}')"
if [ -z "$line" ]; then exit; fi
- action="$(printf "$actions" | grep -v "$list" | fzf)"
+ action="$(printf "$actions" | grep -v "$list" | "$selector")"
if [ -z "$action" ]; then exit; fi
case "$action" in
unread|favorite|archive) move "$line" "$list" "$action" ;;
@@ -65,19 +67,46 @@ sync () {
git pull && git push
}
+html () {
+ echo '<!DOCTYPE html>'
+ echo '<html>'
+ echo '<head>'
+ echo '<meta charset="utf-8">'
+ echo '<title>Bookmarks</title>'
+ echo '</head>'
+ echo '<body>'
+ echo "<h1>Bookmarks</h1>"
+ to_html favorite
+ to_html unread
+ echo '</body>'
+ echo '</html>'
+}
+
+to_html ()
+{
+ echo "<h2>$1</h2>"
+ echo "<ul>"
+ sed -e 's_^\(\S*\)\s*$_\1 \1_' -e 's_\s_">_' "$BM_DIR/$1" -e 's_^_<li><a href="_' -e 's_$_</a></li>_'
+ echo "</ul>"
+}
+
help () {
bin="$(basename $1)"
echo "Usage: $bin [COMMAND]"
echo "Or: $bin URL [TITLE]"
echo ""
echo "Commands:"
- cat $1 | grep -E "^\s*[a-z|]+)" | awk '{print "\t"$1}'
+ grep -E "^ [a-z|]+)" $1 | sed 's/)//' | tr '|' '\n' | awk '{print "\t"$1}'
}
if [ -z "$1" ]; then "$0" "unread"; exit; fi
case "$1" in
- unread|favorite|archive) interactive "$1" ;;
- git|sync) "$@"; exit ;;
- http://*|https://*) add "$1" "$2"; exit ;;
- *) help "$0"; exit ;;
+ unread|favorite|archive)
+ interactive "$1" ;;
+ git|sync|html)
+ "$@"; exit ;;
+ http://*|https://*)
+ add "$1" "$2"; exit ;;
+ *)
+ help "$0"; exit ;;
esac
diff --git a/newsboat/.newsboat/config b/newsboat/.newsboat/config
@@ -35,3 +35,4 @@ bind-key a toggle-show-read-feeds
bind-key S reload-all
bind-key ESC quit
bind-key o open-in-browser-and-mark-read
+bind-key M bookmark
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
@@ -3,6 +3,6 @@ set tabstop=4
set shiftwidth=4
set number
-set list listchars=tab:>-,lead:.,trail:.
+set list listchars=tab:>-,lead:.,trail:.,space:.
set copyindent
set colorcolumn=80