これが私のセットアップです:
(defvar terminal-process)
(defun terminal ()
"Switch to terminal. Launch if nonexistant."
(interactive)
(if (get-buffer "*terminal*")
(switch-to-buffer "*terminal*")
(term "/bin/bash"))
(setq terminal-process (get-buffer-process "*terminal*")))
(global-set-key "\C-t" 'terminal)
起動時間について詳しく教えてください。私のは約0.3秒です。
dired
UPD私のカスタマイズからの小さなスニペット
私はdired
セットアップでこれを持っています:
(add-hook
'dired-mode-hook
(lambda()
(define-key dired-mode-map (kbd "`")
(lambda()(interactive)
(let ((current-dir (dired-current-directory)))
(term-send-string
(terminal)
(format "cd %s\n" current-dir)))))))
どこにterminal
ある:
(defun terminal ()
"Switch to terminal. Launch if nonexistant."
(interactive)
(if (get-buffer "*terminal*")
(switch-to-buffer "*terminal*")
(term "/bin/bash"))
(setq terminal-process (get-buffer-process "*terminal*")))
これが行うことは、dired バッファと同じディレクトリのターミナルを開き、既存のものを再利用する*terminal*
か、存在しない場合は新しいものを作成することです。
あなたの質問への答えを要約すると:
はい、可能です。それはで行われます:
(term-send-string
(terminal)
(format "cd %s\n" default-directory))