diff options
Diffstat (limited to 'basic.el')
-rw-r--r-- | basic.el | 79 |
1 files changed, 78 insertions, 1 deletions
@@ -246,6 +246,80 @@ See `display-line-numbers' for details." ;;; Windows +;;;###autoload +(defun durand-enlarge-window (&optional delta horizontal) + "Make the seleted window DELTA lines taller. + +This is a thin wrapper around the default `enlarge-window'. + +If DELTA is nil, it defaults to 1. + +If HORIZONTAL is non-nil, this will make the seleted window DELTA +lines wider instead. + +If DELTA is negative, shrink instead of enlarge. + +Also, if DELTA is 0, then maximize the selected window." + (interactive "P") + (cond + ((eq delta 0) + (enlarge-window (cond + (horizontal (frame-width)) + ((frame-height))) + horizontal)) + ((enlarge-window (prefix-numeric-value delta) horizontal)))) + +;;;###autoload +(defun durand-shrink-window (&optional delta horizontal) + "Make the seleted window DELTA lines smaller. + +This is a thin wrapper around the default `shrink-window'. + +If DELTA is nil, it defaults to 1. + +If HORIZONTAL is non-nil, this will make the seleted window DELTA +lines smaller instead. + +If DELTA is negative, enlarge instead of shrink. + +Also, if DELTA is 0, then minimize the selected window." + (interactive "p") + (cond + ((eq delta 0) + (shrink-window (cond + (horizontal (frame-width)) + ((frame-height))) + horizontal)) + ((shrink-window (prefix-numeric-value delta) horizontal)))) + +;;;###autoload +(defun durand-enlarge-window-horizontally (&optional delta) + "Make selected window DELTA columns wider. + +This is a thin wrapper around the default `enlarge-window-horizontally'. + +DELTA defaults to 1. If DELTA is 0, then maximize the selected +window horizontally." + (interactive "p") + (cond + ((eq delta 0) + (enlarge-window-horizontally (frame-width))) + ((enlarge-window-horizontally (prefix-numeric-value delta))))) + +;;;###autoload +(defun durand-shrink-window-horizontally (&optional delta) + "Make selected window DELTA columns wider. + +This is a thin wrapper around the default `shrink-window-horizontally'. + +DELTA defaults to 1. If DELTA is 0, then maximize the selected +window horizontally." + (interactive "p") + (cond + ((eq delta 0) + (shrink-window-horizontally (frame-width))) + ((shrink-window-horizontally (prefix-numeric-value delta))))) + (define-key global-map (vector ?\s-o) #'other-window) (define-key global-map (vector ?\s-&) #'delete-other-windows) (define-key global-map (vector ?\s-é) #'split-window-below) @@ -253,7 +327,10 @@ See `display-line-numbers' for details." ;; otherwise it would be interpreted as a string quote. (define-key global-map (vector 8388642) #'split-window-right) (define-key global-map (vector ?\s-à) #'delete-window) -(define-key global-map (vector ?\C-+) #'enlarge-window) +(define-key global-map (vector ?\C-+) #'durand-enlarge-window) +(define-key global-map (vector ?\C-=) #'durand-shrink-window) +(define-key global-map (vector ?\C-x ?\{) #'durand-shrink-window-horizontally) +(define-key global-map (vector ?\C-x ?\}) #'durand-enlarge-window-horizontally) (define-key global-map (vector ?\s-f) #'find-file) (define-key global-map (vector ?\s-F) #'find-file-other-window) (define-key global-map (vector ?\s-d) #'dired) |