From c1a6b7be864c2566c978f57e70d973738a6f00e8 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Thu, 28 Dec 2023 09:45:38 +0800 Subject: [PATCH] improve xclip --- lisp/init-edit.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lisp/init-edit.el b/lisp/init-edit.el index 3b50b11ac..563c6d330 100644 --- a/lisp/init-edit.el +++ b/lisp/init-edit.el @@ -416,14 +416,17 @@ (setq hs-set-up-overlay #'hs-display-code-line-counts)) ;; Copy&paste GUI clipboard from text terminal -(use-package xclip - :init (xclip-mode 1) - :config - ;; @see https://github.com/microsoft/wslg/issues/15#issuecomment-1796195663 - (when (eq xclip-method 'wl-copy) - (setq interprogram-cut-function - (lambda (text) - (start-process "wl-copy" nil "wl-copy" "--trim-newline" "--type" "text/plain;charset=utf-8" text))))) +(unless sys/win32p + (use-package xclip + :hook (after-init . xclip-mode) + :config + (set-clipboard-coding-system 'gbk) + + ;; @see https://github.com/microsoft/wslg/issues/15#issuecomment-1796195663 + (when (eq xclip-method 'wl-copy) + (setq interprogram-cut-function + (lambda (text) + (start-process "wl-copy" nil "wl-copy" "--trim-newline" "--type" "text/plain;charset=utf-8" text)))))) ;; Open files as another user (unless sys/win32p