dotfiles/.config/fish/functions/editcb.fish

25 lines
482 B
Fish
Raw Normal View History

function editcb -a ft -d 'Opens your editor to the cliboard\'s current contents.'
2020-08-15 23:20:08 +00:00
set uname (uname)
set file "._temp.$ft"
2020-08-15 23:20:08 +00:00
touch $file
2020-08-15 23:20:08 +00:00
switch "$uname"
case 'Linux'
xclip -out -selection clipboard >$file
2020-08-15 23:20:08 +00:00
case 'Darwin'
pbpaste >$file
2020-08-15 23:20:08 +00:00
end
2020-08-15 23:20:08 +00:00
$EDITOR $file
2020-08-15 23:20:08 +00:00
switch "$uname"
case 'Linux'
xclip -in -selection clipboard <$file
2020-08-15 23:20:08 +00:00
case 'Darwin'
pbcopy <$file
2020-08-15 23:20:08 +00:00
end
2020-08-15 23:20:08 +00:00
rm $file
end