narf/evil-window-move-* => narf/evil-window-move; add narf/evil-window-resize
This commit is contained in:
parent
08961c7ca1
commit
ba7722d425
3 changed files with 25 additions and 39 deletions
|
@ -99,8 +99,7 @@
|
||||||
;; Don't ask for confirmation when creating files
|
;; Don't ask for confirmation when creating files
|
||||||
(advice-add 'neotree-create-node :around 'narf*neotree-create-node)
|
(advice-add 'neotree-create-node :around 'narf*neotree-create-node)
|
||||||
;; Prevents messing up the neotree buffer on window changes
|
;; Prevents messing up the neotree buffer on window changes
|
||||||
(advice-add 'narf--evil-window-move :around 'narf*save-neotree)
|
(advice-add 'narf/evil-window-move :around 'narf*save-neotree)
|
||||||
(advice-add 'narf--evil-swap-windows :around 'narf*save-neotree)
|
|
||||||
|
|
||||||
(add-hook 'neotree-mode-hook 'narf|neotree-init-keymap)
|
(add-hook 'neotree-mode-hook 'narf|neotree-init-keymap)
|
||||||
(defun narf|neotree-init-keymap ()
|
(defun narf|neotree-init-keymap ()
|
||||||
|
|
|
@ -12,16 +12,8 @@
|
||||||
(call-interactively 'evil-window-vsplit)
|
(call-interactively 'evil-window-vsplit)
|
||||||
(evil-window-right 1))
|
(evil-window-right 1))
|
||||||
|
|
||||||
(defun narf--evil-swap-windows (a b)
|
;;;###autoload
|
||||||
(let ((a-buffer (window-buffer a))
|
(defun narf/evil-window-move (direction)
|
||||||
(b-buffer (window-buffer b)))
|
|
||||||
(with-selected-window b
|
|
||||||
(switch-to-buffer a-buffer))
|
|
||||||
(with-selected-window a
|
|
||||||
(switch-to-buffer b-buffer))
|
|
||||||
(select-window b)))
|
|
||||||
|
|
||||||
(defun narf--evil-window-move (direction)
|
|
||||||
"Move current window to the next window in DIRECTION. If there are no windows
|
"Move current window to the next window in DIRECTION. If there are no windows
|
||||||
there and there is only one window, split in that direction and place this
|
there and there is only one window, split in that direction and place this
|
||||||
window there. If there are no windows and this isn't the only window, use
|
window there. If there are no windows and this isn't the only window, use
|
||||||
|
@ -76,32 +68,22 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf/close-frame ()
|
(defun narf/close-frame ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((data (assq (selected-frame) narf-wg-frames)))
|
(aif (assq (selected-frame) narf-wg-frames)
|
||||||
(if data
|
(progn (wg-delete-workgroup (wg-get-workgroup (cdr it)))
|
||||||
(progn (wg-delete-workgroup (wg-get-workgroup (cdr data)))
|
(delete-frame (car it)))
|
||||||
(delete-frame (car data)))
|
(delete-frame)))
|
||||||
(delete-frame))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf/evil-window-move-left ()
|
(defun narf/evil-window-resize (direction &optional count)
|
||||||
"See `narf--evil-window-move'"
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(narf--evil-window-move 'left))
|
(let ((count (or count 1))
|
||||||
;;;###autoload
|
(next-window (window-in-direction direction)))
|
||||||
(defun narf/evil-window-move-down ()
|
(when (or (not next-window) (not (narf/real-buffer-p (window-buffer next-window))))
|
||||||
"See `narf--evil-window-move'"
|
(setq count (- count)))
|
||||||
(interactive)
|
(cond ((memq direction '(left right))
|
||||||
(narf--evil-window-move 'down))
|
(evil-window-increase-width count))
|
||||||
;;;###autoload
|
((memq direction '(above below))
|
||||||
(defun narf/evil-window-move-up ()
|
(evil-window-increase-height count)))))
|
||||||
"See `narf--evil-window-move'"
|
|
||||||
(interactive)
|
|
||||||
(narf--evil-window-move 'up))
|
|
||||||
;;;###autoload
|
|
||||||
(defun narf/evil-window-move-right ()
|
|
||||||
"See `narf--evil-window-move'"
|
|
||||||
(interactive)
|
|
||||||
(narf--evil-window-move 'right))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun narf/window-reorient ()
|
(defun narf/window-reorient ()
|
||||||
|
|
|
@ -46,6 +46,11 @@
|
||||||
"C-h" 'evil-window-left
|
"C-h" 'evil-window-left
|
||||||
"C-l" 'evil-window-right
|
"C-l" 'evil-window-right
|
||||||
|
|
||||||
|
"A-j" (λ! (narf/evil-window-resize 'below))
|
||||||
|
"A-k" (λ! (narf/evil-window-resize 'above))
|
||||||
|
"A-h" (λ! (narf/evil-window-resize 'left))
|
||||||
|
"A-l" (λ! (narf/evil-window-resize 'right))
|
||||||
|
|
||||||
"C-<escape>" 'evil-emacs-state
|
"C-<escape>" 'evil-emacs-state
|
||||||
:e "C-<escape>" 'evil-normal-state
|
:e "C-<escape>" 'evil-normal-state
|
||||||
|
|
||||||
|
@ -276,10 +281,10 @@
|
||||||
"v" 'narf/evil-window-vsplit
|
"v" 'narf/evil-window-vsplit
|
||||||
|
|
||||||
;; Move window in one step
|
;; Move window in one step
|
||||||
"H" 'narf/evil-window-move-left
|
"H" (λ! (narf/evil-window-move 'left))
|
||||||
"J" 'narf/evil-window-move-down
|
"J" (λ! (narf/evil-window-move 'down))
|
||||||
"K" 'narf/evil-window-move-up
|
"K" (λ! (narf/evil-window-move 'up))
|
||||||
"L" 'narf/evil-window-move-right
|
"L" (λ! (narf/evil-window-move 'right))
|
||||||
|
|
||||||
"C-u" 'narf/undo-window-change
|
"C-u" 'narf/undo-window-change
|
||||||
"C-r" 'narf/redo-window-change
|
"C-r" 'narf/redo-window-change
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue