help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I use 'C-x o o o o o' instead of C-x o C-x o C-x o C-x o C-x o?


From: 張國良
Subject: Re: Can I use 'C-x o o o o o' instead of C-x o C-x o C-x o C-x o C-x o?
Date: Thu, 30 Apr 2015 17:56:04 +0800

Thanks all for the ideas.

I end up use hydra and ace window.

Here is my config if you are interested.

> ** Hydra the windmove keys & move spliter
>
> #+BEGIN_SRC emacs-lisp
>
> (require 'hydra)
>
> (defhydra hydra-windmove (global-map "C-o")
>
>   "windmove with ijkl"
>
>   ("i" windmove-up "up")
>
>   ("j" windmove-left "left")
>
>   ("k" windmove-down "down")
>
>   ("l" windmove-right "right")
>
>   ("n" other-window "next")
>
>   ("p" (other-window -1) "prev")
>
>   ("[" hydra-move-splitter-left)
>
>   ("." hydra-move-splitter-down)
>
>   ("," hydra-move-splitter-up)
>
>   ("]" hydra-move-splitter-right)
>
> )
>
>
>> (defun hydra-move-splitter-left (arg)
>
>   "Move window splitter left."
>
>   (interactive "p")
>
>   (if (let ((windmove-wrap-around))
>
>         (windmove-find-other-window 'right))
>
>       (shrink-window-horizontally arg)
>
>     (enlarge-window-horizontally arg)))
>
>
>> (defun hydra-move-splitter-right (arg)
>
>   "Move window splitter right."
>
>   (interactive "p")
>
>   (if (let ((windmove-wrap-around))
>
>         (windmove-find-other-window 'right))
>
>       (enlarge-window-horizontally arg)
>
>     (shrink-window-horizontally arg)))
>
>
>> (defun hydra-move-splitter-up (arg)
>
>   "Move window splitter up."
>
>   (interactive "p")
>
>   (if (let ((windmove-wrap-around))
>
>         (windmove-find-other-window 'up))
>
>       (enlarge-window arg)
>
>     (shrink-window arg)))
>
>
>> (defun hydra-move-splitter-down (arg)
>
>   "Move window splitter down."
>
>   (interactive "p")
>
>   (if (let ((windmove-wrap-around))
>
>         (windmove-find-other-window 'up))
>
>       (shrink-window arg)
>
>     (enlarge-window arg)))
>
> #+END_SRC
>
>
>> ** Ace window (switch to window with number)
>
> #+BEGIN_SRC emacs-lisp
>
> (require 'ace-window)
>
> (global-set-key (kbd "M-p") 'ace-window)
>
> #+END_SRC
>
>
>>
2015-04-28 18:56 GMT+08:00 張國良 <keith@cheungsfamily.org>:

> Hi all,
>
> Scenario 1
> - I split many windows.
> - I wish to switch to some other windows.
> - I type C-x o, C-x o, C-x o repeatedly until the cursor landed on the
> desired window.
> Is there a way to use C-x o o o instead?
>
> I aware that I can use C-u num C-x o, if I know the desired window is num
> step away.  But there are times that I do not know 'num'.
>
>
> Scenario 2
> - I use the windmove package.
> - I bind the windmove-up/down/left/right to C-o i, C-o k, C-o j, C-o l
> respectively.  Now, if I want to windmove to up-left, I type C-o i, C-o j.
> Is there a way to use C-o i j instead?
>
>
> Many thanks.
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]