Add prelude-find-shell-init-file

This commit is contained in:
Bozhidar Batsov 2013-09-27 11:36:47 +03:00
parent 879d3f3470
commit 3c8f0c7f98
2 changed files with 11 additions and 0 deletions

View file

@ -538,5 +538,15 @@ This follows freedesktop standards, should work in X servers."
(interactive) (interactive)
(find-file-other-window user-init-file)) (find-file-other-window user-init-file))
(defun prelude-find-shell-init-file ()
"Edit the shell init file in another window."
(interactive)
(let* ((shell (car (reverse (s-split "/" (getenv "SHELL")))))
(shell-init-file (cond
((s-equals? "zsh" shell) ".zshrc")
((s-equals? "bash" shell) ".bashrc")
(t (error "Unknown shell")))))
(find-file-other-window (expand-file-name shell-init-file (getenv "HOME")))))
(provide 'prelude-core) (provide 'prelude-core)
;;; prelude-core.el ends here ;;; prelude-core.el ends here

View file

@ -65,6 +65,7 @@
(define-key map (kbd "C-c +") 'prelude-increment-integer-at-point) (define-key map (kbd "C-c +") 'prelude-increment-integer-at-point)
(define-key map (kbd "C-c -") 'prelude-decrement-integer-at-point) (define-key map (kbd "C-c -") 'prelude-decrement-integer-at-point)
(define-key map (kbd "C-c I") 'prelude-find-user-init-file) (define-key map (kbd "C-c I") 'prelude-find-user-init-file)
(define-key map (kbd "C-c S") 'prelude-find-shell-init-file)
;; make some use of the Super key ;; make some use of the Super key
(define-key map [?\s-d] 'projectile-find-dir) (define-key map [?\s-d] 'projectile-find-dir)
(define-key map [?\s-p] 'projectile-switch-project) (define-key map [?\s-p] 'projectile-switch-project)