Added shortcut to modify how org-src buffers spawn
This commit is contained in:
parent
90c3bcde72
commit
b2846dc476
@ -2468,8 +2468,8 @@ haskell
|
|||||||
~org-edit-src-code~. This means with the original value of
|
~org-edit-src-code~. This means with the original value of
|
||||||
~org-src-window-setup~ (~reorganize-frame~), the current frame will be
|
~org-src-window-setup~ (~reorganize-frame~), the current frame will be
|
||||||
split in two between the original org window and the source window, and
|
split in two between the original org window and the source window, and
|
||||||
once we quit the source window only the org window will remain . This is
|
once we quit the source window only the org window will remain. This is not
|
||||||
not a desired behavior for me, so I chose to set this variable to
|
a desired behavior for me, so I chose to set this variable to
|
||||||
~split-window-right~ in order to keep my windows organization and have a
|
~split-window-right~ in order to keep my windows organization and have a
|
||||||
similar behavior to the old one.
|
similar behavior to the old one.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
@ -2477,6 +2477,27 @@ haskell
|
|||||||
;; (setq org-src-window-setup 'split-window-below)
|
;; (setq org-src-window-setup 'split-window-below)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
However, it is not rare that I want to change that for an horizontal split,
|
||||||
|
which can be achieved with the value ~split-window-below~. Thus, I have
|
||||||
|
made this function that allows me to switch between the (default) vertical
|
||||||
|
split and the horizontal split.
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun phundrak/toggle-org-src-window-split ()
|
||||||
|
"This function allows the user to toggle the behavior of
|
||||||
|
`org-edit-src-code'. If the variable `org-src-window-setup' has
|
||||||
|
the value `split-window-right', then it will be changed to
|
||||||
|
`split-window-below'. Otherwise, it will be set back to
|
||||||
|
`split-window-right'"
|
||||||
|
(interactive)
|
||||||
|
(if (equal org-src-window-setup 'split-window-right)
|
||||||
|
(setq org-src-window-setup 'split-window-below)
|
||||||
|
(setq org-src-window-setup 'split-window-right))
|
||||||
|
(message "Org-src buffers will now split %s"
|
||||||
|
(if (equal org-src-window-setup 'split-window-right)
|
||||||
|
"vertically"
|
||||||
|
"horizontally")))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
**** Miscellaneous
|
**** Miscellaneous
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: h-42ccf90a-f507-4fab-ae42-3fd815a34ef0
|
:CUSTOM_ID: h-42ccf90a-f507-4fab-ae42-3fd815a34ef0
|
||||||
@ -3234,14 +3255,19 @@ haskell
|
|||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(spacemacs/declare-prefix "oo" "org-mode")
|
(spacemacs/declare-prefix "oo" "org-mode")
|
||||||
(spacemacs/declare-prefix-for-mode 'org-mode "o" "custom" "User-defined keybindings")
|
(spacemacs/declare-prefix-for-mode 'org-mode "o" "custom" "User-defined keybindings")
|
||||||
|
(spacemacs/declare-prefix-for-mode 'org-mode "oT" "toggle" "Toggle org elements")
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Now, I have a couple of shortcuts I use regularly:
|
Now, I have a couple of shortcuts I use regularly:
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(spacemacs/declare-prefix "ooT" "toggle")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(spacemacs/set-leader-keys-for-major-mode 'org-mode
|
(spacemacs/set-leader-keys-for-major-mode 'org-mode
|
||||||
"op" 'org-pomodoro
|
"oS" 'org-insert-structure-template
|
||||||
"os" 'org-insert-structure-template
|
"oTs" 'phundrak/toggle-org-src-window-split
|
||||||
"oT" 'org-sidebar-tree)
|
"oTt" 'org-sidebar-tree)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
~oss~ allows me to insert an org structure template defined in
|
~oss~ allows me to insert an org structure template defined in
|
||||||
|
Loading…
Reference in New Issue
Block a user