rm trailing newline and optimize script

This commit is contained in:
tavo-wasd 2023-10-18 14:27:00 -06:00
parent 33f4648c23
commit b4a7f847fc
3 changed files with 13 additions and 8 deletions

View file

@ -1,9 +1,10 @@
#!/bin/sh
# Open URLs from bookmarks file
BOOKMARKS="$HOME/Documents/bookmarks"
# Print site names, then get URL based on the name. Exit if empty
name=$(cut -d '-' -f 1 $HOME/Documents/bookmarks | grep -v '^#' | sed '/^\s*$/d' | menu "Site:")
name="$(grep -v '^Watch\slater:\s.*' "$BOOKMARKS" | sed '/^\s*$/d;/^#.*$/d;s/-.*$//g' | menu "Site:")"
[ -z "$name" ] && exit
grep "$name" $HOME/Documents/bookmarks | cut -d '-' -f 2- | tr -d '\n' |
grep "$name" $BOOKMARKS | sed -z 's/^.*-//g;s/\n//g' |
xsel -ib && notify-send "󰃀 Bookmarks" "'$name' copied to clipboard"

View file

@ -28,6 +28,6 @@ HISTTIMEFORMAT="%F %T "
history |
head -n -1 |
fzf --cycle --height=50% --border top --tac --prompt='⯈ ' |
sed -z 's/^.*:[0-9]*\s*//g;s/\s*$//g' |
sed -z 's/^.*:[0-9]*\s*//g;s/\s*$//g;s/\n//g' |
xsel -ib
}

View file

@ -14,17 +14,21 @@ silent! normal! zE
22,37fold
38,43fold
44,46fold
55,60fold
70,73fold
82,94fold
55,63fold
73,76fold
85,87fold
88,90fold
91,97fold
106,111fold
let &fdl = &fdl
let s:l = 5 - ((4 * winheight(0) + 23) / 47)
let s:l = 116 - ((68 * winheight(0) + 23) / 47)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 5
keepjumps 116
normal! 0
let &g:so = s:so_save | let &g:siso = s:siso_save
set hlsearch
nohlsearch
doautoall SessionLoadPost
" vim: set ft=vim :