在VIM中,可以使用%
來指示調用shell命令時的當前文件名。任何人都可以指示我在文檔的方向上顯示emacs中的等效內容嗎?Emacs相當於VIM的'%`?
5
A
回答
4
沒有一個。但是這是Emacs!所以在這裏:(:不IDO工作,但很明顯,你可以隨時離開,與例如C-X C-F警告)
(defun my-shell-command-on-current-file (command &optional output-buffer error-buffer)
"Run a shell command on the current file (or marked dired files).
In the shell command, the file(s) will be substituted wherever a '%' is."
(interactive (list (read-from-minibuffer "Shell command: "
nil nil nil 'shell-command-history)
current-prefix-arg
shell-command-default-error-buffer))
(cond ((buffer-file-name)
(setq command (replace-regexp-in-string "%" (buffer-file-name) command nil t)))
((and (equal major-mode 'dired-mode) (save-excursion (dired-move-to-filename)))
(setq command (replace-regexp-in-string "%" (mapconcat 'identity (dired-get-marked-files) " ") command nil t))))
(shell-command command output-buffer error-buffer))
(global-set-key (kbd "M-!") 'my-shell-command-on-current-file)
1
您可以隨時迷你緩衝區希望你輸入的東西用這個。您也可以在常規緩衝區中使用它。
(defun insert-filename-or-buffername (&optional arg)
"If the buffer has a file, insert the base name of that file.
Otherwise insert the buffer name. With prefix argument, insert the full file name."
(interactive "P")
(let* ((buffer (window-buffer (minibuffer-selected-window)))
(file-path-maybe (buffer-file-name buffer)))
(insert (if file-path-maybe
(if arg
file-path-maybe
(file-name-nondirectory file-path-maybe))
(buffer-name buffer)))))
(define-key minibuffer-local-map (kbd "C-c f") 'insert-filename-or-buffername)
0
在我的情況
,使用Emacs從自制24 GUI版本....我看到文件名是從(小)型杆的左下角的第三個項目,正上方小緩衝區。
要看我在哪裏,使用ido模式我只是做C-x C-f
沒有配置需要那裏。
相關問題
- 1. Emacs相當於Vim的yy10p?
- 2. Vim相當於emacs主模式標記
- 3. Emacs「Autoresize.vim」相當於
- 4. Emacs的相當於Vim的字運動和變化的行字
- 5. VIM setwidth相當於
- 6. emacs中的autoexp.dat相當於
- 7. GNU emacs相當於func-menu
- 8. VIM相當於(類似)6xi?
- 9. Vi相當於Emacs中的「meta =」?
- 10. Emacs相當於Xcode的「快速打開」
- 11. Vma相當於Emacs的開放矩形
- 12. emacs相當於下面的vi命令
- 13. Emacs等效於Vim的foldmethod = indent
- 14. Emacs等效於Vim的vertsplit(vs)?
- 15. Emacs等效於Vim的dd,o,O
- 16. Vim style Omnicomplete for emacs?
- 17. 的Emacs/VIM對編譯器
- 18. 在Emacs Lisp中是否有相當於Python的__file__
- 19. emacs slime:相當於shell中的向上箭頭?
- 20. Vim命令相當於TextMate的'Command + T'/'轉到文件'?
- 21. Textmate相當於VIM的ci(內部改變)?
- 22. 如何在Emacs中獲得與Vim相同的Texplore?
- 23. 如何將vim導航鍵與emacs中的相同綁定?
- 24. 是否有eclipse相當於emacs M- /(dabbrev-expand)?
- 25. 如何生成用於VIM/Emacs的Groovy類的TAGS文件
- 26. Vim中有沒有類似於Emacs的Isearch的方法?
- 27. 於CentOS 6.4,當配置的Emacs
- 28. 相當於Android的
- 29. 相當於Postgres的
- 30. emacs等價於vim的bg = dark? (將背景設置爲黑色)
[buffer-file-name](http://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer-File-Name.html) – jfs
Emacs中沒有等價物。 'buffer-file-name'是一個Elisp變量,不能在shell命令提示符下使用。 –
[將Emacs變量傳遞給minibuffer shell命令]交叉鏈接(http://stackoverflow.com/questions/10121944/passing-emacs-variables-to-minibuffer-shell-commands)(這基本上是重複的,除了這兩個問題來自明顯不同的角度)。 – phils