Skip to content

Instantly share code, notes, and snippets.

@RaminHAL9001
Created March 3, 2020 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RaminHAL9001/55fba2b05f9e9da584b58951de37b481 to your computer and use it in GitHub Desktop.
Save RaminHAL9001/55fba2b05f9e9da584b58951de37b481 to your computer and use it in GitHub Desktop.
(defun rename-current-buffer (new-bufname)
"Prompts for a new buffer name in the minibuffer using the
current buffer name as an initial value, renames the current
buffer to the value entered."
(interactive
(let ((curbufname (buffer-name)))
(list (read-string "New buffer name: " curbufname 'buffer-name-history curbufname t))))
(rename-buffer new-bufname))
(global-set-key (kbd "C-c r b") 'rename-current-buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment