Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add winum-switch-to-window and winum-split-to #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions winum.el
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,83 @@ If prefix ARG is given, delete the window instead of selecting it."
(interactive "P")
(winum-select-window-by-number (if arg -9 9)))

;;;###autoload
(defun winum-switch-to-window-1 ()
"Switch to window 1, split window if not exist."
(interactive)
(winum-switch-to-window 1))

;;;###autoload
(defun winum-switch-to-window-2()
"Switch to window 2, split window if not exist."
(interactive)
(winum-switch-to-window 2))

;;;###autoload
(defun winum-switch-to-window-3 ()
"Switch to window 3, split window if not exist."
(interactive)
(winum-switch-to-window 3))

;;;###autoload
(defun winum-switch-to-window-4 ()
"Switch to window 4, split window if not exist."
(interactive)
(winum-switch-to-window 4))

;;;###autoload
(defun winum-switch-to-window-5()
"Switch to window 5, split window if not exist."
(interactive)
(winum-switch-to-window 5))

;;;###autoload
(defun winum-switch-to-window-6 ()
"Switch to window 6, split window if not exist."
(interactive)
(winum-switch-to-window 6))

;;;###autoload
(defun winum-switch-to-window-7 ()
"Switch to window 7, split window if not exist."
(interactive)
(winum-switch-to-window 7))

;;;###autoload
(defun winum-switch-to-window-8 ()
"Switch to window 8, split window if not exist."
(interactive)
(winum-switch-to-window 8))

;;;###autoload
(defun winum-switch-to-window-9 ()
"Switch to window 9, split window if not exist."
(interactive)
(winum-switch-to-window 9))

;;;###autoload
(defun winum-switch-to-window (num)
"Switch to sindow NUM, split window if not exist."
(if (> num winum--window-count)
(call-interactively #'winum-split-to)
(winum-select-window-by-number num)))

;;;###autoload
(defun winum-split-to (direction)
"Split window and switch to it according to DIRECTION.
Accept one character for DIRECTION.
k ^
h l < >
j v
"
(interactive "cswitch to window: h/j/k/l")
(pcase direction
(?k (split-window-below)) ; up
(?j (select-window (split-window-below))) ; down
(?h (split-window-right)) ; left
(?l (select-window (split-window-right))) ; right
))

;;;###autoload
(defun winum-select-window-by-number (&optional arg)
"Select or delete window which number is specified by ARG.
Expand Down