讓windows的GNU emacs預設shell啟動cygwin bash

來源:互聯網
上載者:User

區區的好友Victor告知說他打算轉用cygwin版的emacs了,為了更加方便的整合他開發MTK時的bash環境。

 

於我這也google了一下cygwin emacs等主題。。

結果在這時(http://www.khngai.com/emacs/cygwin.php)找到一些非常用的定製。。

 

 

(add-hook 'eshell-mode-hook

   '(lambda nil

   (eshell/export "EPOCROOT=//SomeWhere//")

   (let ((path))

     (setq path ".;C:/Soft/VS9/VC/bin;")

     (setenv "PATH" (concat path (getenv "PATH")))

     (local-set-key "/C-u" 'eshell-kill-input))

   ))

(add-hook 'comint-output-filter-functions

    'shell-strip-ctrl-m nil t)

(add-hook 'comint-output-filter-functions

    'comint-watch-for-password-prompt nil t)

(setq explicit-shell-file-name "cmdproxy.exe")

;; For subprocesses invoked via the shell

;; (e.g., "shell -c command")

(setq shell-file-name explicit-shell-file-name)

 

(defun eshell/clear ()

  "04Dec2001 - sailor, to clear the eshell buffer."

  (interactive)

  (let ((inhibit-read-only t))

    (erase-buffer)))

 

其中的cmdproxy.exe如果改成,bash.exe,就可以讓emacs的shell命令在windows下預設選用cygwin bash^_^

 

另外,如果cygwin版emacs非用不可,別忘了啟動cygwin前,設定set CYGWIN=glob notitle tty

還有其它一些簡要的配置,一併列下:

 

(setq Info-scroll-prefer-subnodes nil) ;info scrolling

(global-set-key "/M- " 'set-mark-command) 

(global-set-key " " (quote set-mark-command))

(global-set-key [(control ?=)] 'call-last-kbd-macro)

(defalias 'yes-or-no-p 'y-or-n-p)

(global-set-key [(meta ?h)] #'(lambda () (interactive) (find-file "~/.emacs")))

(transient-mark-mode 1)

(normal-erase-is-backspace-mode nil)

(iswitchb-mode t)

(global-set-key "/C-xk" #'(lambda () (interactive) (kill-buffer (current-buffer))))

 

(global-font-lock-mode t)

(setq truncate-lines t)

(global-set-key "/C-x/C-b" 'buffer-menu)

 

(icomplete-mode 1)

(setq ring-bell-function 'ignore)

(blink-cursor-mode nil)

(partial-completion-mode 1)

(global-set-key "/C-co" 'occur)

 

(global-set-key "/C-c/C-m" 'execute-extended-command)

 

(defalias 'open 'find-file)

(defalias 'openo 'find-file-other-window)

(defalias 'qrr 'query-replace)

(defalias 'rstr 'replace-string)

(defalias 'ptm 'pop-to-mark-command)

(defalias 'emacs 'open)

 

(global-set-key [(control down)] #'(lambda () (interactive) (scroll-up 1)))

(global-set-key [(control up)] #'(lambda () (interactive) (scroll-down 1)))

 

 

用上evil的emacs,學習就沒個頭,呵呵。

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.