How to create new file from dired mode?

前端 未结 6 1269
眼角桃花
眼角桃花 2021-02-06 20:52

I want to create a new file in dired mode. Is there \"create new file\" command in dired mode ? For example, When I type \"c\" in dired mode, it creates \"untitled.txt\". It\'s

6条回答
  •  猫巷女王i
    2021-02-06 20:54

    If you want c in Dired mode to do what C-x C-f does, the answer is trivial:

    (define-key dired-mode-map "c" 'find-file)
    

    Or if you want it to have the name untitled.txt then:

    (define-key dired-mode-map "c"
      (lambda () (interactive) (find-file "untitled.txt")))
    

提交回复
热议问题