Removes unnecessary kbds; enhances config

This commit is contained in:
William Carroll 2017-06-06 10:35:37 -04:00
parent d688393344
commit 981f86bf7d
2 changed files with 39 additions and 14 deletions

View file

@ -244,8 +244,6 @@
("C-l" . evil-window-right) ("C-l" . evil-window-right)
("C-k" . evil-window-up) ("C-k" . evil-window-up)
("C-j" . evil-window-down) ("C-j" . evil-window-down)
("C-c" . term-interrupt-subjob)
:map evil-normal-state-map :map evil-normal-state-map
("<return>" . nil) ("<return>" . nil)
@ -322,18 +320,14 @@
"d" 'dired-jump "d" 'dired-jump
"D" 'projectile-dired "D" 'projectile-dired
"q" 'kill-this-buffer "q" 'kill-this-buffer
"h" 'evil-window-left "h" 'help
"i" 'helm-semantic-or-imenu "i" 'helm-semantic-or-imenu
"l" 'evil-window-right
"k" 'evil-window-up
"j" 'evil-window-down
"b" 'helm-mini "b" 'helm-mini
"T" 'alchemist-mix-test-at-point "T" 'alchemist-mix-test-at-point
"B" 'alchemist-mix-test-this-buffer "B" 'alchemist-mix-test-this-buffer
"L" 'alchemist-mix-rerun-last-test "L" 'alchemist-mix-rerun-last-test
"g" 'magit-status "g" 'magit-status
"z" 'wc/projectile-shell-pop "z" 'wc/projectile-shell-pop))
))
;; Evil Match-it ;; Evil Match-it

View file

@ -1,12 +1,32 @@
(defun wc/projectile-shell-pop () (defun wc/projectile-shell-pop ()
"Opens `ansi-term' at the project root according to Projectile." "Opens `ansi-term' at the project root according to Projectile."
(interactive) (interactive)
(let ((default-directory (projectile-project-root))) (let* ((project-name (projectile-project-root))
(if (get-buffer "*ansi-term*") (default-directory project-name)
(switch-to-buffer "*ansi-term*") (buffer-name (format "ansi-term <%s>" project-name)))
(ansi-term "/bin/zsh")) (if (get-buffer buffer-name)
(term-send-string (terminal) (format "cd '%s'\n" default-directory)) (switch-to-buffer buffer-name)
(get-buffer-process "*ansi-term*"))) (ansi-term "/bin/zsh" buffer-name))))
(defun wc/ansi-term-project-p (input)
(string-match-p "*ansi-term <[^>]+>*" input))
(defun wc/list-project-terminals ()
"Returns a list of ansi-term buffers with associated projects."
(interactive)
(let ((buffer-names (mapcar 'buffer-name (buffer-list))))
(remove-if-not #'wc/ansi-term-project-p buffer-names)))
(defun wc/open-terminals ()
"Lists active terminal buffers."
(interactive)
(helm :sources (helm-build-in-buffer-source "test1"
:data (wc/list-project-terminals)
:action 'switch-to-buffer)
:buffer "*helm projectile terminals*"))
(defun wc/shell-history () (defun wc/shell-history ()
@ -71,6 +91,14 @@
(lookup-key (current-global-map) binding))) (lookup-key (current-global-map) binding)))
(defun wc/focus-term-at-bottom ()
"Moves term to the bottom of the page on insert mode."
(interactive)
(end-of-buffer)
(evil-insert-state)
(term-send-raw-string "\b"))
(defun wc/bootstrap-ansi-term () (defun wc/bootstrap-ansi-term ()
"Custom `ansi-term' configuration." "Custom `ansi-term' configuration."
(interactive) (interactive)
@ -81,6 +109,9 @@
(local-set-key (kbd "C-k") 'evil-window-up) (local-set-key (kbd "C-k") 'evil-window-up)
(local-set-key (kbd "C-j") 'evil-window-down) (local-set-key (kbd "C-j") 'evil-window-down)
(wc/expose-global-binding-in-term (kbd "M-x")) (wc/expose-global-binding-in-term (kbd "M-x"))
(evil-define-key 'normal term-raw-map
(kbd "C-c") 'term-interrupt-subjob
(kbd "i") 'wc/focus-term-at-bottom)
(define-key term-raw-map (kbd "C-r") 'wc/helm-shell-history) (define-key term-raw-map (kbd "C-r") 'wc/helm-shell-history)
(define-key term-raw-map (kbd "M-:") 'eval-expression) (define-key term-raw-map (kbd "M-:") 'eval-expression)
(define-key term-raw-map (kbd "M-j") 'wc/helm-autojump) (define-key term-raw-map (kbd "M-j") 'wc/helm-autojump)