Commit b7309047 authored by Duncan Bayne's avatar Duncan Bayne

Add helper for copying buffer filename

parent a16259f9
;;
;; Thanks to:
;; http://emacsredux.com/blog/2013/03/27/copy-filename-to-the-clipboard/
;;
(setq multi-term-program "zsh") (setq multi-term-program "zsh")
(defun utils:add-to-load-path (path-list) (defun utils:add-to-load-path (path-list)
...@@ -143,3 +148,13 @@ ...@@ -143,3 +148,13 @@
(read-directory-name "Change into directory:"))) (read-directory-name "Change into directory:")))
(cd directory-name) (cd directory-name)
(term-send-raw-string (concat "cd " directory-name "\n"))) (term-send-raw-string (concat "cd " directory-name "\n")))
(defun copy-file-name-to-clipboard ()
"Copy the current buffer file name to the clipboard."
(interactive)
(let ((filename (if (equal major-mode 'dired-mode)
default-directory
(buffer-file-name))))
(when filename
(kill-new filename)
(message "Copied buffer file name '%s' to the clipboard." filename))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment