[feature] bridge open
command on WSL
This commit is contained in:
parent
afc81a5d07
commit
75efd71703
17
bin/bm
17
bin/bm
|
@ -7,6 +7,10 @@ if set -q BOOKMARK_SEARCHER
|
||||||
else
|
else
|
||||||
set BOOKMARK_SEARCHER fzf --layout reverse
|
set BOOKMARK_SEARCHER fzf --layout reverse
|
||||||
end
|
end
|
||||||
|
if string match -iq '*microsoft*' (uname -r)
|
||||||
|
alias open='powershell.exe -noprofile start-process'
|
||||||
|
alias disown='echo done' # no need to disown on WSL
|
||||||
|
end
|
||||||
|
|
||||||
function _help
|
function _help
|
||||||
echo "Organize your bookmark with markdown"
|
echo "Organize your bookmark with markdown"
|
||||||
|
@ -25,7 +29,7 @@ function _help
|
||||||
echo ' bm search with $BOOKMARK_SEARCHER and then open selected'
|
echo ' bm search with $BOOKMARK_SEARCHER and then open selected'
|
||||||
end
|
end
|
||||||
|
|
||||||
function list
|
function list_all
|
||||||
set -e categories
|
set -e categories
|
||||||
set -e names
|
set -e names
|
||||||
for arg in $argv
|
for arg in $argv
|
||||||
|
@ -38,7 +42,7 @@ function list
|
||||||
_filter_category $categories < $BOOKMARK_PATH | _filter_name $names
|
_filter_category $categories < $BOOKMARK_PATH | _filter_name $names
|
||||||
end
|
end
|
||||||
|
|
||||||
function open
|
function open_by_keyword
|
||||||
if not count $argv &>/dev/null
|
if not count $argv &>/dev/null
|
||||||
_search
|
_search
|
||||||
else
|
else
|
||||||
|
@ -98,11 +102,10 @@ function _filter_name
|
||||||
end
|
end
|
||||||
|
|
||||||
function _open_urls
|
function _open_urls
|
||||||
set -q BROWSER; or set BROWSER xdg-open
|
|
||||||
set LINK_PATTERN '\[(.*?)\]\((.*?)\)'
|
set LINK_PATTERN '\[(.*?)\]\((.*?)\)'
|
||||||
while read LINE
|
while read LINE
|
||||||
if set link (string match -r $LINK_PATTERN $LINE)
|
if set link (string match -r $LINK_PATTERN $LINE)
|
||||||
$BROWSER $link[3] &>/dev/null &
|
open $link[3] &>/dev/null &
|
||||||
disown
|
disown
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
end
|
end
|
||||||
|
@ -120,7 +123,11 @@ function _search
|
||||||
end
|
end
|
||||||
|
|
||||||
switch $argv[1]
|
switch $argv[1]
|
||||||
case open list help update
|
case list
|
||||||
|
list_all $argv[2..-1]
|
||||||
|
case open
|
||||||
|
open_by_keyword $argv[2..-1]
|
||||||
|
case help update
|
||||||
$argv[1..-1]
|
$argv[1..-1]
|
||||||
case '*'
|
case '*'
|
||||||
_search
|
_search
|
||||||
|
|
|
@ -51,6 +51,10 @@ if status is-interactive
|
||||||
alias issh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
|
alias issh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
|
||||||
alias iscp='scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
|
alias iscp='scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
|
||||||
alias dt='date "+%Y%m%d-%H%M%S"'
|
alias dt='date "+%Y%m%d-%H%M%S"'
|
||||||
|
if string match -iq '*microsoft*' (uname -r)
|
||||||
|
alias open='powershell.exe -noprofile start-process'
|
||||||
|
alias xdg-open='open'
|
||||||
|
end
|
||||||
|
|
||||||
# === PATH and file sourcing
|
# === PATH and file sourcing
|
||||||
append_paths ~/go/bin ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin
|
append_paths ~/go/bin ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin
|
||||||
|
|
Loading…
Reference in New Issue
Block a user