[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
|
||||
end
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -29,7 +29,7 @@ function _help
|
|||
echo ' bm search with $BOOKMARK_SEARCHER and then open selected'
|
||||
end
|
||||
|
||||
function list_all
|
||||
function list
|
||||
set -e categories
|
||||
set -e names
|
||||
for arg in $argv
|
||||
|
@ -42,7 +42,7 @@ function list_all
|
|||
_filter_category $categories < $BOOKMARK_PATH | _filter_name $names
|
||||
end
|
||||
|
||||
function open_by_keyword
|
||||
function open
|
||||
if not count $argv &>/dev/null
|
||||
_search
|
||||
else
|
||||
|
@ -105,7 +105,7 @@ function _open_urls
|
|||
set LINK_PATTERN '\[(.*?)\]\((.*?)\)'
|
||||
while read LINE
|
||||
if set link (string match -r $LINK_PATTERN $LINE)
|
||||
open $link[3] &>/dev/null &
|
||||
echo '' | xdg-open $link[3] &>/dev/null &
|
||||
disown
|
||||
sleep 0.1
|
||||
end
|
||||
|
@ -123,11 +123,7 @@ function _search
|
|||
end
|
||||
|
||||
switch $argv[1]
|
||||
case list
|
||||
list_all $argv[2..-1]
|
||||
case open
|
||||
open_by_keyword $argv[2..-1]
|
||||
case help update
|
||||
case list open help update
|
||||
$argv[1..-1]
|
||||
case '*'
|
||||
_search
|
||||
|
|
Loading…
Reference in New Issue
Block a user