aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--oni-cmake.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/oni-cmake.el b/oni-cmake.el
index 5524176..16968e6 100644
--- a/oni-cmake.el
+++ b/oni-cmake.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2021.0730.231115
+;; Version: 2022.0203.215032
;; Package-Requires: (cmake-mode oni-company oni-flycheck oni-lsp cmake-font-lock eldoc-cmake)
;; This program is free software; you can redistribute it and/or modify
@@ -26,6 +26,7 @@
;;; Code:
+(require 'cmake-mode)
(require 'compile)
(require 'flycheck)
@@ -34,6 +35,19 @@
(setq-local comment-auto-fill-only-comments t)
(auto-fill-mode))
+(defun oni-cmake-narrow-to-defun (&optional _include-comments)
+ "Narrow the current buffer the the function around point.
+_INCLUDE-COMMENTS is currently ignored."
+ (interactive)
+ (save-excursion
+ (let ((end (progn (cmake-end-of-defun)
+ (point)))
+ (beginning (progn (cmake-beginning-of-defun)
+ (point))))
+ (narrow-to-region beginning end))))
+
+(define-key cmake-mode-map (kbd "C-x n d") #'oni-cmake-narrow-to-defun)
+
(add-hook 'cmake-mode-hook 'cmake-font-lock-activate)
(add-hook 'cmake-mode-hook 'company-mode)
(add-hook 'cmake-mode-hook 'display-fill-column-indicator-mode)