2009-01-15 43 views
1

我瞭解M-X DIR,但想定製它。我想打一個鍵(例如F2)並打開緩衝區。當我瀏覽目錄層次時,它不應該打開新的緩衝區。如何在Emacs中獲得與Vim相同的Texplore?

當我最終打開文件時,它也不應該爲它打開新的緩衝區(不是絕對必要的,但強烈首選)。

當然,這種行爲可以是全局性的,即對於所有可執行緩衝區/調用。

回答

0

這是我最後使用:

(require 'dired) 
(global-set-key [(f2)] 'my-dired) 
(defun my-dired() 
    (interactive) 
    (dired (file-name-directory (buffer-file-name)))) 
(defadvice dired-advertised-find-file (around dired-subst-directory activate) 
    "Replace current buffer if file is a directory." 
    (interactive) 
    (let ((orig (current-buffer)) (filename (dired-get-filename :no-error-if-not-filep t))) 
    ad-do-it 
    (when (not (eq (current-buffer) orig)) (kill-buffer orig)))) 
4

檢出dired-single,它幾乎做你想做的(除了最後一點,它重新使用dired緩衝區爲新近visted文件)。

警告講師:我寫了,所以我偏向於它的用處。

+0

這裏沒有偏見,我認爲dired-single.el真棒。我已經使用了它一段時間,這正是我第一次查看時所需要的。 (不知道它與Texplore相比如何,因爲我從來沒有真正使用vim。) – felideon 2009-01-15 21:55:37

1

我知道這是很老,但你所要做的就是按「A」上的目錄或文件,以獲得此功能。它已經在那裏。

相關問題