Skip to content

Commit

Permalink
Add bindings for workspaces and layouts
Browse files Browse the repository at this point in the history
C-tab C-S-tab for workspaces (like tabs [vim tabs?])
C-s-tab C-S-s-tab for layouts (using super key like a WM)

Also ( M-s- | C-s ) + [0-9]  to change to number [0-9] workspace/layout
  • Loading branch information
CestDiego committed Jan 18, 2016
1 parent 9b77891 commit 2bbdd1b
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 43 deletions.
41 changes: 22 additions & 19 deletions layers/+window-management/eyebrowse/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,26 @@ Set the variable =eyebrowse-display-help= to =nil=

* Key bindings

| Key Binding | Description |
|-------------------------------------------+------------------------------------|
| ~gt~ | go to next workspace |
| ~gT~ | got to previous workspace |
| ~SPC l w 1~ | create or switch to workspace 1 |
| ~SPC l w 2~ | create or switch to workspace 2 |
| ~SPC l w 3~ | create or switch to workspace 3 |
| ~SPC l w 4~ | create or switch to workspace 4 |
| ~SPC l w 5~ | create or switch to workspace 5 |
| ~SPC l w 6~ | create or switch to workspace 6 |
| ~SPC l w 7~ | create or switch to workspace 7 |
| ~SPC l w 8~ | create or switch to workspace 8 |
| ~SPC l w 9~ | create or switch to workspace 9 |
| ~SPC l w 0~ | create or switch to workspace 0 |
| ~SPC l w TAB~ | switch to last active workspace |
| ~SPC l w c~ | close current workspace |
| ~SPC l w n~ or ~SPC l w l~ | switch to next workspace |
| Key Binding | Description |
|-------------------------------------+------------------------------------|
| ~gt~ | go to next workspace |
| ~gT~ | got to previous workspace |
| ~SPC l w 1~ | create or switch to workspace 1 |
| ~SPC l w 2~ | create or switch to workspace 2 |
| ~SPC l w 3~ | create or switch to workspace 3 |
| ~SPC l w 4~ | create or switch to workspace 4 |
| ~SPC l w 5~ | create or switch to workspace 5 |
| ~SPC l w 6~ | create or switch to workspace 6 |
| ~SPC l w 7~ | create or switch to workspace 7 |
| ~SPC l w 8~ | create or switch to workspace 8 |
| ~SPC l w 9~ | create or switch to workspace 9 |
| ~SPC l w 0~ | create or switch to workspace 0 |
| ~SPC l w TAB~ | switch to last active workspace |
| ~SPC l w c~ | close current workspace |
| ~SPC l w n~ or ~SPC l w l~ | switch to next workspace |
| ~SPC l w N~ or ~SPC l w p~ or ~SPC l w h~ | switch to previous workspace |
| ~SPC l w r~ | set a tag to the current workspace |
| ~SPC l w w~ | switched to tagged workspace |
| ~SPC l w r~ | set a tag to the current workspace |
| ~SPC l w w~ | switched to tagged workspace |
| ~Control+Tab~ | Switch to next layout |
| ~Control+Shift+Tab~ | Switch to previous layout |
| ~Meta+Super+[0-9]~ | Switch to [0-9]th layout |
18 changes: 18 additions & 0 deletions layers/+window-management/eyebrowse/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@
"[n] next, [p/N] previous, [TAB] back and forth, [c] close, "
"[r] rename"))))))

