Created
August 20, 2018 13:31
-
-
Save pavloo/a494fdb49c24f58f88e0e5a44bccd259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun copy-current-line-position-to-clipboard (p) | |
"Copy current line in file to clipboard as '</path/to/file>:<line-number>'" | |
(interactive "sAbsolute path y/n?: ") | |
(let ((path-with-line-number) (file-name (buffer-file-name))) | |
(when (and (not (string= p "y")) (projectile-project-root)) | |
(setq file-name (file-relative-name buffer-file-name (projectile-project-root))) | |
) | |
(setq path-with-line-number (concat file-name ":" (number-to-string (line-number-at-pos)))) | |
(x-select-text path-with-line-number) | |
(message (concat path-with-line-number " copied to clipboard")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment