Compare commits

...
2 Commits
2 changed files with 45 additions and 2 deletions

No files matched your search

+43 -2
View File
@@ -86,8 +86,24 @@
* Setup
#+BEGIN_SRC emacs-lisp
#+END_SRC
** Use wl-clipboard for interprocess copy/paste
** Use wl-clipboard and OSC 52 for interprocess copy/paste
#+BEGIN_SRC emacs-lisp
(setq kill-do-not-save-duplicates t)
(defun alex/osc52-copy (text)
(unless (display-graphic-p)
(send-string-to-terminal
(concat "\e]52;c;"
(base64-encode-string (encode-coding-string text 'utf-8) t)
"\a"))))
(defun alex/clipboard-copy (text)
(alex/osc52-copy text)
(when (fboundp 'wl-copy)
(wl-copy text)))
(setq interprogram-cut-function 'alex/clipboard-copy)
(setq wl-copy-process nil)
(when (string-prefix-p "wayland" (getenv "WAYLAND_DISPLAY"))
(defun wl-copy (text)
@@ -103,7 +119,6 @@
nil ; should return nil if we're the current paste owner
(shell-command-to-string "wl-paste -n | tr -d \r")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste))
#+END_SRC
** Don't create backup files, don't create #autosave# files
@@ -410,6 +425,32 @@ Setup prefix for keybindings.
"t" '(:ignore t :which-key "text")
"ts" '(hydra-text-scale/body :which-key "scale text"))
#+END_SRC
** Copy file path with line number
#+BEGIN_SRC emacs-lisp
(defun alex/copy-path-with-line ()
"Copy /abs/path:LINE, or /abs/path:START-END when a region is active."
(interactive)
(unless buffer-file-name (user-error "Buffer is not visiting a file"))
(let* ((path (expand-file-name buffer-file-name))
(ref (if (use-region-p)
(let* ((beg (region-beginning))
(end (if (and (> (region-end) beg)
(save-excursion (goto-char (region-end)) (bolp)))
(1- (region-end))
(region-end)))
(start-line (line-number-at-pos beg))
(end-line (line-number-at-pos end)))
(if (= start-line end-line)
(format "%s:%d" path start-line)
(format "%s:%d-%d" path start-line end-line)))
(format "%s:%d" path (line-number-at-pos)))))
(kill-new ref)
(deactivate-mark)
(message "Copied %s" ref)))
(alex/keybindings
"y" '(alex/copy-path-with-line :which-key "copy path:line"))
#+END_SRC
* Browser
#+BEGIN_SRC emacs-lisp
+2
View File
@@ -23,6 +23,8 @@
set-option -g allow-rename off
set -g set-clipboard on
# Status line colors
set -g status-fg '#${config.lib.colors.foreground}'
set -g status-bg '#${config.lib.colors.background}'