Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename a file by editing its current name?

Tags:

emacs

elisp

For example: I have a file longest_substring_no_repeating_chars.cc. One day I want to rename it to longest_substr_no_repeating_chars.cc. How do I do it by editing the old name? Or is there any convenient way to do it?

like image 489
updogliu Avatar asked Oct 21 '25 12:10

updogliu


1 Answers

You can do this in dired mode. R shortcut invokes dired-do-rename where you can press down to get back the old name.

It's even easier if you use dired-x, just add to your init file.

(require 'dired-x)

Then you can press C-x C-j R to edit as you need to, then q to go back to your buffer.

Another possibility: M-x wdired-change-to-wdired-mode. In this mode you can edit files directly. Press C-c C-c when you want to commit your changes or C-c ESC to cancel them.

like image 185
Oleg Pavliv Avatar answered Oct 24 '25 08:10

Oleg Pavliv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!