diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-files.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/init-files.el b/lisp/init-files.el index 514cdcc..64d30f9 100644 --- a/lisp/init-files.el +++ b/lisp/init-files.el @@ -39,8 +39,19 @@ (setq file (concat "/sudo:root@localhost:" file))) (find-file file))) +(defun km/write-file () + "Run `write-file'. +Use the current file name as initial input of prompt." + (interactive) + (let* ((init-file (and buffer-file-name + (file-name-nondirectory buffer-file-name))) + (new-file (read-file-name "Write file: " nil nil nil + init-file))) + (write-file new-file t))) + (global-set-key (kbd "C-x C-r") 'km/rename-current-buffer-file) (global-set-key (kbd "C-x F") 'km/find-file-as-root) +(global-set-key (kbd "C-x C-w") 'km/write-file) (key-chord-define-global "jc" 'find-file) |