←back to thread

700 points yen223 | 1 comments | | HN request time: 0.216s | source
Show context
gkfasdfasdf ◴[] No.42061451[source]
pbcopy and pbpaste are handy, for a version that works over ssh connections there is osc: https://github.com/theimpostor/osc
replies(4): >>42061773 #>>42064063 #>>42065164 #>>42072500 #
pmarreck ◴[] No.42061773[source]
since I switch between linux and macos a lot I wrote a dotfile function called "clip" that will work the same on both. nice thing is it will automatically paste if nothing is piped to it to copy so there's no need to use separate commands... although I just realized it might be nice to have a "passthrough" mode that both copies and pastes if you add this to a pipeline in order to capture some intermediate part to the clipboard

    if [[ "$(uname)" == "Darwin" ]]; then
      clip() {
        [ -t 0 ] && pbpaste || pbcopy
      }
    else # assume linux if not macos
      clip() {
        [ -t 0 ] && xclip -o -selection clipboard || xclip -selection clipboard
      }
    fi
replies(2): >>42061888 #>>42066841 #
1. hk1337 ◴[] No.42066841[source]
I went the route of managing a different set of dotfiles for linux and macOS. Same repository, just different branches.

Also, falling back to using oh-my-zsh functionality.