(global-set-key (kbd "<C-tab>")
'spacemacs//workspaces-eyebrowse-next-window-config-l)
(global-set-key (kbd "<C-S-tab>")
'spacemacs//workspaces-eyebrowse-prev-window-config-h)
(global-set-key (kbd "<C-S-iso-lefttab>")
'spacemacs//workspaces-eyebrowse-prev-window-config-h)

(global-set-key (kbd "M-s-1") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-1-1)
(global-set-key (kbd "M-s-2") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-2-2)
(global-set-key (kbd "M-s-3") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-3-3)
(global-set-key (kbd "M-s-4") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-4-4)
(global-set-key (kbd "M-s-5") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-5-5)
(global-set-key (kbd "M-s-6") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-6-6)
(global-set-key (kbd "M-s-7") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-7-7)
(global-set-key (kbd "M-s-8") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-8-8)
(global-set-key (kbd "M-s-9") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-9-9)
(global-set-key (kbd "M-s-0") 'spacemacs//workspaces-eyebrowse-switch-to-window-config-0-0)

(spacemacs|define-micro-state workspaces
:doc (spacemacs//workspaces-ms-documentation)
:use-minibuffer t
Expand Down
57 changes: 33 additions & 24 deletions layers/+window-management/spacemacs-layouts/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- [[Description][Description]]
- [[Install][Install]]
- [[Layer][Layer]]
- [[Features ][Features ]]
- [[Features][Features]]
- [[Micro-states][Micro-states]]
- [[Layouts Micro State][Layouts Micro State]]
- [[Project Layouts][Project Layouts]]
Expand All @@ -16,6 +16,7 @@
- [[Predefined custom layouts][Predefined custom layouts]]
- [[Org-agenda custom layout][Org-agenda custom layout]]
- [[RCIRC/ERC custom layout][RCIRC/ERC custom layout]]
- [[Key bindings][Key bindings]]

* Description
This contribution layer adds layouts support to Spacemacs thanks to =persp-mode=.
Expand All @@ -37,29 +38,29 @@ The layouts micro-state is initiated with ~SPC l~.

| Key Binding | Description |
|-------------+------------------------------------------------------------|
| ~?~ | toggle the documentation |
| ~[1..9, 0]~ | switch to nth layout |
| ~<tab>~ | switch to the latest layout |
| ~a~ | add a buffer to the current layout |
| ~A~ | add all the buffers from another layout in the current one |
| ~b~ | select a buffer in the current layout |
| ~c~ | close the current layout and keep its buffers |
| ~C~ | close the other layouts and keep their buffers |
| ~h~ | go to default layout |
| ~C-h~ | previous layout in list |
| ~l~ | select a layout with helm |
| ~L~ | load layouts from file |
| ~C-l~ | next layout in list |
| ~n~ | next layout in list |
| ~N~ | previous layout in list |
| ~o~ | open a custom layout |
| ~p~ | previous layout in list |
| ~r~ | remove current buffer from layout |
| ~R~ | rename layout |
| ~s~ | save layouts |
| ~t~ | display a buffer without adding it to the current layout |
| ~x~ | kill current layout with its buffers |
| ~X~ | kill other layouts with their buffers |
| ~?~ | toggle the documentation |
| ~[1..9, 0]~ | switch to nth layout |
| ~<tab>~ | switch to the latest layout |
| ~a~ | add a buffer to the current layout |
| ~A~ | add all the buffers from another layout in the current one |
| ~b~ | select a buffer in the current layout |
| ~c~ | close the current layout and keep its buffers |
| ~C~ | close the other layouts and keep their buffers |
| ~h~ | go to default layout |
| ~C-h~ | previous layout in list |
| ~l~ | select a layout with helm |
| ~L~ | load layouts from file |
| ~C-l~ | next layout in list |
| ~n~ | next layout in list |
| ~N~ | previous layout in list |
| ~o~ | open a custom layout |
| ~p~ | previous layout in list |
| ~r~ | remove current buffer from layout |
| ~R~ | rename layout |
| ~s~ | save layouts |
| ~t~ | display a buffer without adding it to the current layout |
| ~x~ | kill current layout with its buffers |
| ~X~ | kill other layouts with their buffers |

*** Project Layouts
To create a layout for a specific project use ~SPC p l~.
Expand Down Expand Up @@ -140,3 +141,11 @@ you have and show them in a single buffer. (in evil the command starts with ~;a~
*** RCIRC/ERC custom layout
Now you can also open IRC in a new layout to keep all the chat buffers in
one layout isolated from your work buffers.

* Key bindings

| Key Binding | Description |
|-------------------------+---------------------------|
| ~Control+Super+Tab~ | Switch to next layout |
| ~Control+Super+Shift+Tab~ | Switch to previous layout |
| ~Control+Super+[0-9]~ | Switch to [0-9]th layout |
19 changes: 19 additions & 0 deletions layers/+window-management/spacemacs-layouts/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,25 @@
(when (equal 1 spacemacs--layouts-ms-doc-toggle)
spacemacs--layouts-ms-documentation))))


(global-set-key (kbd "<C-s-tab>")
'spacemacs//layouts-persp-next-n)
(global-set-key (kbd "<C-S-s-tab>")
'spacemacs//layouts-persp-prev-p)
(global-set-key (kbd "<C-S-s-iso-lefttab>")
'spacemacs//layouts-persp-prev-p)

(global-set-key (kbd "C-s-1") 'spacemacs//layouts-spacemacs/persp-switch-to-1-1)
(global-set-key (kbd "C-s-2") 'spacemacs//layouts-spacemacs/persp-switch-to-2-2)
(global-set-key (kbd "C-s-3") 'spacemacs//layouts-spacemacs/persp-switch-to-3-3)
(global-set-key (kbd "C-s-4") 'spacemacs//layouts-spacemacs/persp-switch-to-4-4)
(global-set-key (kbd "C-s-5") 'spacemacs//layouts-spacemacs/persp-switch-to-5-5)
(global-set-key (kbd "C-s-6") 'spacemacs//layouts-spacemacs/persp-switch-to-6-6)
(global-set-key (kbd "C-s-7") 'spacemacs//layouts-spacemacs/persp-switch-to-7-7)
(global-set-key (kbd "C-s-8") 'spacemacs//layouts-spacemacs/persp-switch-to-8-8)
(global-set-key (kbd "C-s-9") 'spacemacs//layouts-spacemacs/persp-switch-to-9-9)
(global-set-key (kbd "C-s-0") 'spacemacs//layouts-spacemacs/persp-switch-to-0-0)

(spacemacs|define-micro-state layouts
:doc (spacemacs//layouts-ms-doc)
:use-minibuffer t
Expand Down

0 comments on commit 2bbdd1b

Please sign in to comment.