diff options
author | dx <aryadevchavali1@gmail.com> | 2020-04-15 04:35:36 +0100 |
---|---|---|
committer | dx <aryadevchavali1@gmail.com> | 2020-04-15 04:35:36 +0100 |
commit | eeb5ad48ae9e24d18bd76ec13a823c705c4133ca (patch) | |
tree | aafe348eb4f82a7eb20a41b6762a3fc464ae6652 /doom.d | |
parent | 9dbf9caea49795da4ffc642a865eb5cf7d5157f5 (diff) | |
download | dotfiles-eeb5ad48ae9e24d18bd76ec13a823c705c4133ca.tar.gz dotfiles-eeb5ad48ae9e24d18bd76ec13a823c705c4133ca.tar.bz2 dotfiles-eeb5ad48ae9e24d18bd76ec13a823c705c4133ca.zip |
+narrowing keybind to code subleader
This keybind will narrow into a singular function when the cursor is on
the function line
Diffstat (limited to 'doom.d')
-rw-r--r-- | doom.d/org/config.org | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/doom.d/org/config.org b/doom.d/org/config.org index f744115..38df731 100644 --- a/doom.d/org/config.org +++ b/doom.d/org/config.org @@ -442,6 +442,24 @@ General keymap for leader :desc "Swap windows" "S" #'ace-swap-window) ; allows me to switch windows more efficiently than before, better than just motions #+END_SRC ** Code +*** Narrow handlers +- Toggles narrow to function by checking a variable +#+BEGIN_SRC elisp +(setq oreodave/narrow/narrow-state 0) +(defun oreodave/narrow/toggle-narrow-state () + (if (= oreodave/narrow/narrow-state 1) + (setq oreodave/narrow/narrow-state 0) + (setq oreodave/narrow/narrow-state 1))) + +(add-hook 'post-command-hook #'oreodave/narrow/toggle-narrow-state) + +(defun oreodave/narrow/toggle-narrow () + (interactive) + (if (= oreodave/narrow/narrow-state 1) + (narrow-to-defun) + (widen))) +#+END_SRC +*** Keybinds - Some keybinds for the code prefix which help me with coding or working with code, particularly LSP #+BEGIN_SRC elisp @@ -450,6 +468,7 @@ General keymap for leader :prefix ("c" . "code") ; Code :desc "Fold all in level" "f" #'hs-hide-level :desc "Compile via make" "C" #'+make/run + :desc "Narrow to function" "n" #'oreodave/narrow/toggle-narrow (:after format-all :desc "Format code" "=" #'format-all-buffer) (:after lsp |