diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2018-06-20 15:34:28 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2018-06-20 15:34:28 +0200 |
| commit | 257908c25366ef5d59c4b3b7976f9baa4e025015 (patch) | |
| tree | b51d0a59b686eb8cddf4812542c5f590ca9fcc3d /.emacs | |
| parent | cababb5e10d7036d3f5161c177528716ca182d68 (diff) | |
| download | dotfiles-257908c25366ef5d59c4b3b7976f9baa4e025015.tar.xz | |
Add ways to run shell commands in the minibuffer
I sometimes need to create a file named $(date +%F).md. This commit
introduces two ways to do this:
1. with recursive minibuffers:
C-x C-f M-! date +%F RET
2. with a new function to add shell command outputs to the kill ring:
C-x C-f C-c k ! date +%F RET C-y
Diffstat (limited to '.emacs')
| -rw-r--r-- | .emacs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -42,6 +42,7 @@ (global-set-key (kbd "C-c f") 'auto-fill-mode) (global-set-key (kbd "C-c k f") 'my/kill-ring-filename) (global-set-key (kbd "C-c k |") 'my/kill-ring-pipe-region) +(global-set-key (kbd "C-c k !") 'my/kill-ring-shell) (global-set-key (kbd "C-c m") 'man) (global-set-key (kbd "C-c p") 'electric-pair-mode) (global-set-key (kbd "C-c t") 'toggle-truncate-lines) @@ -218,6 +219,12 @@ t t nil shell-command-switch command) (kill-new (buffer-string))))) +(defun my/kill-ring-shell (command) + (interactive (list (read-shell-command "Shell command: "))) + (with-temp-buffer + (call-process-shell-command command nil t) + (kill-new (buffer-string)))) + (defun my/froggify () (ispell-change-dictionary "fr") (setq-local colon-double-space nil) |
