aboutsummaryrefslogtreecommitdiff
path: root/Doom
diff options
context:
space:
mode:
Diffstat (limited to 'Doom')
-rw-r--r--Doom/.doom.d/modules/private/narrow/README.org7
-rw-r--r--Doom/.doom.d/modules/private/narrow/config.el14
-rw-r--r--Doom/.doom.d/org/config.org17
3 files changed, 22 insertions, 16 deletions
diff --git a/Doom/.doom.d/modules/private/narrow/README.org b/Doom/.doom.d/modules/private/narrow/README.org
new file mode 100644
index 0000000..c767cb8
--- /dev/null
+++ b/Doom/.doom.d/modules/private/narrow/README.org
@@ -0,0 +1,7 @@
+#+TITLE: private/narrow
+#+DATE: May 10, 2020
+
+* Description
+Minimal configuration for narrowing to function.
+* Prerequisites
+* Requirements
diff --git a/Doom/.doom.d/modules/private/narrow/config.el b/Doom/.doom.d/modules/private/narrow/config.el
new file mode 100644
index 0000000..9afd513
--- /dev/null
+++ b/Doom/.doom.d/modules/private/narrow/config.el
@@ -0,0 +1,14 @@
+;;; private/narrow/config.el -*- lexical-binding: t; -*-
+
+(defvar +narrow/narrow-state 't "To narrow or not to narrow. Flips between t and nil")
+
+(defun +narrow/toggle-narrow-state ()
+ "Toggle the state of +narrow/narrow-state between 't and 'nil"
+ (if (= +narrow/narrow-state 't)
+ (setq +narrow/narrow-state nil)
+ (setq +narrow/narrow-state 't)))
+
+(defun +narrow/toggle-narrow ()
+ (interactive)
+ (cond ((+narrow/narrow-state) (narrow-to-defun) (+narrow/toggle-narrow-state))
+ (t (widen))))
diff --git a/Doom/.doom.d/org/config.org b/Doom/.doom.d/org/config.org
index a25ed65..5596b12 100644
--- a/Doom/.doom.d/org/config.org
+++ b/Doom/.doom.d/org/config.org
@@ -460,21 +460,6 @@ General keymap
: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
-(defvar dx:narrow/narrow-state 't "To narrow or not to narrow")
-(defun dx:narrow/toggle-narrow-state ()
- "Toggle the state of dx:narrow/narrow-state between 't and 'nil"
- (if (= dx:narrow/narrow-state 't)
- (setq dx:narrow/narrow-state nil)
- (setq dx:narrow/narrow-state 't)))
-
-(defun dx:narrow/toggle-narrow ()
- (interactive)
- (cond ((dx:narrow/narrow-state) (narrow-to-defun))
- (t (widen))))
-#+END_SRC
*** Keybinds
- Some keybinds for the code prefix which help me with coding or working with
code, particularly LSP
@@ -484,7 +469,7 @@ General keymap
:prefix ("c" . "code") ; Code
:desc "Compile via make" "C" #'+make/run
:desc "Undo tree" "u" #'undo-tree-visualize
- :desc "Narrow to function" "n" #'dx:narrow/toggle-narrow
+ :desc "Narrow to function" "n" #'+narrow/toggle-narrow
(:after format-all
:desc "Format code" "=" #'format-all-buffer)
(:after lsp