Adding better wslpath functions for easier unix/win path conversions
This commit is contained in:
parent
e2922ae33d
commit
1d0a2e77ef
5
.config/fish/functions/cw.fish
Normal file
5
.config/fish/functions/cw.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function cw
|
||||
set -l wpath (wslpath -a -w (readlink -f "$argv[1]"))
|
||||
echo Copied \"$wpath\" to clipboard
|
||||
echo -n $wpath | clip.exe
|
||||
end
|
5
.config/fish/functions/w2u.fish
Normal file
5
.config/fish/functions/w2u.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function w2u
|
||||
set -l wpath (wslpath "$argv[1]")
|
||||
echo Copied \"$wpath\" to clipboard
|
||||
echo -n "$wpath" | clip.exe
|
||||
end
|
@ -73,7 +73,7 @@ function bookmark --description "Bookmark files and directories in fish"
|
||||
echo "$bname $bpath" >> $BMS_FILE
|
||||
set -l ftype ([ -d $bname ] && echo "file" || echo "directory")
|
||||
echo "Bookmark '$bname' added for $ftype $bpath"
|
||||
__bookmarks_update_completions
|
||||
# __bookmarks_update_completions
|
||||
|
||||
case "remove"
|
||||
if [ (count $argv) -lt 2 ]
|
||||
@ -99,20 +99,6 @@ function bookmark --description "Bookmark files and directories in fish"
|
||||
|
||||
end
|
||||
|
||||
function _valid_bookmark
|
||||
if begin; [ (count $argv) -lt 1 ]; or not [ -n $argv[1] ]; end
|
||||
return 1
|
||||
else
|
||||
cat $BMS_FILE | grep "^export DIR_" | sed "s/^export /set -x /" | sed "s/=/ /" | .
|
||||
set -l bookmark (env | grep "^DIR_$argv[1]=" | cut -f1 -d "=" | cut -f2 -d "_" )
|
||||
if begin; not [ -n "$bookmark" ]; or not [ $bookmark=$argv[1] ]; end
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __bookmarks_opener --description "Default opener"
|
||||
set -l f "$argv[1]"
|
||||
switch (file --mime-type -b "$f")
|
||||
|
Loading…
x
Reference in New Issue
Block a user