[feature] support WSL
This commit is contained in:
parent
75efd71703
commit
593411237e
14
bin/bm
14
bin/bm
|
@ -8,7 +8,7 @@ else
|
||||||
set BOOKMARK_SEARCHER fzf --layout reverse
|
set BOOKMARK_SEARCHER fzf --layout reverse
|
||||||
end
|
end
|
||||||
if string match -iq '*microsoft*' (uname -r)
|
if string match -iq '*microsoft*' (uname -r)
|
||||||
alias open='powershell.exe -noprofile start-process'
|
alias xdg-open='powershell.exe -noprofile start-process'
|
||||||
alias disown='echo done' # no need to disown on WSL
|
alias disown='echo done' # no need to disown on WSL
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,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_all
|
function list
|
||||||
set -e categories
|
set -e categories
|
||||||
set -e names
|
set -e names
|
||||||
for arg in $argv
|
for arg in $argv
|
||||||
|
@ -42,7 +42,7 @@ function list_all
|
||||||
_filter_category $categories < $BOOKMARK_PATH | _filter_name $names
|
_filter_category $categories < $BOOKMARK_PATH | _filter_name $names
|
||||||
end
|
end
|
||||||
|
|
||||||
function open_by_keyword
|
function open
|
||||||
if not count $argv &>/dev/null
|
if not count $argv &>/dev/null
|
||||||
_search
|
_search
|
||||||
else
|
else
|
||||||
|
@ -105,7 +105,7 @@ function _open_urls
|
||||||
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)
|
||||||
open $link[3] &>/dev/null &
|
echo '' | xdg-open $link[3] &>/dev/null &
|
||||||
disown
|
disown
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
end
|
end
|
||||||
|
@ -123,11 +123,7 @@ function _search
|
||||||
end
|
end
|
||||||
|
|
||||||
switch $argv[1]
|
switch $argv[1]
|
||||||
case list
|
case list open help update
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user