Better workgroups2 support

This commit is contained in:
Henrik Lissner 2015-09-30 13:50:30 -04:00
parent 85b8fc253c
commit 2b972df9d6
3 changed files with 54 additions and 1 deletions

View file

@ -12,7 +12,13 @@
wg-mess-with-buffer-list t
;; What to do on Emacs exit / workgroups-mode exit?
wg-emacs-exit-save-behavior 'save ; Options: 'save 'ask nil
wg-workgroups-mode-exit-save-behavior 'save)
wg-workgroups-mode-exit-save-behavior 'save
wg-list-display-decor-divider " : "
wg-list-display-decor-current-left "["
wg-list-display-decor-current-right "]"
wg-list-display-decor-previous-left ""
wg-list-display-decor-previous-right "")
:config
(defvar narf/helm-source-wg
'((name . "Workgroups")

View file

@ -53,5 +53,39 @@
(unless (wg-current-workgroup-p w)
(wg-kill-workgroup w)))))
;;;###autoload
(defun narf:workgroup-display ()
(interactive)
(when (wg-current-session t)
(message (wg-display-internal
(lambda (workgroup index)
(if (not workgroup) wg-nowg-string
(wg-element-display
workgroup
(format "%d %s" index (wg-workgroup-name workgroup))
'wg-current-workgroup-p
'wg-previous-workgroup-p)))
(wg-workgroup-list)))))
;;;###autoload (autoload 'narf:switch-to-workgroup-left "defuns-workgroup" nil t)
(evil-define-command narf:switch-to-workgroup-left (count)
(interactive "<c>")
(if count
(wg-switch-to-workgroup-at-index (1- count))
(wg-switch-to-workgroup-left)))
;;;###autoload (autoload 'narf:switch-to-workgroup-right "defuns-workgroup" nil t)
(evil-define-command narf:switch-to-workgroup-right (count)
(interactive "<c>")
(if count
(wg-switch-to-workgroup-at-index (1- count))
(wg-switch-to-workgroup-right)))
;;;###autoload
(defun narf:switch-to-workgroup-at-index (index)
(interactive)
(wg-switch-to-workgroup-at-index index)
(narf:workgroup-display))
(provide 'defuns-workgroup)
;;; defuns-workgroup.el ends here

View file

@ -54,6 +54,16 @@
"M-Z" 'redo
"C-M-f" 'narf:toggle-fullscreen)
:m "M-1" (λ (narf:switch-to-workgroup-at-index 0))
:m "M-2" (λ (narf:switch-to-workgroup-at-index 1))
:m "M-3" (λ (narf:switch-to-workgroup-at-index 2))
:m "M-4" (λ (narf:switch-to-workgroup-at-index 3))
:m "M-5" (λ (narf:switch-to-workgroup-at-index 4))
:m "M-6" (λ (narf:switch-to-workgroup-at-index 5))
:m "M-7" (λ (narf:switch-to-workgroup-at-index 6))
:m "M-8" (λ (narf:switch-to-workgroup-at-index 7))
:m "M-9" (λ (narf:switch-to-workgroup-at-index 8))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Local keymaps ;;
@ -148,6 +158,9 @@
:m "g]" 'smart-down
:m "g[" 'smart-up
:m "gt" 'narf:switch-to-workgroup-right
:m "gT" 'narf:switch-to-workgroup-left
:v "." 'evil-repeat
;; vnoremap < <gv