From 9aec0768ae3c54eefe43fd212223050f92d23515 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 7 Nov 2025 13:50:10 +0100 Subject: [PATCH] Use osc52 for every copy/paste in the terminal --- modules/cli/darwin.nix | 2 ++ modules/cli/zsh/default.nix | 13 +------------ modules/cli/zsh/init.zsh | 7 +++++++ nvim/lua/settings.lua | 1 + overlays/default.nix | 5 +++++ 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/cli/darwin.nix b/modules/cli/darwin.nix index 72a2946..9151a49 100644 --- a/modules/cli/darwin.nix +++ b/modules/cli/darwin.nix @@ -45,7 +45,9 @@ ssh-tunnel = pkgs.writeShellScriptBin "ssh-tunnel" '' while true; do dns-sd -m -Q fuhen.local + echo "Host found, starting tunnel" | tee /dev/stderr ssh -NR "2222:localhost:22" zoriya@fuhen.local + echo "Connetion closed" | tee /dev/stderr sleep 5 done ''; diff --git a/modules/cli/zsh/default.nix b/modules/cli/zsh/default.nix index 0617dd4..78846e8 100644 --- a/modules/cli/zsh/default.nix +++ b/modules/cli/zsh/default.nix @@ -93,8 +93,6 @@ if pkgs.stdenv.isLinux then "ss -tlpun" else "netstat -anvp tcp | awk 'NR<3 || /LISTEN/'"; - # habits - copyfile = "clipcopy"; # viu doesn't work with tmux, icat does. using that while waiting viu = "kitty +kitten icat"; @@ -128,16 +126,6 @@ src = pkgs.oh-my-zsh; file = "share/oh-my-zsh/plugins/git/git.plugin.zsh"; } - { - name = "clipcopy"; # dependency of copypath & copyfile - src = pkgs.oh-my-zsh; - file = "share/oh-my-zsh/lib/clipboard.zsh"; - } - { - name = "copypath"; - src = pkgs.oh-my-zsh; - file = "share/oh-my-zsh/plugins/copypath/copypath.plugin.zsh"; - } ]; completionInit = #bash @@ -362,6 +350,7 @@ usql rsync moreutils + osc # bitwarden-cli ] ++ lib.optionals pkgs.stdenv.isLinux [ diff --git a/modules/cli/zsh/init.zsh b/modules/cli/zsh/init.zsh index c68939f..7ffb471 100644 --- a/modules/cli/zsh/init.zsh +++ b/modules/cli/zsh/init.zsh @@ -108,3 +108,10 @@ _kgy() { _kubectl } compdef _kgy kgy + +alias copyfile="osc copy" +copypath() { + local file="${1:-.}" + [[ $file = /* ]] || file="$PWD/$file" + print -n "${file:a}" | osc copy || return 1 +} diff --git a/nvim/lua/settings.lua b/nvim/lua/settings.lua index 12861e7..54c6d8b 100644 --- a/nvim/lua/settings.lua +++ b/nvim/lua/settings.lua @@ -73,6 +73,7 @@ vim.keymap.set("v", "<", "", ">gv") -- Copy to/from system clipboard +vim.g.clipboard = 'osc52' vim.keymap.set({ "n", "x" }, "y", '"+y', { desc = "Yank to system clipboard" }) vim.keymap.set({ "n", "x" }, "Y", '"+y$', { desc = "Yank line to system clipboard" }) vim.keymap.set({ "n", "x" }, "p", '"+p', { desc = "Past from system clipboard" }) diff --git a/overlays/default.nix b/overlays/default.nix index c622a0a..71d4889 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -23,6 +23,11 @@ in { ]; }; + # they try to use passthrough if they detect tmux. we don't want that. + osc = wrapProgram super.osc ["osc"] '' + --set TMUX "" + ''; + # it doesn't start without this, no clue why. freecad = wrapProgram super.freecad ["freecad" "FreeCAD" "freecadcmd" "FreeCADCmd"] '' --set QT_QPA_PLATFORM 'wayland;xcb' \