No NARF, only DOOM
This commit is contained in:
parent
a984bf4f26
commit
ad225d2591
104 changed files with 1404 additions and 1409 deletions
4
Makefile
4
Makefile
|
@ -4,7 +4,7 @@ REPO_URL="https://github.com/hlissner"
|
|||
|
||||
all: install autoloads bootstrap.elc
|
||||
|
||||
# If you keep emacs open while running either of these, run narf/reload afterwards
|
||||
# If you keep emacs open while running either of these, run doom-reload afterwards
|
||||
install: autoloads _install bootstrap.elc
|
||||
update: autoloads _update bootstrap.elc
|
||||
|
||||
|
@ -12,7 +12,7 @@ autoloads:
|
|||
@$(EMACS) --batch \
|
||||
-l bootstrap.el \
|
||||
-l core/core-defuns.el \
|
||||
--eval '(narf-reload-autoloads)' 2>&1
|
||||
--eval '(doom-reload-autoloads)' 2>&1
|
||||
|
||||
compile: autoloads bootstrap.elc
|
||||
@$(EMACS) --batch -f batch-byte-compile 2>&1 \
|
||||
|
|
12
README.md
12
README.md
|
@ -1,4 +1,4 @@
|
|||
# NARF Emacs
|
||||
# DOOM Emacs
|
||||

|
||||
|
||||
> What we do every night, Pinky...
|
||||
|
@ -27,11 +27,11 @@ make snippets # install hlissner/emacs-snippets into private/snippets
|
|||
|
||||
To get a picture of what's in here, check out:
|
||||
|
||||
* [The Caskfile](Cask): lists installed plugins and where they're configured.
|
||||
* [init.el](init.el): lists all loaded modules
|
||||
* [private/my-bindings.el](private/my-bindings.el): most of the custom keybinds
|
||||
* [private/my-commands.el](private/my-commands.el): available custom ex commands
|
||||
* [ext/Makefile](ext/Makefile): lists external dependencies
|
||||
* **[The Caskfile](Cask)**: lists installed plugins and where they're configured.
|
||||
* **[init.el](init.el)**: lists all loaded modules
|
||||
* **[private/my-bindings.el](private/my-bindings.el)**: most of the custom keybinds
|
||||
* **[private/my-commands.el](private/my-commands.el)**: available custom ex commands
|
||||
* **[ext/Makefile](ext/Makefile)**: lists external dependencies
|
||||
|
||||
### Highlights
|
||||
|
||||
|
|
66
bootstrap.el
66
bootstrap.el
|
@ -1,27 +1,28 @@
|
|||
;;; bootstrap.el
|
||||
|
||||
(eval-when-compile
|
||||
(defconst emacs-start-time (current-time))
|
||||
(require 'cl-lib))
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
|
||||
;; Global constants
|
||||
(eval-and-compile
|
||||
(defconst narf-default-theme 'wombat)
|
||||
(defconst narf-terminal-theme 'wombat)
|
||||
(defconst narf-default-font nil)
|
||||
(defconst emacs-start-time (current-time))
|
||||
(defconst emacs-end-time nil)
|
||||
|
||||
(defconst narf-emacs-dir (expand-file-name "." user-emacs-directory))
|
||||
(defconst narf-core-dir (concat narf-emacs-dir "/core"))
|
||||
(defconst narf-modules-dir (concat narf-emacs-dir "/modules"))
|
||||
(defconst narf-private-dir (concat narf-emacs-dir "/private"))
|
||||
(defconst narf-packages-dir (concat narf-emacs-dir "/.cask/" emacs-version "/elpa"))
|
||||
(defconst narf-script-dir (concat narf-emacs-dir "/scripts"))
|
||||
(defconst narf-ext-dir (concat narf-emacs-dir "/ext"))
|
||||
(defconst narf-snippet-dirs (list (concat narf-private-dir "/snippets")
|
||||
(concat narf-private-dir "/templates")))
|
||||
(defconst doom-default-theme 'wombat)
|
||||
(defconst doom-terminal-theme 'wombat)
|
||||
(defconst doom-default-font nil)
|
||||
|
||||
(defconst doom-emacs-dir (expand-file-name "." user-emacs-directory))
|
||||
(defconst doom-core-dir (concat doom-emacs-dir "/core"))
|
||||
(defconst doom-modules-dir (concat doom-emacs-dir "/modules"))
|
||||
(defconst doom-private-dir (concat doom-emacs-dir "/private"))
|
||||
(defconst doom-packages-dir (concat doom-emacs-dir "/.cask/" emacs-version "/elpa"))
|
||||
(defconst doom-script-dir (concat doom-emacs-dir "/scripts"))
|
||||
(defconst doom-ext-dir (concat doom-emacs-dir "/ext"))
|
||||
(defconst doom-snippet-dirs (list (concat doom-private-dir "/snippets")
|
||||
(concat doom-private-dir "/templates")))
|
||||
;; Hostname and emacs version-based elisp temp directories
|
||||
(defconst narf-temp-dir (format "%s/cache/%s/%s.%s"
|
||||
narf-private-dir (system-name)
|
||||
(defconst doom-temp-dir (format "%s/cache/%s/%s.%s"
|
||||
doom-private-dir (system-name)
|
||||
emacs-major-version emacs-minor-version))
|
||||
|
||||
(defconst IS-MAC (eq system-type 'darwin))
|
||||
|
@ -29,7 +30,7 @@
|
|||
(defconst IS-WINDOWS (eq system-type 'windows-nt)))
|
||||
|
||||
(eval-when-compile
|
||||
(defvar narf--load-path load-path)
|
||||
(defvar doom--load-path load-path)
|
||||
|
||||
;; Helper for traversing subdirectories recursively
|
||||
(defun --subdirs (path &optional include-self)
|
||||
|
@ -45,11 +46,11 @@
|
|||
;;
|
||||
|
||||
;; Shut up byte-compiler!
|
||||
(defvar narf-current-theme)
|
||||
(defvar narf-current-font)
|
||||
(defvar doom-current-theme)
|
||||
(defvar doom-current-font)
|
||||
|
||||
(defun narf (packages)
|
||||
"Bootstrap NARF emacs and initialize PACKAGES"
|
||||
(defun doom (packages)
|
||||
"Bootstrap DOOM emacs and initialize PACKAGES"
|
||||
(setq-default gc-cons-threshold 4388608
|
||||
gc-cons-percentage 0.4)
|
||||
|
||||
|
@ -61,23 +62,20 @@
|
|||
;; Scan various folders to populate the load-paths
|
||||
(setq load-path
|
||||
(eval-when-compile
|
||||
(append (list narf-private-dir)
|
||||
(--subdirs narf-core-dir t)
|
||||
(--subdirs narf-modules-dir t)
|
||||
(--subdirs narf-packages-dir)
|
||||
(--subdirs (expand-file-name "../bootstrap" narf-packages-dir))
|
||||
narf--load-path))
|
||||
(append (list doom-private-dir)
|
||||
(--subdirs doom-core-dir t)
|
||||
(--subdirs doom-modules-dir t)
|
||||
(--subdirs doom-packages-dir)
|
||||
(--subdirs (expand-file-name "../bootstrap" doom-packages-dir))
|
||||
doom--load-path))
|
||||
custom-theme-load-path
|
||||
(append (list (expand-file-name "themes/" narf-private-dir))
|
||||
(append (list (expand-file-name "themes/" doom-private-dir))
|
||||
custom-theme-load-path))
|
||||
|
||||
;; Local settings
|
||||
(load "~/.emacs.local.el" t t)
|
||||
(setq narf-current-theme (if (display-graphic-p) narf-default-theme narf-terminal-theme)
|
||||
narf-current-font narf-default-font)
|
||||
;; Here we a'go!
|
||||
(setq doom-current-theme (if (display-graphic-p) doom-default-theme doom-terminal-theme)
|
||||
doom-current-font doom-default-font)
|
||||
(mapc 'require packages)
|
||||
|
||||
(when (display-graphic-p)
|
||||
(require 'server)
|
||||
(unless (server-running-p)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
(mapc (lambda (rule)
|
||||
(define-auto-insert
|
||||
(nth 0 rule)
|
||||
(vector `(lambda () (narf/auto-insert-snippet ,(nth 1 rule) ',(nth 2 rule) ,(nth 3 rule))))))
|
||||
(vector `(lambda () (doom/auto-insert-snippet ,(nth 1 rule) ',(nth 2 rule) ,(nth 3 rule))))))
|
||||
`(;; General
|
||||
("/\\.gitignore$" "__" gitignore-mode)
|
||||
("/Dockerfile$" "__" dockerfile-mode)
|
||||
|
@ -34,7 +34,7 @@
|
|||
;; Elisp
|
||||
("-test\\.el$" "__" emacs-ert-mode)
|
||||
("/.+\\.el$" "__initfile" emacs-lisp-mode)
|
||||
("\\(\\.emacs\\.d\\|narf-emacs\\)/private/\\(snippets\\|templates\\)/.+$"
|
||||
("\\(\\.emacs\\.d\\|doom-emacs\\)/private/\\(snippets\\|templates\\)/.+$"
|
||||
"__" snippet-mode)
|
||||
|
||||
;; Go
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
company-backends '((company-capf company-keywords))
|
||||
|
||||
company-quickhelp-delay nil
|
||||
company-statistics-file (concat narf-temp-dir "/company-stats-cache.el"))
|
||||
company-statistics-file (concat doom-temp-dir "/company-stats-cache.el"))
|
||||
|
||||
:config
|
||||
;; Rewrites evil-complete to use company-dabbrev
|
||||
(setq evil-complete-next-func 'narf/company-evil-complete-next
|
||||
evil-complete-previous-func 'narf/company-evil-complete-previous)
|
||||
(setq evil-complete-next-func 'doom/company-evil-complete-next
|
||||
evil-complete-previous-func 'doom/company-evil-complete-previous)
|
||||
(push 'company-sort-by-occurrence company-transformers)
|
||||
|
||||
(global-company-mode +1)
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
(use-package company-dict
|
||||
:commands company-dict
|
||||
:config (setq company-dict-dir (concat narf-private-dir "/dict")))
|
||||
:config (setq company-dict-dir (concat doom-private-dir "/dict")))
|
||||
|
||||
(use-package company-template
|
||||
:after ac-php-company)
|
||||
|
|
|
@ -80,14 +80,14 @@ Examples:
|
|||
(,@(cond ((or files in pred)
|
||||
(when (and files (not (or (listp files) (stringp files))))
|
||||
(user-error "associate! :files expects a string or list of strings"))
|
||||
(let ((hook-name (intern (format "narf--init-mode-%s" mode))))
|
||||
(let ((hook-name (intern (format "doom--init-mode-%s" mode))))
|
||||
`(progn
|
||||
(defun ,hook-name ()
|
||||
(when (and ,(if match `(if buffer-file-name (string-match-p ,match buffer-file-name)) t)
|
||||
(or ,(not files)
|
||||
(and (boundp ',mode)
|
||||
(not ,mode)
|
||||
(narf/project-has-files ,@(-list files))))
|
||||
(doom/project-has-files ,@(-list files))))
|
||||
(or (not ,pred)
|
||||
(funcall ,pred buffer-file-name)))
|
||||
(,mode 1)))
|
||||
|
@ -96,7 +96,7 @@ Examples:
|
|||
(mapcar (lambda (m) (intern (format "%s-hook" m))) in))
|
||||
`((add-hook 'find-file-hook ',hook-name))))))
|
||||
(match
|
||||
`(add-to-list ',(if minor 'narf-auto-minor-mode-alist 'auto-mode-alist)
|
||||
`(add-to-list ',(if minor 'doom-auto-minor-mode-alist 'auto-mode-alist)
|
||||
(cons ,match ',mode)))
|
||||
(t (user-error "associate! invalid rules for mode [%s] (in %s) (match %s) (files %s)"
|
||||
mode in match files)))))))
|
||||
|
@ -108,7 +108,7 @@ Examples:
|
|||
(mode (intern mode-name))
|
||||
(mode-map (intern (format "%s-map" mode-name)))
|
||||
(mode-hook-sym (intern (format "%s-hook" mode-name)))
|
||||
(mode-init-sym (intern (format "narf--init-project-%s" mode-name))))
|
||||
(mode-init-sym (intern (format "doom--init-project-%s" mode-name))))
|
||||
(let ((modes (plist-get body :modes))
|
||||
(pred (plist-get body :when))
|
||||
(match (plist-get body :match))
|
||||
|
@ -200,9 +200,9 @@ Examples:
|
|||
((keywordp key)
|
||||
(when (memq key '(:leader :localleader))
|
||||
(push (cond ((eq key :leader)
|
||||
narf-leader-prefix)
|
||||
doom-leader)
|
||||
((eq key :localleader)
|
||||
narf-localleader-prefix))
|
||||
doom-localleader))
|
||||
rest)
|
||||
(setq key :prefix))
|
||||
(pcase key
|
||||
|
@ -249,21 +249,20 @@ Examples:
|
|||
(defmacro def-repeat! (command next-func prev-func)
|
||||
"Repeat motions with SPC/S-SPC"
|
||||
`(defadvice ,command
|
||||
(before ,(intern (format "narf-space--%s" (symbol-name command))) activate)
|
||||
(before ,(intern (format "doom-space--%s" (symbol-name command))) activate)
|
||||
(define-key evil-motion-state-map (kbd "SPC") ',next-func)
|
||||
(define-key evil-motion-state-map (kbd "S-SPC") ',prev-func)))
|
||||
|
||||
;;
|
||||
(defun narf|update-scratch-buffer-cwd (&optional dir)
|
||||
(defun doom|update-scratch-buffer-cwd (&optional dir)
|
||||
"Make sure scratch buffer is always 'in a project', and looks good."
|
||||
(let ((dir (or dir (narf/project-root)))
|
||||
(scratchbuf (get-buffer-create "*scratch*")))
|
||||
(with-current-buffer scratchbuf
|
||||
;; Darken the window if it's the only one left
|
||||
(if (one-window-p t)
|
||||
(kill-local-variable 'face-remapping-alist)
|
||||
(set (make-local-variable 'face-remapping-alist)
|
||||
'((default narf-default))))
|
||||
(let ((dir (or dir (doom/project-root))))
|
||||
(with-current-buffer doom-buffer
|
||||
;; Reset scratch buffer if it wasn't visible
|
||||
(unless (or (eq (current-buffer) doom-buffer)
|
||||
(--any? (eq doom-buffer it) (doom/get-visible-windows)))
|
||||
(and (one-window-p t) (doom-mode-init))
|
||||
(setq-local indicate-empty-lines nil))
|
||||
(setq default-directory dir)
|
||||
(setq mode-line-format '(:eval (spaceline-ml-scratch))))))
|
||||
|
||||
|
@ -272,34 +271,34 @@ Examples:
|
|||
;; Global Defuns
|
||||
;;
|
||||
|
||||
(defun narf-reload ()
|
||||
(defun doom-reload ()
|
||||
"Reload `load-path', in case you updated cask while emacs was open!"
|
||||
(interactive)
|
||||
(setq load-path (append (list narf-private-dir narf-core-dir narf-modules-dir narf-packages-dir)
|
||||
(f-directories narf-core-dir nil t)
|
||||
(f-directories narf-modules-dir nil t)
|
||||
(f-directories narf-packages-dir)
|
||||
(f-directories (f-expand "../bootstrap" narf-packages-dir))
|
||||
narf--load-path)))
|
||||
(setq load-path (append (list doom-private-dir doom-core-dir doom-modules-dir doom-packages-dir)
|
||||
(f-directories doom-core-dir nil t)
|
||||
(f-directories doom-modules-dir nil t)
|
||||
(f-directories doom-packages-dir)
|
||||
(f-directories (f-expand "../bootstrap" doom-packages-dir))
|
||||
doom--load-path)))
|
||||
|
||||
(defun narf-reload-autoloads ()
|
||||
"Regenerate autoloads for NARF emacs."
|
||||
(defun doom-reload-autoloads ()
|
||||
"Regenerate autoloads for DOOM emacs."
|
||||
(interactive)
|
||||
(let ((generated-autoload-file (concat narf-core-dir "/autoloads.el")))
|
||||
(let ((generated-autoload-file (concat doom-core-dir "/autoloads.el")))
|
||||
(when (file-exists-p generated-autoload-file)
|
||||
(delete-file generated-autoload-file))
|
||||
(mapc (lambda (dir)
|
||||
(update-directory-autoloads (concat dir "/defuns"))
|
||||
(message "Scanned: %s" dir))
|
||||
(list narf-core-dir narf-modules-dir))
|
||||
(list doom-core-dir doom-modules-dir))
|
||||
(when (called-interactively-p 'interactive)
|
||||
(require 'autoloads))
|
||||
(message "Done!")))
|
||||
|
||||
(defun narf-fix-unicode (font chars &optional size)
|
||||
(defun doom-fix-unicode (font chars &optional size)
|
||||
"Display certain unicode characters in a specific font.
|
||||
|
||||
e.g. (narf-fix-unicode \"DejaVu Sans\" '(?⚠ ?★ ?λ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))"
|
||||
e.g. (doom-fix-unicode \"DejaVu Sans\" '(?⚠ ?★ ?λ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))"
|
||||
(mapc (lambda (x) (set-fontset-font
|
||||
"fontset-default" `(,x . ,x)
|
||||
(font-spec :name font :size size) nil 'prepend))
|
||||
|
|
|
@ -38,14 +38,14 @@
|
|||
;; Save point across sessions
|
||||
(require 'saveplace)
|
||||
(setq-default
|
||||
save-place-file (concat narf-temp-dir "/saveplace")
|
||||
save-place-file (concat doom-temp-dir "/saveplace")
|
||||
save-place t)
|
||||
(when (>= emacs-major-version 25)
|
||||
(save-place-mode +1))
|
||||
|
||||
;; Save history across sessions
|
||||
(require 'savehist)
|
||||
(setq savehist-file (concat narf-temp-dir "/savehist")
|
||||
(setq savehist-file (concat doom-temp-dir "/savehist")
|
||||
savehist-save-minibuffer-history t
|
||||
savehist-additional-variables
|
||||
'(kill-ring search-ring regexp-search-ring))
|
||||
|
@ -64,7 +64,7 @@
|
|||
|
||||
;; Keep track of recently opened files
|
||||
(require 'recentf)
|
||||
(setq recentf-save-file (concat narf-temp-dir "/recentf")
|
||||
(setq recentf-save-file (concat doom-temp-dir "/recentf")
|
||||
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
||||
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$"
|
||||
"wg-default" "/company-statistics-cache.el$")
|
||||
|
@ -78,7 +78,7 @@
|
|||
(setq winner-dont-bind-my-keys t)
|
||||
(winner-mode 1)
|
||||
(add-hook! after-init
|
||||
(setq winner-boring-buffers narf-ignore-buffers))
|
||||
(setq winner-boring-buffers doom-ignore-buffers))
|
||||
|
||||
;; Let editorconfig handle global whitespace settings
|
||||
(use-package editorconfig :demand t
|
||||
|
@ -118,15 +118,15 @@
|
|||
;; Disable by default, please
|
||||
(electric-indent-mode -1)
|
||||
;; Smarter, keyword-based electric-indent (see `def-electric!')
|
||||
(defvar narf-electric-indent-p nil)
|
||||
(defvar-local narf-electric-indent-words '())
|
||||
(defvar doom-electric-indent-p nil)
|
||||
(defvar-local doom-electric-indent-words '())
|
||||
(setq electric-indent-chars '(?\n ?\^?))
|
||||
(push (lambda (c)
|
||||
(when (and (eolp) narf-electric-indent-words)
|
||||
(when (and (eolp) doom-electric-indent-words)
|
||||
(save-excursion
|
||||
(backward-word)
|
||||
(looking-at-p
|
||||
(concat "\\<" (regexp-opt narf-electric-indent-words))))))
|
||||
(concat "\\<" (regexp-opt doom-electric-indent-words))))))
|
||||
electric-indent-functions)
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@
|
|||
(use-package dumb-jump
|
||||
:commands (dumb-jump-go dumb-jump-quick-look dumb-jump-back)
|
||||
:config
|
||||
(setq dumb-jump-default-project narf-emacs-dir)
|
||||
(setq dumb-jump-default-project doom-emacs-dir)
|
||||
(dumb-jump-mode +1))
|
||||
|
||||
(use-package emr
|
||||
|
@ -166,7 +166,7 @@
|
|||
:commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p)
|
||||
:config (setq hs-isearch-open t)
|
||||
:init
|
||||
(advice-add 'evil-toggle-fold :before 'narf*load-hs-minor-mode)
|
||||
(advice-add 'evil-toggle-fold :before 'doom*load-hs-minor-mode)
|
||||
;; Prettify code folding in emacs
|
||||
(define-fringe-bitmap 'hs-marker [16 48 112 240 112 48 16] nil nil 'center)
|
||||
(defface hs-face '((t (:background "#ff8")))
|
||||
|
@ -196,14 +196,14 @@
|
|||
imenu-list-position 'right
|
||||
imenu-list-size 32)
|
||||
(map! :map imenu-list-major-mode-map
|
||||
:n [escape] 'narf/imenu-list-quit
|
||||
:n [escape] 'doom/imenu-list-quit
|
||||
:n "RET" 'imenu-list-goto-entry
|
||||
:n "SPC" 'imenu-list-display-entry
|
||||
:n [tab] 'hs-toggle-hiding))
|
||||
|
||||
(use-package re-builder
|
||||
:commands (re-builder reb-mode-buffer-p)
|
||||
:init (add-hook 'reb-mode-hook 'narf|reb-cleanup)
|
||||
:init (add-hook 'reb-mode-hook 'doom|reb-cleanup)
|
||||
:config
|
||||
(evil-set-initial-state 'reb-mode 'insert)
|
||||
(setq reb-re-syntax 'string)
|
||||
|
@ -262,35 +262,35 @@
|
|||
;; behave more like vim (or how I like it).
|
||||
|
||||
;; Line-wise mouse selection on margin
|
||||
(global-set-key (kbd "<left-margin> <down-mouse-1>") 'narf/mouse-drag-line)
|
||||
(global-set-key (kbd "<left-margin> <mouse-1>") 'narf/mouse-select-line)
|
||||
(global-set-key (kbd "<left-margin> <drag-mouse-1>") 'narf/mouse-select-line)
|
||||
(global-set-key (kbd "<left-margin> <down-mouse-1>") 'doom/mouse-drag-line)
|
||||
(global-set-key (kbd "<left-margin> <mouse-1>") 'doom/mouse-select-line)
|
||||
(global-set-key (kbd "<left-margin> <drag-mouse-1>") 'doom/mouse-select-line)
|
||||
|
||||
;; Restores "dumb" indentation to the tab key. This rustles a lot of peoples'
|
||||
;; jimmies, apparently, but it's how I like it.
|
||||
(map! :i "<tab>" 'narf/dumb-indent
|
||||
:i "<backtab>" 'narf/dumb-dedent
|
||||
(map! :i "<tab>" 'doom/dumb-indent
|
||||
:i "<backtab>" 'doom/dumb-dedent
|
||||
:i "<C-tab>" 'indent-for-tab-command
|
||||
;; No dumb-tab for lisp
|
||||
(:map lisp-mode-map :i [remap narf/dumb-indent] 'indent-for-tab-command)
|
||||
(:map emacs-lisp-mode-map :i [remap narf/dumb-indent] 'indent-for-tab-command)
|
||||
(:map lisp-mode-map :i [remap doom/dumb-indent] 'indent-for-tab-command)
|
||||
(:map emacs-lisp-mode-map :i [remap doom/dumb-indent] 'indent-for-tab-command)
|
||||
;; Highjacks space/backspace to:
|
||||
;; a) eat spaces on either side of the cursor, if present ( | ) -> (|)
|
||||
;; b) allow backspace to delete space-indented blocks intelligently
|
||||
;; c) but do none of this when inside a string
|
||||
:i "SPC" 'narf/inflate-space-maybe
|
||||
:i [remap backward-delete-char-untabify] 'narf/deflate-space-maybe
|
||||
:i [remap newline] 'narf/newline-and-indent
|
||||
:i "SPC" 'doom/inflate-space-maybe
|
||||
:i [remap backward-delete-char-untabify] 'doom/deflate-space-maybe
|
||||
:i [remap newline] 'doom/newline-and-indent
|
||||
;; Smarter move-to-beginning-of-line
|
||||
:i [remap move-beginning-of-line] 'narf/move-to-bol
|
||||
:i [remap move-beginning-of-line] 'doom/move-to-bol
|
||||
;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist
|
||||
:i "C-e" 'narf/move-to-eol
|
||||
:i "C-u" 'narf/backward-kill-to-bol-and-indent
|
||||
:i "C-e" 'doom/move-to-eol
|
||||
:i "C-u" 'doom/backward-kill-to-bol-and-indent
|
||||
;; Fixes delete
|
||||
:i "<kp-delete>" 'delete-char
|
||||
;; Fix osx keymappings and then some
|
||||
:i "<M-left>" 'narf/move-to-bol
|
||||
:i "<M-right>" 'narf/move-to-eol
|
||||
:i "<M-left>" 'doom/move-to-bol
|
||||
:i "<M-right>" 'doom/move-to-eol
|
||||
:i "<M-up>" 'beginning-of-buffer
|
||||
:i "<M-down>" 'end-of-buffer
|
||||
:i "<C-up>" 'smart-up
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
(use-package repl-toggle
|
||||
:commands (rtog/toggle-repl rtog/add-repl)
|
||||
:init
|
||||
(defvar narf--repl-buffer nil)
|
||||
(defvar doom--repl-buffer nil)
|
||||
(defvar-local repl-p nil)
|
||||
(setq rtog/mode-repl-alist '())
|
||||
|
||||
|
@ -61,14 +61,14 @@
|
|||
:n "c" 'realgud:cmd-continue)
|
||||
|
||||
;; Temporary Ex commands for the debugger
|
||||
(def-tmp-excmd! narf:def-debug-on narf:def-debug-off
|
||||
(def-tmp-excmd! doom:def-debug-on doom:def-debug-off
|
||||
("n[ext]" . realgud:cmd-next)
|
||||
("s[tep]" . realgud:cmd-step)
|
||||
("b[reak]" . narf:debug-toggle-breakpoint)
|
||||
("b[reak]" . doom:debug-toggle-breakpoint)
|
||||
("c[ontinue]" . realgud:cmd-continue))
|
||||
|
||||
(advice-add 'realgud-cmdbuf-init :after 'narf:def-debug-on)
|
||||
(advice-add 'realgud:cmd-quit :after 'narf:def-debug-off))
|
||||
(advice-add 'realgud-cmdbuf-init :after 'doom:def-debug-on)
|
||||
(advice-add 'realgud:cmd-quit :after 'doom:def-debug-off))
|
||||
|
||||
(provide 'core-eval)
|
||||
;;; core-eval.el ends here
|
||||
|
|
|
@ -67,25 +67,25 @@
|
|||
(map! :map evil-command-window-mode-map :n [escape] 'kill-buffer-and-window)
|
||||
|
||||
(progn ; evil hacks
|
||||
(advice-add 'evil-force-normal-state :after 'narf*evil-esc-quit)
|
||||
(defun narf*evil-esc-quit ()
|
||||
(advice-add 'evil-force-normal-state :after 'doom*evil-esc-quit)
|
||||
(defun doom*evil-esc-quit ()
|
||||
"Close popups, disable search highlights and quit the minibuffer if open."
|
||||
(if (eq major-mode 'help-mode)
|
||||
(narf/popup-close)
|
||||
(doom/popup-close)
|
||||
(let ((minib-p (minibuffer-window-active-p (minibuffer-window)))
|
||||
(evil-hl-p (evil-ex-hl-active-p 'evil-ex-search)))
|
||||
(when minib-p (abort-recursive-edit))
|
||||
(when evil-hl-p (evil-ex-nohighlight))
|
||||
;; Close non-repl popups and clean up `narf-popup-windows'
|
||||
;; Close non-repl popups and clean up `doom-popup-windows'
|
||||
(unless (or minib-p evil-hl-p
|
||||
(memq (get-buffer-window) narf-popup-windows))
|
||||
(memq (get-buffer-window) doom-popup-windows))
|
||||
(mapc (lambda (w)
|
||||
(if (window-live-p w)
|
||||
(with-selected-window w
|
||||
(unless (derived-mode-p 'comint-mode)
|
||||
(narf/popup-close w)))
|
||||
(narf/popup-remove w)))
|
||||
narf-popup-windows)))))
|
||||
(doom/popup-close w)))
|
||||
(doom/popup-remove w)))
|
||||
doom-popup-windows)))))
|
||||
|
||||
;; Fix harmless (yet disruptive) error reporting w/ hidden buffers caused by
|
||||
;; workgroups killing windows
|
||||
|
@ -130,7 +130,7 @@
|
|||
(let ((flags (split-string (caddr match) ":" t))
|
||||
(path (file-relative-name
|
||||
(pcase (cadr match)
|
||||
("@" (narf/project-root))
|
||||
("@" (doom/project-root))
|
||||
("%" (buffer-file-name))
|
||||
("#" (and (other-buffer) (buffer-file-name (other-buffer)))))
|
||||
default-directory))
|
||||
|
@ -169,8 +169,8 @@
|
|||
(setq file-name (replace-regexp-in-string regexp "\\1" file-name t)))))
|
||||
|
||||
;; Extra argument types for highlight buffer (or global) regexp matches
|
||||
(evil-ex-define-argument-type buffer-match :runner narf/evil-ex-buffer-match)
|
||||
(evil-ex-define-argument-type global-match :runner narf/evil-ex-global-match)
|
||||
(evil-ex-define-argument-type buffer-match :runner doom/evil-ex-buffer-match)
|
||||
(evil-ex-define-argument-type global-match :runner doom/evil-ex-global-match)
|
||||
|
||||
(evil-define-interactive-code "<//>"
|
||||
:ex-arg buffer-match
|
||||
|
@ -199,7 +199,7 @@
|
|||
|
||||
(use-package evil-exchange
|
||||
:commands evil-exchange
|
||||
:config (advice-add 'evil-force-normal-state :after 'narf*evil-exchange-off))
|
||||
:config (advice-add 'evil-force-normal-state :after 'doom*evil-exchange-off))
|
||||
|
||||
(use-package evil-multiedit
|
||||
:commands (evil-multiedit-match-all
|
||||
|
@ -247,7 +247,7 @@
|
|||
|
||||
(use-package evil-easymotion
|
||||
:defer 1
|
||||
:init (defvar narf--evil-snipe-repeat-fn)
|
||||
:init (defvar doom--evil-snipe-repeat-fn)
|
||||
:config
|
||||
(evilem-default-keybindings "g SPC")
|
||||
(evilem-define (kbd "g SPC n") 'evil-ex-search-next)
|
||||
|
@ -263,7 +263,7 @@
|
|||
(evil-snipe-enable-highlight)
|
||||
(evil-snipe-enable-incremental-highlight)))
|
||||
|
||||
(setq narf--evil-snipe-repeat-fn
|
||||
(setq doom--evil-snipe-repeat-fn
|
||||
(evilem-create 'evil-snipe-repeat
|
||||
:bind ((evil-snipe-scope 'whole-buffer)
|
||||
(evil-snipe-enable-highlight)
|
||||
|
@ -283,7 +283,7 @@
|
|||
:config
|
||||
(evil-snipe-mode 1)
|
||||
(evil-snipe-override-mode 1)
|
||||
(define-key evil-snipe-parent-transient-map (kbd "C-;") 'narf/evil-snipe-easymotion))
|
||||
(define-key evil-snipe-parent-transient-map (kbd "C-;") 'doom/evil-snipe-easymotion))
|
||||
|
||||
(use-package evil-surround
|
||||
:commands (global-evil-surround-mode
|
||||
|
@ -302,13 +302,13 @@
|
|||
(add-hook 'org-mode-hook 'embrace-org-mode-hook)
|
||||
(add-hook! (text-mode prog-mode)
|
||||
;; Escaped surround characters
|
||||
(embrace-add-pair-regexp ?\\ "\\[[{(]" "\\[]})]" 'narf/embrace-escaped))
|
||||
(embrace-add-pair-regexp ?\\ "\\[[{(]" "\\[]})]" 'doom/embrace-escaped))
|
||||
(add-hook! emacs-lisp-mode
|
||||
(embrace-add-pair ?\` "`" "'"))
|
||||
(add-hook! (emacs-lisp-mode lisp-mode)
|
||||
(embrace-add-pair-regexp ?f "([^ ]+ " ")" 'narf/embrace-elisp-fn))
|
||||
(embrace-add-pair-regexp ?f "([^ ]+ " ")" 'doom/embrace-elisp-fn))
|
||||
(add-hook! (org-mode latex-mode)
|
||||
(embrace-add-pair-regexp ?l "\\[a-z]+{" "}" 'narf/embrace-latex)))
|
||||
(embrace-add-pair-regexp ?l "\\[a-z]+{" "}" 'doom/embrace-latex)))
|
||||
|
||||
(use-package evil-visualstar
|
||||
:commands (global-evil-visualstar-mode
|
||||
|
@ -326,11 +326,11 @@
|
|||
|
||||
;; evil-escape causes noticable lag in linewise motions in visual mode, so disable it in
|
||||
;; visual mode
|
||||
(defun narf|evil-escape-disable () (evil-escape-mode -1))
|
||||
(defun narf|evil-escape-enable () (evil-escape-mode +1))
|
||||
(add-hook 'evil-visual-state-entry-hook 'narf|evil-escape-disable)
|
||||
(add-hook 'evil-visual-state-exit-hook 'narf|evil-escape-enable)
|
||||
(add-hook 'evil-insert-state-exit-hook 'narf|evil-escape-enable)
|
||||
(defun doom|evil-escape-disable () (evil-escape-mode -1))
|
||||
(defun doom|evil-escape-enable () (evil-escape-mode +1))
|
||||
(add-hook 'evil-visual-state-entry-hook 'doom|evil-escape-disable)
|
||||
(add-hook 'evil-visual-state-exit-hook 'doom|evil-escape-enable)
|
||||
(add-hook 'evil-insert-state-exit-hook 'doom|evil-escape-enable)
|
||||
|
||||
(push 'neotree-mode evil-escape-excluded-major-modes))
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
:n "RET" 'flycheck-error-list-goto-error)
|
||||
|
||||
;; Flycheck buffer on ESC in normal mode.
|
||||
(advice-add 'evil-force-normal-state :after 'narf*flycheck-buffer)
|
||||
(advice-add 'evil-force-normal-state :after 'doom*flycheck-buffer)
|
||||
|
||||
(define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow
|
||||
[0 0 0 8 24 56 120 248 120 56 24 8 0 0 0]
|
||||
|
|
|
@ -46,14 +46,14 @@
|
|||
:e "ESC" 'helm-keyboard-quit)
|
||||
|
||||
;;; Helm hacks
|
||||
(defvar narf-helm-header-fg (face-attribute 'helm-source-header :foreground) "docstring")
|
||||
(defvar doom-helm-header-fg (face-attribute 'helm-source-header :foreground) "docstring")
|
||||
|
||||
;; Shrink source headers if there is only one source
|
||||
(add-hook 'helm-after-initialize-hook 'narf*helm-hide-source-header-maybe)
|
||||
(add-hook 'helm-after-initialize-hook 'doom*helm-hide-source-header-maybe)
|
||||
;; A simpler prompt: see `helm-global-prompt'
|
||||
(advice-add 'helm :filter-args 'narf*helm-replace-prompt)
|
||||
(advice-add 'helm :filter-args 'doom*helm-replace-prompt)
|
||||
;; Hide mode-line in helm windows
|
||||
(advice-add 'helm-display-mode-line :override 'narf*helm-hide-header)
|
||||
(advice-add 'helm-display-mode-line :override 'doom*helm-hide-header)
|
||||
|
||||
(after! yasnippet (push 'helm-alive-p yas-dont-activate)))
|
||||
|
||||
|
@ -71,8 +71,8 @@
|
|||
(use-package helm-buffers
|
||||
:commands (helm-buffers-list helm-mini)
|
||||
:config
|
||||
(defvar narf-helm-force-project-buffers nil)
|
||||
(defun helm*buffer-list (&rest _) (narf/get-buffer-names narf-helm-force-project-buffers))
|
||||
(defvar doom-helm-force-project-buffers nil)
|
||||
(defun helm*buffer-list (&rest _) (doom/get-buffer-names doom-helm-force-project-buffers))
|
||||
(advice-add 'helm-buffer-list :override 'helm*buffer-list))
|
||||
|
||||
(use-package helm-tags
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; core-os-linux.el --- Debian-specific settings
|
||||
|
||||
(defun narf-open-with (&optional app-name path)
|
||||
(defun doom-open-with (&optional app-name path)
|
||||
(interactive)
|
||||
(error "Not yet implemented"))
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
;; OS-integration
|
||||
;;
|
||||
|
||||
(defun narf-open-with (&optional app-name path)
|
||||
(defun doom-open-with (&optional app-name path)
|
||||
"Send PATH to APP-NAME on OSX."
|
||||
(interactive)
|
||||
(let* ((path (f-full (s-replace "'" "\\'"
|
||||
|
@ -85,16 +85,16 @@
|
|||
(defmacro def-open-with! (id &optional app dir)
|
||||
`(defun ,(intern (format "os-%s" id)) ()
|
||||
(interactive)
|
||||
(narf-open-with ,app ,dir)))
|
||||
(doom-open-with ,app ,dir)))
|
||||
|
||||
(def-open-with! open-in-default-program)
|
||||
(def-open-with! open-in-browser "Google Chrome")
|
||||
(def-open-with! reveal "Finder" default-directory)
|
||||
(def-open-with! reveal-project "Finder" (narf/project-root))
|
||||
(def-open-with! reveal-project "Finder" (doom/project-root))
|
||||
(def-open-with! upload "Transmit")
|
||||
(def-open-with! upload-folder "Transmit" default-directory)
|
||||
(def-open-with! send-to-launchbar "LaunchBar")
|
||||
(def-open-with! send-project-to-launchbar "LaunchBar" (narf/project-root))
|
||||
(def-open-with! send-project-to-launchbar "LaunchBar" (doom/project-root))
|
||||
|
||||
(defun os-switch-to-term ()
|
||||
(interactive)
|
||||
|
@ -102,8 +102,8 @@
|
|||
|
||||
(defun os-switch-to-term-and-cd ()
|
||||
(interactive)
|
||||
(narf:send-to-tmux (format "cd %s" (shell-quote-argument default-directory)))
|
||||
(narf-switch-to-iterm))
|
||||
(doom:send-to-tmux (format "cd %s" (shell-quote-argument default-directory)))
|
||||
(doom-switch-to-iterm))
|
||||
|
||||
;; Open with external programs
|
||||
(use-package openwith
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; core-os-win32.el --- Windows-specific settings
|
||||
|
||||
(defun narf-open-with (&optional app-name path)
|
||||
(defun doom-open-with (&optional app-name path)
|
||||
(interactive)
|
||||
(error "Not yet implemented"))
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
:config
|
||||
(shackle-mode 1)
|
||||
(setq shackle-rules
|
||||
'(;; Debuggers
|
||||
`(;; Debuggers
|
||||
("\\`\\*\\(g\\|zsh\\|bash\\)db.*?\\*\\'" :align below :size 20 :regexp t)
|
||||
("\\`\\*trepanjs.*?\\*\\'" :align below :size 20 :regexp t)
|
||||
("\\`\\*\\(debug:\\)haskell\\*\\'" :align below :size 20 :regexp t)
|
||||
|
@ -47,7 +47,7 @@
|
|||
("^\\*.+-Profiler-Report .+\\*$" :align below :size 0.3 :regexp t)
|
||||
("*processing-compilation*" :align below :size 10 :noselect t)
|
||||
("*Backtrace*" :align below :size 0.25 :noselect t)
|
||||
("*scratch*" :align below :size 0.3 :select t)
|
||||
(,doom-buffer-name :align below :size 0.3 :select t)
|
||||
("*Help*" :align below :size 16 :select t)
|
||||
("*Messages*" :align below :size 15 :select t)
|
||||
("*Warnings*" :align below :size 10 :noselect t)
|
||||
|
@ -57,26 +57,26 @@
|
|||
|
||||
;; Custom + REPLs
|
||||
("*eval*" :align below :size 12)
|
||||
("^\\*narf.+\\*$" :regexp t :align below :size 12 :noselect t)
|
||||
("^\\*doom.+\\*$" :regexp t :align below :size 12 :noselect t)
|
||||
((:custom (lambda (b &rest _)
|
||||
(when (featurep 'repl-toggle)
|
||||
(when (string-prefix-p "*" (buffer-name (get-buffer b)))
|
||||
(with-current-buffer b repl-p)))))
|
||||
:popup t :align below :size 16)))
|
||||
|
||||
(defvar narf-popup-windows '()
|
||||
(defvar doom-popup-windows '()
|
||||
"A list of windows that have been opened via shackle. Do not touch this!")
|
||||
|
||||
;; There is no shackle-popup hook, so I hacked one in
|
||||
(advice-add 'shackle-display-buffer :after 'narf|run-popup-hooks)
|
||||
(advice-add 'shackle-display-buffer :after 'doom|run-popup-hooks)
|
||||
|
||||
(add-hook 'shackle-popup-hook 'narf|popup-init) ; Keep track of popups
|
||||
(add-hook 'shackle-popup-hook 'narf|hide-mode-line) ; No mode line in popups
|
||||
(add-hook 'shackle-popup-hook 'doom|popup-init) ; Keep track of popups
|
||||
(add-hook 'shackle-popup-hook 'doom|hide-mode-line) ; No mode line in popups
|
||||
|
||||
;; Prevents popups from messaging with windows-moving functions
|
||||
(defun narf*save-popups (orig-fun &rest args)
|
||||
(narf/popup-save (apply orig-fun args)))
|
||||
(advice-add 'narf/evil-window-move :around 'narf*save-popups))
|
||||
(defun doom*save-popups (orig-fun &rest args)
|
||||
(doom/popup-save (apply orig-fun args)))
|
||||
(advice-add 'doom/evil-window-move :around 'doom*save-popups))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -143,41 +143,41 @@
|
|||
helm-split-window-in-side-p t))
|
||||
|
||||
(after! helm-swoop
|
||||
(setq helm-swoop-split-window-function (lambda ($buf) (narf/popup-buffer $buf))))
|
||||
(setq helm-swoop-split-window-function (lambda ($buf) (doom/popup-buffer $buf))))
|
||||
|
||||
(after! helm-ag
|
||||
;; Helm-ag needs a little coaxing for it to cooperate with shackle. Mostly to prevent
|
||||
;; it from switching between windows and buffers.
|
||||
(defadvice helm-ag--edit-abort (around helm-ag-edit-abort-popup-compat activate)
|
||||
(cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it)
|
||||
(narf/popup-close nil t t))
|
||||
(doom/popup-close nil t t))
|
||||
(defadvice helm-ag--edit-commit (around helm-ag-edit-commit-popup-compat activate)
|
||||
(cl-letf (((symbol-function 'select-window) 'ignore)) ad-do-it)
|
||||
(narf/popup-close nil t t))
|
||||
(doom/popup-close nil t t))
|
||||
(defadvice helm-ag--edit (around helm-ag-edit-popup-compat activate)
|
||||
(cl-letf (((symbol-function 'other-window) 'ignore)
|
||||
((symbol-function 'switch-to-buffer) 'narf/popup-buffer))
|
||||
((symbol-function 'switch-to-buffer) 'doom/popup-buffer))
|
||||
ad-do-it)))
|
||||
|
||||
(after! quickrun
|
||||
;; This allows us to run code several times in a row without having to close the popup
|
||||
;; window and move back to the code buffer.
|
||||
(defun narf*quickrun-close-popup (&optional _ _ _ _)
|
||||
(defun doom*quickrun-close-popup (&optional _ _ _ _)
|
||||
(let* ((buffer (get-buffer quickrun/buffer-name))
|
||||
(window (and buffer (get-buffer-window buffer))))
|
||||
(when buffer
|
||||
(shut-up! (quickrun/kill-running-process))
|
||||
(narf/popup-close window nil t))))
|
||||
(advice-add 'quickrun :before 'narf*quickrun-close-popup)
|
||||
(advice-add 'quickrun-region :before 'narf*quickrun-close-popup)
|
||||
(doom/popup-close window nil t))))
|
||||
(advice-add 'quickrun :before 'doom*quickrun-close-popup)
|
||||
(advice-add 'quickrun-region :before 'doom*quickrun-close-popup)
|
||||
|
||||
;; Turns on `nlinum-mode', and ensures window is scrolled to EOF
|
||||
(defun narf|quickrun-after-run ()
|
||||
(defun doom|quickrun-after-run ()
|
||||
(let ((window (get-buffer-window quickrun/buffer-name)))
|
||||
(with-selected-window window
|
||||
(goto-char (point-min)))))
|
||||
(add-hook 'quickrun-after-run-hook 'narf|quickrun-after-run)
|
||||
(add-hook 'quickrun/mode-hook 'narf|hide-mode-line))
|
||||
(add-hook 'quickrun-after-run-hook 'doom|quickrun-after-run)
|
||||
(add-hook 'quickrun/mode-hook 'doom|hide-mode-line))
|
||||
|
||||
(add-hook! org-load
|
||||
;; This ensures org-src-edit yields control of its buffer to shackle.
|
||||
|
@ -196,7 +196,7 @@
|
|||
args))
|
||||
|
||||
;; Taming Org-agenda!
|
||||
(defun narf/org-agenda-quit ()
|
||||
(defun doom/org-agenda-quit ()
|
||||
"Necessary to finagle org-agenda into shackle popups and behave properly on quit."
|
||||
(interactive)
|
||||
(if org-agenda-columns-active
|
||||
|
@ -210,11 +210,11 @@
|
|||
org-agenda-buffer nil))))
|
||||
|
||||
(map! :map org-agenda-mode-map
|
||||
:e "<escape>" 'narf/org-agenda-quit
|
||||
:e "ESC" 'narf/org-agenda-quit
|
||||
:e [escape] 'narf/org-agenda-quit
|
||||
"q" 'narf/org-agenda-quit
|
||||
"Q" 'narf/org-agenda-quit))
|
||||
:e "<escape>" 'doom/org-agenda-quit
|
||||
:e "ESC" 'doom/org-agenda-quit
|
||||
:e [escape] 'doom/org-agenda-quit
|
||||
"q" 'doom/org-agenda-quit
|
||||
"Q" 'doom/org-agenda-quit))
|
||||
|
||||
(after! realgud
|
||||
;; This allows realgud debuggers to run in a popup.
|
||||
|
@ -229,7 +229,7 @@
|
|||
(if (and process (eq 'run (process-status process)))
|
||||
(progn
|
||||
(pop-to-buffer cmd-buf)
|
||||
(define-key evil-emacs-state-local-map (kbd "ESC ESC") 'narf/debug-quit)
|
||||
(define-key evil-emacs-state-local-map (kbd "ESC ESC") 'doom/debug-quit)
|
||||
(realgud:track-set-debugger debugger-name)
|
||||
(realgud-cmdbuf-info-in-debugger?= 't)
|
||||
(realgud-cmdbuf-info-cmd-args= cmd-args)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
(add-hook 'dired-mode-hook 'dired-omit-mode)
|
||||
|
||||
;; List directories first
|
||||
(defun narf|dired-sort ()
|
||||
(defun doom|dired-sort ()
|
||||
"Dired sort hook to list directories first."
|
||||
(save-excursion
|
||||
(let (buffer-read-only)
|
||||
|
@ -23,15 +23,15 @@
|
|||
(fboundp 'dired-insert-set-properties)
|
||||
(dired-insert-set-properties (point-min) (point-max)))
|
||||
(set-buffer-modified-p nil))
|
||||
(add-hook 'dired-after-readin-hook 'narf|dired-sort)
|
||||
(add-hook 'dired-after-readin-hook 'doom|dired-sort)
|
||||
|
||||
;; Automatically create missing directories when creating new files
|
||||
(defun narf|create-non-existent-directory ()
|
||||
(defun doom|create-non-existent-directory ()
|
||||
(let ((parent-directory (file-name-directory buffer-file-name)))
|
||||
(when (and (not (file-exists-p parent-directory))
|
||||
(y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
|
||||
(make-directory parent-directory t))))
|
||||
(push 'narf|create-non-existent-directory find-file-not-found-functions)
|
||||
(push 'doom|create-non-existent-directory find-file-not-found-functions)
|
||||
|
||||
;;
|
||||
(use-package ido
|
||||
|
@ -50,13 +50,13 @@
|
|||
ido-enable-tramp-completion nil
|
||||
ido-enable-tramp-completion t
|
||||
ido-cr+-max-items 10000
|
||||
ido-save-directory-list-file (concat narf-temp-dir "/ido.last"))
|
||||
(add-hook 'ido-setup-hook 'narf|ido-setup-home-keybind)
|
||||
ido-save-directory-list-file (concat doom-temp-dir "/ido.last"))
|
||||
(add-hook 'ido-setup-hook 'doom|ido-setup-home-keybind)
|
||||
:config
|
||||
(add-hook! ido-setup
|
||||
(push "\\`.DS_Store$" ido-ignore-files)
|
||||
(push "Icon\\?$" ido-ignore-files)
|
||||
(advice-add 'ido-sort-mtime :override 'narf*ido-sort-mtime)
|
||||
(advice-add 'ido-sort-mtime :override 'doom*ido-sort-mtime)
|
||||
|
||||
(require 'ido-vertical-mode)
|
||||
(ido-vertical-mode 1)
|
||||
|
@ -70,7 +70,7 @@
|
|||
"C-w" 'ido-delete-backward-word-updir
|
||||
"C-u" 'ido-up-directory))
|
||||
|
||||
(add-hook! (ido-make-file-list ido-make-dir-list) 'narf*ido-sort-mtime))
|
||||
(add-hook! (ido-make-file-list ido-make-dir-list) 'doom*ido-sort-mtime))
|
||||
|
||||
;;
|
||||
(use-package neotree
|
||||
|
@ -92,19 +92,19 @@
|
|||
neo-banner-message nil)
|
||||
:config
|
||||
(evil-set-initial-state 'neotree-mode 'motion)
|
||||
(add-hook 'neo-after-create-hook 'narf|hide-mode-line)
|
||||
(add-hook 'neo-after-create-hook 'doom|hide-mode-line)
|
||||
|
||||
;; A custom and simple theme for neotree
|
||||
(advice-add 'neo-buffer--insert-fold-symbol :override 'narf*neo-theme)
|
||||
(advice-add 'neo-buffer--insert-fold-symbol :override 'doom*neo-theme)
|
||||
;; Shorter pwd in neotree
|
||||
(advice-add 'neo-buffer--insert-root-entry :filter-args 'narf*neotree-shorten-pwd)
|
||||
(advice-add 'neo-buffer--insert-root-entry :filter-args 'doom*neotree-shorten-pwd)
|
||||
;; Don't ask for confirmation when creating files
|
||||
(advice-add 'neotree-create-node :around 'narf*neotree-create-node)
|
||||
(advice-add 'neotree-create-node :around 'doom*neotree-create-node)
|
||||
;; Prevents messing up the neotree buffer on window changes
|
||||
(advice-add 'narf/evil-window-move :around 'narf*save-neotree)
|
||||
(advice-add 'doom/evil-window-move :around 'doom*save-neotree)
|
||||
|
||||
(add-hook 'neotree-mode-hook 'narf|neotree-init-keymap)
|
||||
(defun narf|neotree-init-keymap ()
|
||||
(add-hook 'neotree-mode-hook 'doom|neotree-init-keymap)
|
||||
(defun doom|neotree-init-keymap ()
|
||||
(setq line-spacing 1)
|
||||
(map! :map evil-motion-state-local-map
|
||||
"ESC ESC" 'neotree-hide
|
||||
|
@ -127,17 +127,17 @@
|
|||
:config
|
||||
(setq projectile-require-project-root nil
|
||||
projectile-enable-caching t
|
||||
projectile-cache-file (concat narf-temp-dir "/projectile.cache")
|
||||
projectile-known-projects-file (concat narf-temp-dir "/projectile.projects")
|
||||
projectile-cache-file (concat doom-temp-dir "/projectile.cache")
|
||||
projectile-known-projects-file (concat doom-temp-dir "/projectile.projects")
|
||||
projectile-indexing-method 'alien
|
||||
projectile-project-root-files narf-project-root-files
|
||||
projectile-project-root-files doom-project-root-files
|
||||
projectile-file-exists-remote-cache-expire nil)
|
||||
|
||||
;; Don't cache ignored files!
|
||||
(defun narf*projectile-cache-current-file (orig-fun &rest args)
|
||||
(defun doom*projectile-cache-current-file (orig-fun &rest args)
|
||||
(unless (--any (f-descendant-of? buffer-file-name it) (projectile-ignored-directories))
|
||||
(apply orig-fun args)))
|
||||
(advice-add 'projectile-cache-current-file :around 'narf*projectile-cache-current-file)
|
||||
(advice-add 'projectile-cache-current-file :around 'doom*projectile-cache-current-file)
|
||||
|
||||
(push "ido.last" projectile-globally-ignored-files)
|
||||
(push "assets" projectile-globally-ignored-directories)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; y/n instead of yes/no
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
(defvar narf-fringe-size 3 "Default fringe width")
|
||||
(defvar doom-fringe-size 3 "Default fringe width")
|
||||
|
||||
(setq-default
|
||||
blink-matching-paren nil ; don't blink--too distracting
|
||||
|
@ -45,12 +45,13 @@
|
|||
(when window-system
|
||||
(setq confirm-kill-emacs
|
||||
(lambda (_)
|
||||
(if (narf/get-real-buffers)
|
||||
(if (doom/get-real-buffers)
|
||||
(y-or-n-p ">> Gee, I dunno Brain... Are you sure?")
|
||||
t))))
|
||||
|
||||
(load-theme narf-current-theme t)
|
||||
(load-theme doom-current-theme t)
|
||||
(tooltip-mode -1) ; show tooltips in echo area
|
||||
|
||||
;; set up minibuffer and fringe
|
||||
(if (not window-system)
|
||||
(menu-bar-mode -1)
|
||||
|
@ -59,44 +60,44 @@
|
|||
;; full filename in frame title
|
||||
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
|
||||
;; set fonts
|
||||
(set-frame-font narf-default-font t)
|
||||
(set-face-attribute 'default t :font narf-current-font)
|
||||
(set-frame-font doom-default-font t)
|
||||
(set-face-attribute 'default t :font doom-current-font)
|
||||
;; standardize fringe width
|
||||
(push `(left-fringe . ,narf-fringe-size) default-frame-alist)
|
||||
(push `(right-fringe . ,narf-fringe-size) default-frame-alist)
|
||||
(push `(left-fringe . ,doom-fringe-size) default-frame-alist)
|
||||
(push `(right-fringe . ,doom-fringe-size) default-frame-alist)
|
||||
;; Default frame size on startup
|
||||
(push '(width . 120) default-frame-alist)
|
||||
(push '(height . 32) default-frame-alist)
|
||||
;; no fringe in the minibuffer
|
||||
(add-hook! after-init (set-window-fringes (minibuffer-window) 0 0 nil))
|
||||
;; Show tilde in margin on empty lines
|
||||
(define-fringe-bitmap 'tilde [64 168 16] nil nil 'center)
|
||||
(set-fringe-bitmap-face 'tilde 'fringe)
|
||||
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde)
|
||||
;; Default frame size on startup
|
||||
(push '(width . 120) default-frame-alist)
|
||||
(push '(height . 32) default-frame-alist))
|
||||
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde))
|
||||
|
||||
;; Try to display unicode characters without upsetting line-hieght (as much as possible)
|
||||
(narf-fix-unicode "DejaVu Sans" '(?⚠ ?★ ?λ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))
|
||||
(doom-fix-unicode "DejaVu Sans" '(?⚠ ?★ ?λ ?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))
|
||||
|
||||
;; on by default in Emacs 25; I prefer to enable on a mode-by-mode basis, so disable it
|
||||
(when (and (> emacs-major-version 24) (featurep 'eldoc))
|
||||
(global-eldoc-mode -1))
|
||||
|
||||
;; Highlight TODO/FIXME/NOTE tags
|
||||
(defface narf-todo-face '((t (:inherit font-lock-warning-face)))
|
||||
(defface doom-todo-face '((t (:inherit font-lock-warning-face)))
|
||||
"Face for TODOs")
|
||||
(defface narf-fixme-face '((t (:inherit font-lock-warning-face)))
|
||||
(defface doom-fixme-face '((t (:inherit font-lock-warning-face)))
|
||||
"Face for FIXMEs")
|
||||
(defface narf-note-face '((t (:inherit font-lock-warning-face)))
|
||||
(defface doom-note-face '((t (:inherit font-lock-warning-face)))
|
||||
"Face for NOTEs")
|
||||
(add-hook! (prog-mode emacs-lisp-mode css-mode)
|
||||
(font-lock-add-keywords
|
||||
nil '(("\\<\\(TODO\\(?:(.*)\\)?:?\\)\\>" 1 'narf-todo-face prepend)
|
||||
("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'narf-fixme-face prepend)
|
||||
("\\<\\(NOTE\\(?:(.*)\\)?:?\\)\\>" 1 'narf-note-face prepend))))
|
||||
nil '(("\\<\\(TODO\\(?:(.*)\\)?:?\\)\\>" 1 'doom-todo-face prepend)
|
||||
("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'doom-fixme-face prepend)
|
||||
("\\<\\(NOTE\\(?:(.*)\\)?:?\\)\\>" 1 'doom-note-face prepend))))
|
||||
|
||||
;; Hide mode-line in help/compile window
|
||||
(add-hook 'help-mode-hook 'narf|hide-mode-line)
|
||||
(add-hook 'compilation-mode-hook 'narf|hide-mode-line)
|
||||
(add-hook 'help-mode-hook 'doom|hide-mode-line)
|
||||
(add-hook 'compilation-mode-hook 'doom|hide-mode-line)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -107,17 +108,17 @@
|
|||
:init
|
||||
(add-hook! (prog-mode markdown-mode) 'hl-line-mode)
|
||||
:config
|
||||
(defvar-local narf--hl-line-mode nil)
|
||||
(defvar-local doom--hl-line-mode nil)
|
||||
(setq hl-line-sticky-flag nil
|
||||
global-hl-line-sticky-flag nil)
|
||||
|
||||
(defun narf|hl-line-on () (if narf--hl-line-mode (hl-line-mode +1)))
|
||||
(defun narf|hl-line-off () (if narf--hl-line-mode (hl-line-mode -1)))
|
||||
(defun doom|hl-line-on () (if doom--hl-line-mode (hl-line-mode +1)))
|
||||
(defun doom|hl-line-off () (if doom--hl-line-mode (hl-line-mode -1)))
|
||||
|
||||
(add-hook! hl-line-mode (if hl-line-mode (setq narf--hl-line-mode t)))
|
||||
(add-hook! hl-line-mode (if hl-line-mode (setq doom--hl-line-mode t)))
|
||||
;; Disable line highlight in visual mode
|
||||
(add-hook 'evil-visual-state-entry-hook 'narf|hl-line-off)
|
||||
(add-hook 'evil-visual-state-exit-hook 'narf|hl-line-on))
|
||||
(add-hook 'evil-visual-state-entry-hook 'doom|hl-line-off)
|
||||
(add-hook 'evil-visual-state-exit-hook 'doom|hl-line-on))
|
||||
|
||||
(use-package visual-fill-column :defer t
|
||||
:config
|
||||
|
@ -134,17 +135,17 @@
|
|||
|
||||
(after! editorconfig
|
||||
(advice-add 'highlight-indentation-guess-offset
|
||||
:override 'narf*hl-indent-guess-offset))
|
||||
:override 'doom*hl-indent-guess-offset))
|
||||
|
||||
;; A long-winded method for ensuring whitespace is maintained (so that
|
||||
;; highlight-indentation-mode can display them consistently)
|
||||
(add-hook! highlight-indentation-mode
|
||||
(if highlight-indentation-mode
|
||||
(progn
|
||||
(narf/add-whitespace)
|
||||
(add-hook 'after-save-hook 'narf/add-whitespace nil t)
|
||||
(doom/add-whitespace)
|
||||
(add-hook 'after-save-hook 'doom/add-whitespace nil t)
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t))
|
||||
(remove-hook 'after-save-hook 'narf/add-whitespace t)
|
||||
(remove-hook 'after-save-hook 'doom/add-whitespace t)
|
||||
(remove-hook 'before-save-hook 'delete-trailing-whitespace t))))
|
||||
|
||||
(use-package highlight-numbers :commands (highlight-numbers-mode))
|
||||
|
@ -161,16 +162,16 @@
|
|||
:commands (rainbow-mode)
|
||||
:init
|
||||
;; hl-line-mode and rainbow-mode don't play well together
|
||||
(add-hook 'rainbow-mode-hook 'narf|hl-line-off))
|
||||
(add-hook 'rainbow-mode-hook 'doom|hl-line-off))
|
||||
|
||||
(use-package nlinum
|
||||
:commands nlinum-mode
|
||||
:preface
|
||||
(setq linum-format "%3d ")
|
||||
(defvar nlinum-format "%4d ")
|
||||
(defvar narf--hl-nlinum-overlay nil)
|
||||
(defvar narf--hl-nlinum-line nil)
|
||||
(defface narf-linum '((t (:inherit linum)))
|
||||
(defvar doom--hl-nlinum-overlay nil)
|
||||
(defvar doom--hl-nlinum-line nil)
|
||||
(defface doom-linum '((t (:inherit linum)))
|
||||
"Face for line in popups")
|
||||
(defface linum-highlight-face '((t (:inherit linum)))
|
||||
"Face for line highlights")
|
||||
|
@ -179,7 +180,7 @@
|
|||
(markdown-mode prog-mode scss-mode web-mode conf-mode)
|
||||
'nlinum-mode)
|
||||
(add-hook! 'nlinum-mode-hook
|
||||
(add-hook 'post-command-hook 'narf|nlinum-hl-line nil t))
|
||||
(add-hook 'post-command-hook 'doom|nlinum-hl-line nil t))
|
||||
:config
|
||||
(add-hook! nlinum-mode
|
||||
(setq nlinum--width
|
||||
|
@ -193,8 +194,8 @@
|
|||
|
||||
(use-package spaceline
|
||||
:init
|
||||
(defvar-local narf--env-version nil)
|
||||
(defvar-local narf--env-command nil)
|
||||
(defvar-local doom--env-version nil)
|
||||
(defvar-local doom--env-command nil)
|
||||
(defvar powerline-height 26)
|
||||
(defvar powerline-default-separator nil)
|
||||
|
||||
|
@ -209,7 +210,7 @@
|
|||
(when buffer-file-name
|
||||
(powerline-raw
|
||||
(f-dirname
|
||||
(let ((buffer-path (f-relative buffer-file-name (narf/project-root)))
|
||||
(let ((buffer-path (f-relative buffer-file-name (doom/project-root)))
|
||||
(max-length (truncate (/ (window-body-width) 1.75))))
|
||||
(concat (projectile-project-name) "/"
|
||||
(if (> (length buffer-path) max-length)
|
||||
|
@ -329,7 +330,7 @@ anzu to be enabled."
|
|||
"The major mode, including process, environment and text-scale info."
|
||||
(concat (format "%s" mode-name)
|
||||
(if (stringp mode-line-process) mode-line-process)
|
||||
(if narf--env-version (concat " " narf--env-version))
|
||||
(if doom--env-version (concat " " doom--env-version))
|
||||
(and (featurep 'face-remap)
|
||||
(/= text-scale-mode-amount 0)
|
||||
(format " (%+d)" text-scale-mode-amount))))
|
||||
|
@ -370,20 +371,20 @@ anzu to be enabled."
|
|||
'((t (:foreground "#8DE6F7" :distant-foreground "#21889B")))
|
||||
"Face for flycheck info feedback in the modeline.")
|
||||
|
||||
(defvar-local narf--flycheck-err-cache nil "")
|
||||
(defvar-local narf--flycheck-cache nil "")
|
||||
(defvar-local doom--flycheck-err-cache nil "")
|
||||
(defvar-local doom--flycheck-cache nil "")
|
||||
(spaceline-define-segment *flycheck
|
||||
"Persistent and cached flycheck indicators in the mode-line."
|
||||
(when (and (bound-and-true-p flycheck-mode)
|
||||
(or flycheck-current-errors
|
||||
(eq 'running flycheck-last-status-change)))
|
||||
(or (and (or (eq narf--flycheck-err-cache narf--flycheck-cache)
|
||||
(or (and (or (eq doom--flycheck-err-cache doom--flycheck-cache)
|
||||
(memq flycheck-last-status-change '(running not-checked)))
|
||||
narf--flycheck-cache)
|
||||
(and (setq narf--flycheck-err-cache flycheck-current-errors)
|
||||
(setq narf--flycheck-cache
|
||||
(let ((fe (narf/-flycheck-count 'error))
|
||||
(fw (narf/-flycheck-count 'warning)))
|
||||
doom--flycheck-cache)
|
||||
(and (setq doom--flycheck-err-cache flycheck-current-errors)
|
||||
(setq doom--flycheck-cache
|
||||
(let ((fe (doom/-flycheck-count 'error))
|
||||
(fw (doom/-flycheck-count 'warning)))
|
||||
(concat
|
||||
(if fe (propertize (format " ⚠%s " fe)
|
||||
'face (if active
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
"/git/ignore$"))
|
||||
|
||||
(use-package git-gutter
|
||||
:commands (git-gutter-mode narf/vcs-next-hunk narf/vcs-prev-hunk
|
||||
narf/vcs-show-hunk narf/vcs-stage-hunk narf/vcs-revert-hunk)
|
||||
:commands (git-gutter-mode doom/vcs-next-hunk doom/vcs-prev-hunk
|
||||
doom/vcs-show-hunk doom/vcs-stage-hunk doom/vcs-revert-hunk)
|
||||
:init
|
||||
(add-hook! (text-mode prog-mode conf-mode) 'git-gutter-mode)
|
||||
:config
|
||||
|
@ -31,11 +31,11 @@
|
|||
(advice-add 'evil-force-normal-state :after 'git-gutter)
|
||||
(add-hook 'focus-in-hook 'git-gutter:update-all-windows)
|
||||
|
||||
(defalias 'narf/vcs-next-hunk 'git-gutter:next-hunk)
|
||||
(defalias 'narf/vcs-prev-hunk 'git-gutter:previous-hunk)
|
||||
(defalias 'narf/vcs-show-hunk 'git-gutter:popup-hunk)
|
||||
(defalias 'narf/vcs-stage-hunk 'git-gutter:stage-hunk)
|
||||
(defalias 'narf/vcs-revert-hunk 'git-gutter:revert-hunk))
|
||||
(defalias 'doom/vcs-next-hunk 'git-gutter:next-hunk)
|
||||
(defalias 'doom/vcs-prev-hunk 'git-gutter:previous-hunk)
|
||||
(defalias 'doom/vcs-show-hunk 'git-gutter:popup-hunk)
|
||||
(defalias 'doom/vcs-stage-hunk 'git-gutter:stage-hunk)
|
||||
(defalias 'doom/vcs-revert-hunk 'git-gutter:revert-hunk))
|
||||
|
||||
(after! vc-annotate
|
||||
(evil-set-initial-state 'vc-annotate-mode 'normal)
|
||||
|
|
|
@ -5,21 +5,20 @@
|
|||
;; code to make a permanent frame header to display these some day)
|
||||
;; 2. Session persistence (with :ss and :sl)
|
||||
|
||||
(defvar narf-wg-frames '()
|
||||
(defvar doom-wg-frames '()
|
||||
"A list of all the frames opened as separate workgroups. See
|
||||
defuns/defuns-workgroups.el.")
|
||||
|
||||
(defvar narf-wg-names '()
|
||||
(defvar doom-wg-names '()
|
||||
"A list of fixed names for workgroups. If a name is set, workgroup names aren't
|
||||
automatically renamed to the project name.")
|
||||
|
||||
(use-package workgroups2
|
||||
:when (display-graphic-p)
|
||||
:init
|
||||
(add-hook 'emacs-startup-hook 'workgroups-mode)
|
||||
(setq-default
|
||||
wg-session-file (concat narf-temp-dir "/workgroups/last")
|
||||
wg-workgroup-directory (concat narf-temp-dir "/workgroups/")
|
||||
wg-session-file (concat doom-temp-dir "/workgroups/last")
|
||||
wg-workgroup-directory (concat doom-temp-dir "/workgroups/")
|
||||
wg-first-wg-name "*untitled*"
|
||||
wg-session-load-on-start nil
|
||||
wg-mode-line-display-on nil
|
||||
|
@ -45,33 +44,35 @@ automatically renamed to the project name.")
|
|||
wg-list-display-decor-previous-left ""
|
||||
wg-list-display-decor-previous-right "")
|
||||
|
||||
(add-hook 'emacs-startup-hook 'workgroups-mode)
|
||||
|
||||
:config
|
||||
;; Remember fixed workgroup names between sessions
|
||||
(push 'narf-wg-names savehist-additional-variables)
|
||||
(push 'doom-wg-names savehist-additional-variables)
|
||||
|
||||
;; `wg-mode-line-display-on' wasn't enough
|
||||
(advice-add 'wg-change-modeline :override 'ignore)
|
||||
|
||||
;; Don't remember popup and neotree windows
|
||||
(add-hook 'kill-emacs-hook 'narf|wg-cleanup)
|
||||
(add-hook 'kill-emacs-hook 'doom|wg-cleanup)
|
||||
|
||||
(after! projectile
|
||||
;; Create a new workgroup on switch-project
|
||||
(setq projectile-switch-project-action 'narf/wg-projectile-switch-project))
|
||||
(setq projectile-switch-project-action 'doom/wg-projectile-switch-project))
|
||||
|
||||
;; This helps abstract some of the underlying functions away, just in case I want to
|
||||
;; switch to a different package in the future, like persp-mode, eyebrowse or wconf.
|
||||
(defalias 'narf/tab-display 'narf/workgroup-display)
|
||||
(defalias 'narf/helm-tabs 'narf:helm-wg)
|
||||
(defalias 'narf/close-window-or-tab 'narf/close-window-or-workgroup)
|
||||
(defalias 'narf:tab-create 'narf:workgroup-new)
|
||||
(defalias 'narf:tab-rename 'narf:workgroup-rename)
|
||||
(defalias 'narf:kill-tab 'narf:workgroup-delete)
|
||||
(defalias 'narf:kill-other-tabs 'narf:kill-other-workgroups)
|
||||
(defalias 'narf:switch-to-tab 'narf:switch-to-workgroup-at-index)
|
||||
(defalias 'narf:switch-to-tab-left 'wg-switch-to-workgroup-left)
|
||||
(defalias 'narf:switch-to-tab-right 'wg-switch-to-workgroup-right)
|
||||
(defalias 'narf:switch-to-tab-last 'wg-switch-to-previous-workgroup))
|
||||
(defalias 'doom/tab-display 'doom/workgroup-display)
|
||||
(defalias 'doom/helm-tabs 'doom:helm-wg)
|
||||
(defalias 'doom/close-window-or-tab 'doom/close-window-or-workgroup)
|
||||
(defalias 'doom:tab-create 'doom:workgroup-new)
|
||||
(defalias 'doom:tab-rename 'doom:workgroup-rename)
|
||||
(defalias 'doom:kill-tab 'doom:workgroup-delete)
|
||||
(defalias 'doom:kill-other-tabs 'doom:kill-other-workgroups)
|
||||
(defalias 'doom:switch-to-tab 'doom:switch-to-workgroup-at-index)
|
||||
(defalias 'doom:switch-to-tab-left 'wg-switch-to-workgroup-left)
|
||||
(defalias 'doom:switch-to-tab-right 'wg-switch-to-workgroup-right)
|
||||
(defalias 'doom:switch-to-tab-last 'wg-switch-to-previous-workgroup))
|
||||
|
||||
(provide 'core-workgroups)
|
||||
;;; core-workgroups.el ends here
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
yas-also-auto-indent-first-line t
|
||||
yas-wrap-around-region nil
|
||||
;; Only load personal snippets
|
||||
yas-snippet-dirs narf-snippet-dirs
|
||||
yas-snippet-dirs doom-snippet-dirs
|
||||
yas-prompt-functions '(yas-ido-prompt yas-no-prompt))
|
||||
|
||||
(add-hook! (text-mode prog-mode snippet-mode markdown-mode org-mode)
|
||||
|
@ -24,15 +24,15 @@
|
|||
:config
|
||||
(yas-reload-all)
|
||||
(map! :map yas-keymap
|
||||
"C-e" 'narf/yas-goto-end-of-field
|
||||
"C-a" 'narf/yas-goto-start-of-field
|
||||
"<M-right>" 'narf/yas-goto-end-of-field
|
||||
"<M-left>" 'narf/yas-goto-start-of-field
|
||||
"C-e" 'doom/yas-goto-end-of-field
|
||||
"C-a" 'doom/yas-goto-start-of-field
|
||||
"<M-right>" 'doom/yas-goto-end-of-field
|
||||
"<M-left>" 'doom/yas-goto-start-of-field
|
||||
"<S-tab>" 'yas-prev-field
|
||||
"<M-backspace>" 'narf/yas-clear-to-sof
|
||||
"<M-backspace>" 'doom/yas-clear-to-sof
|
||||
"<escape>" 'evil-normal-state
|
||||
[backspace] 'narf/yas-backspace
|
||||
"<delete>" 'narf/yas-delete)
|
||||
[backspace] 'doom/yas-backspace
|
||||
"<delete>" 'doom/yas-delete)
|
||||
|
||||
;; Exit snippets on ESC in normal mode
|
||||
(advice-add 'evil-force-normal-state :before 'yas-exit-all-snippets)
|
||||
|
@ -41,14 +41,14 @@
|
|||
;; Once you're in normal mode, you're out
|
||||
(add-hook 'evil-normal-state-entry-hook 'yas-abort-snippet)
|
||||
;; Strip out whitespace before a line selection
|
||||
(add-hook 'yas-before-expand-snippet-hook 'narf|yas-before-expand)
|
||||
(add-hook 'yas-before-expand-snippet-hook 'doom|yas-before-expand)
|
||||
;; Fix previous hook persisting yas-selected-text between expansions
|
||||
(add-hook 'yas-after-exit-snippet-hook 'narf|yas-after-expand))
|
||||
(add-hook 'yas-after-exit-snippet-hook 'doom|yas-after-expand))
|
||||
|
||||
(use-package auto-yasnippet
|
||||
:commands (aya-create aya-expand aya-open-line aya-persist-snippet)
|
||||
:config
|
||||
(setq aya-persist-snippets-dir (concat narf-private-dir "auto-snippets/")))
|
||||
(setq aya-persist-snippets-dir (concat doom-private-dir "auto-snippets/")))
|
||||
|
||||
(provide 'core-yasnippet)
|
||||
;;; core-yasnippet.el ends here
|
||||
|
|
73
core/core.el
73
core/core.el
|
@ -2,14 +2,14 @@
|
|||
;;
|
||||
;;; Naming conventions:
|
||||
;;
|
||||
;; narf-… A public variable/constant or function
|
||||
;; narf--… An internal variable or function (non-interactive)
|
||||
;; narf/… An autoloaded interactive function
|
||||
;; narf:… An ex command
|
||||
;; narf|… A hook
|
||||
;; narf*… An advising function
|
||||
;; narf.… Custom prefix commands
|
||||
;; …! Macro or shortcut alias
|
||||
;; doom-... A public variable/constant or function
|
||||
;; doom--... An internal variable or function (non-interactive)
|
||||
;; doom/... An autoloaded interactive function
|
||||
;; doom:... An ex command
|
||||
;; doom|... A hook
|
||||
;; doom*... An advising function
|
||||
;; doom.... Custom prefix commands
|
||||
;; ...! Macro or shortcut alias
|
||||
;;
|
||||
;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el
|
||||
;;
|
||||
|
@ -20,9 +20,9 @@
|
|||
package--init-file-ensured t
|
||||
package-enable-at-startup nil
|
||||
package-archives
|
||||
'(("gnu" . "http://elpa.gnu.org/packages/")
|
||||
'(("gnu" . "http://elpa.gnu.org/packages/")
|
||||
("melpa" . "http://melpa.org/packages/")
|
||||
("org" . "http://orgmode.org/elpa/"))
|
||||
("org" . "http://orgmode.org/elpa/"))
|
||||
|
||||
ad-redefinition-action 'accept ; silence the advised function warnings
|
||||
compilation-always-kill t ; kill compilation process before spawning another
|
||||
|
@ -36,34 +36,31 @@
|
|||
enable-recursive-minibuffers nil ; no minibufferception
|
||||
idle-update-delay 2 ; update a little less often
|
||||
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
|
||||
inhibit-startup-screen t ; don't show emacs start screen
|
||||
initial-major-mode 'text-mode ; initial scratch buffer mode
|
||||
initial-scratch-message nil
|
||||
major-mode 'text-mode
|
||||
ring-bell-function 'ignore ; silence of the bells!
|
||||
save-interprogram-paste-before-kill nil
|
||||
sentence-end-double-space nil
|
||||
confirm-nonexistent-file-or-buffer nil
|
||||
confirm-nonexistent-file-or-buffer t
|
||||
|
||||
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
||||
minibuffer-prompt-properties
|
||||
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
||||
|
||||
bookmark-save-flag t
|
||||
bookmark-default-file (concat narf-temp-dir "/bookmarks")
|
||||
bookmark-default-file (concat doom-temp-dir "/bookmarks")
|
||||
|
||||
;; Disable all backups (that's what git/dropbox are for)
|
||||
history-length 1000
|
||||
vc-make-backup-files nil
|
||||
auto-save-default nil
|
||||
auto-save-list-file-name (concat narf-temp-dir "/autosave")
|
||||
auto-save-list-file-name (concat doom-temp-dir "/autosave")
|
||||
make-backup-files nil
|
||||
create-lockfiles nil
|
||||
backup-directory-alist `((".*" . ,(concat narf-temp-dir "/backup/")))
|
||||
backup-directory-alist `((".*" . ,(concat doom-temp-dir "/backup/")))
|
||||
|
||||
;; Remember undo history
|
||||
undo-tree-auto-save-history nil
|
||||
undo-tree-history-directory-alist `(("." . ,(concat narf-temp-dir "/undo/"))))
|
||||
undo-tree-history-directory-alist `(("." . ,(concat doom-temp-dir "/undo/"))))
|
||||
|
||||
;; UTF-8 please
|
||||
(setq locale-coding-system 'utf-8) ; pretty
|
||||
|
@ -79,16 +76,16 @@
|
|||
;; Variables
|
||||
;;
|
||||
|
||||
(defvar narf-unreal-buffers '("^ ?\\*.+\\*"
|
||||
(defvar doom-unreal-buffers '("^ ?\\*.+\\*"
|
||||
image-mode
|
||||
dired-mode
|
||||
reb-mode
|
||||
messages-buffer-mode)
|
||||
"A list of regexps or modes whose buffers are considered unreal, and will be
|
||||
ignored when using `narf:next-real-buffer' and `narf:previous-real-buffer' (or
|
||||
killed by `narf/kill-unreal-buffers', or after `narf/kill-real-buffer').")
|
||||
ignored when using `doom:next-real-buffer' and `doom:previous-real-buffer' (or
|
||||
killed by `doom/kill-unreal-buffers', or after `doom/kill-real-buffer').")
|
||||
|
||||
(defvar narf-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
|
||||
(defvar doom-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
|
||||
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
|
||||
"*Buffer List*" "*Ibuffer*" "*NeoTree*" "
|
||||
*NeoTree*" "*esh command on file*" "*WoMan-Log*"
|
||||
|
@ -108,14 +105,14 @@ killed by `narf/kill-unreal-buffers', or after `narf/kill-real-buffer').")
|
|||
"*Org todo*" "*Org Links*" "*Agenda Commands*")
|
||||
"List of buffer names to ignore when using `winner-undo', or `winner-redo'")
|
||||
|
||||
(defvar narf-cleanup-processes-alist '(("pry" . ruby-mode)
|
||||
(defvar doom-cleanup-processes-alist '(("pry" . ruby-mode)
|
||||
("irb" . ruby-mode)
|
||||
("ipython" . python-mode))
|
||||
"An alist of (process-name . major-mode), that `narf:cleanup-processes' checks
|
||||
"An alist of (process-name . major-mode), that `doom:cleanup-processes' checks
|
||||
before killing processes. If there are no buffers with matching major-modes, it
|
||||
gets killed.")
|
||||
|
||||
(defvar narf-project-root-files
|
||||
(defvar doom-project-root-files
|
||||
'(".git" ".hg" ".svn" ".project" "local.properties" "project.properties"
|
||||
"rebar.config" "project.clj" "SConstruct" "pom.xml" "build.sbt"
|
||||
"build.gradle" "Gemfile" "requirements.txt" "tox.ini" "package.json"
|
||||
|
@ -130,10 +127,14 @@ folder is the root of a project or not.")
|
|||
;;
|
||||
|
||||
(require 'f)
|
||||
(unless (require 'autoloads nil t)
|
||||
(load (concat narf-emacs-dir "/scripts/generate-autoloads.el"))
|
||||
(require 'autoloads))
|
||||
(require 'dash)
|
||||
(require 's)
|
||||
|
||||
(require 'core-defuns)
|
||||
(unless (require 'autoloads nil t)
|
||||
(doom-reload-autoloads)
|
||||
(unless (require 'autoloads nil t)
|
||||
(error "Autoloads couldn't be loaded or generated!")))
|
||||
|
||||
(autoload 'use-package "use-package" "" nil 'macro)
|
||||
|
||||
|
@ -147,7 +148,7 @@ folder is the root of a project or not.")
|
|||
persistent-soft-flush
|
||||
persistent-soft-location-readable
|
||||
persistent-soft-location-destroy)
|
||||
:init (defvar pcache-directory (concat narf-temp-dir "/pcache/")))
|
||||
:init (defvar pcache-directory (concat doom-temp-dir "/pcache/")))
|
||||
|
||||
(use-package async
|
||||
:commands (async-start
|
||||
|
@ -168,17 +169,17 @@ folder is the root of a project or not.")
|
|||
;; Automatic minor modes
|
||||
;;
|
||||
|
||||
(defvar narf-auto-minor-mode-alist '()
|
||||
(defvar doom-auto-minor-mode-alist '()
|
||||
"Alist of filename patterns vs corresponding minor mode functions, see
|
||||
`auto-mode-alist'. All elements of this alist are checked, meaning you can
|
||||
enable multiple minor modes for the same regexp.")
|
||||
|
||||
(defun narf|enable-minor-mode-maybe ()
|
||||
"Check file name against `narf-auto-minor-mode-alist'."
|
||||
(defun doom|enable-minor-mode-maybe ()
|
||||
"Check file name against `doom-auto-minor-mode-alist'."
|
||||
(when buffer-file-name
|
||||
(let ((name buffer-file-name)
|
||||
(remote-id (file-remote-p buffer-file-name))
|
||||
(alist narf-auto-minor-mode-alist))
|
||||
(alist doom-auto-minor-mode-alist))
|
||||
;; Remove backup-suffixes from file name.
|
||||
(setq name (file-name-sans-versions name))
|
||||
;; Remove remote file name identification.
|
||||
|
@ -190,7 +191,7 @@ enable multiple minor modes for the same regexp.")
|
|||
(funcall (cdar alist) 1))
|
||||
(setq alist (cdr alist))))))
|
||||
|
||||
(add-hook 'find-file-hook 'narf|enable-minor-mode-maybe)
|
||||
(add-hook 'find-file-hook 'doom|enable-minor-mode-maybe)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -203,8 +204,8 @@ enable multiple minor modes for the same regexp.")
|
|||
;; Prevent any auto-displayed text...
|
||||
(advice-add 'display-startup-echo-area-message :override 'ignore)
|
||||
;; ...so we can display our own
|
||||
(message ":: Loaded in %.3fs"
|
||||
(float-time (time-subtract (current-time) emacs-start-time))))
|
||||
(setq emacs-end-time (float-time (time-subtract (current-time) emacs-start-time)))
|
||||
(message ":: Loaded in %.3fs" emacs-end-time))
|
||||
|
||||
(provide 'core)
|
||||
;;; core.el ends here
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
;; for ../core-auto-insert.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/auto-insert-snippet (key &optional mode project-only)
|
||||
(defun doom/auto-insert-snippet (key &optional mode project-only)
|
||||
"Auto insert a snippet of yasnippet into new file."
|
||||
(interactive)
|
||||
(when (if project-only (narf/project-p) t)
|
||||
(when (if project-only (doom/project-p) t)
|
||||
(let ((is-yasnippet-on (not (cond ((functionp yas-dont-activate)
|
||||
(funcall yas-dont-activate))
|
||||
((consp yas-dont-activate)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-buffers.el
|
||||
|
||||
;;;###autoload (autoload 'narf:narrow "defuns-buffers" nil t)
|
||||
(evil-define-operator narf:narrow (&optional beg end bang)
|
||||
;;;###autoload (autoload 'doom:narrow "defuns-buffers" nil t)
|
||||
(evil-define-operator doom:narrow (&optional beg end bang)
|
||||
"Restrict editing in this buffer to the current region, indirectly. With BANG,
|
||||
clone the buffer and hard-narrow the selection. Otherwise use fancy-narrow. If
|
||||
mark isn't active, then widen the buffer (if narrowed).
|
||||
|
@ -18,14 +18,14 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
|||
(widen)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/set-read-only-region (begin end)
|
||||
(defun doom/set-read-only-region (begin end)
|
||||
"See http://stackoverflow.com/questions/7410125"
|
||||
(let ((modified (buffer-modified-p)))
|
||||
(add-text-properties begin end '(read-only t))
|
||||
(set-buffer-modified-p modified)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/set-region-writeable (begin end)
|
||||
(defun doom/set-region-writeable (begin end)
|
||||
"See http://stackoverflow.com/questions/7410125"
|
||||
(let ((modified (buffer-modified-p))
|
||||
(inhibit-read-only t))
|
||||
|
@ -41,7 +41,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
|||
(defalias 'wg-save-session 'ignore))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-buffers (&optional project-p)
|
||||
(defun doom/get-buffers (&optional project-p)
|
||||
"Get all buffers in the current workgroup.
|
||||
|
||||
If PROJECT-P is non-nil, get all buffers in current workgroup
|
||||
|
@ -51,89 +51,91 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
|||
(--filter (memq it assocbuf) (buffer-list))
|
||||
(buffer-list)))
|
||||
project-root)
|
||||
(aif (and project-p (narf/project-root t))
|
||||
(aif (and project-p (doom/project-root t))
|
||||
(funcall (if (eq project-p 'not) '-remove '-filter)
|
||||
(lambda (b) (projectile-project-buffer-p b it))
|
||||
buffers)
|
||||
buffers)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-buffer-names (&optional project-p)
|
||||
(defun doom/get-buffer-names (&optional project-p)
|
||||
(mapcar (lambda (b) (buffer-name b))
|
||||
(narf/get-buffers project-p)))
|
||||
(doom/get-buffers project-p)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-visible-windows (&optional buffer-list)
|
||||
(defun doom/get-visible-windows (&optional buffer-list)
|
||||
(-map #'get-buffer-window
|
||||
(narf/get-visible-buffers (or buffer-list (narf/get-buffers)))))
|
||||
(doom/get-visible-buffers (or buffer-list (doom/get-buffers)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-visible-buffers (&optional buffer-list)
|
||||
(defun doom/get-visible-buffers (&optional buffer-list)
|
||||
"Get a list of buffers that are not buried (i.e. visible)"
|
||||
(-filter #'get-buffer-window (or buffer-list (narf/get-buffers))))
|
||||
(-filter #'get-buffer-window (or buffer-list (doom/get-buffers))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-buried-buffers (&optional buffer-list)
|
||||
(defun doom/get-buried-buffers (&optional buffer-list)
|
||||
"Get a list of buffers that are buried (i.e. not visible)"
|
||||
(let* ((buffers (or buffer-list (narf/get-buffers)))
|
||||
(let* ((buffers (or buffer-list (doom/get-buffers)))
|
||||
(old-len (length buffers)))
|
||||
(-remove 'get-buffer-window buffers)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-matching-buffers (pattern &optional buffer-list)
|
||||
(defun doom/get-matching-buffers (pattern &optional buffer-list)
|
||||
"Get a list of buffers that match the pattern"
|
||||
(--filter (string-match-p pattern (buffer-name it))
|
||||
(or buffer-list (narf/get-buffers))))
|
||||
(or buffer-list (doom/get-buffers))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-buffers-in-modes (modes &optional buffer-list)
|
||||
(defun doom/get-buffers-in-modes (modes &optional buffer-list)
|
||||
"Get a list of buffers whose major-mode is one of MODES"
|
||||
(--filter (with-current-buffer it (memq major-mode modes))
|
||||
(or buffer-list (narf/get-buffers))))
|
||||
(or buffer-list (doom/get-buffers))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/get-real-buffers (&optional buffer-list)
|
||||
(-filter #'narf/real-buffer-p (or buffer-list (narf/get-buffers))))
|
||||
(defun doom/get-real-buffers (&optional buffer-list)
|
||||
(-filter #'doom/real-buffer-p (or buffer-list (doom/get-buffers))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/kill-real-buffer ()
|
||||
(defun doom/kill-real-buffer ()
|
||||
"Kill buffer (but only bury scratch buffer), then switch to a real buffer. Only buries
|
||||
the buffer if it is being displayed in another window."
|
||||
(interactive)
|
||||
(let (new-dir)
|
||||
(if (string-match-p "^\\*scratch\\*" (or (buffer-name) ""))
|
||||
(message "Already in the scratch buffer")
|
||||
(setq new-dir (narf/project-root))
|
||||
(if (string-match-p doom-buffer-name (or (buffer-name) ""))
|
||||
(progn
|
||||
(doom-mode-init t)
|
||||
(message "Already in the scratch buffer"))
|
||||
(setq new-dir (doom/project-root))
|
||||
(if (> (length (get-buffer-window-list (current-buffer) nil t)) 1)
|
||||
(bury-buffer)
|
||||
(kill-this-buffer)))
|
||||
(if (narf/popup-p (selected-window))
|
||||
(narf/popup-close)
|
||||
(unless (narf/real-buffer-p (current-buffer))
|
||||
(narf/previous-real-buffer)
|
||||
(narf|update-scratch-buffer-cwd new-dir)))))
|
||||
(kill-this-buffer))
|
||||
(if (doom/popup-p (selected-window))
|
||||
(doom/popup-close)
|
||||
(unless (doom/real-buffer-p (current-buffer))
|
||||
(doom/previous-real-buffer)
|
||||
(doom|update-scratch-buffer-cwd new-dir))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/kill-unreal-buffers ()
|
||||
"Kill all buried, unreal buffers in current frame. See `narf-unreal-buffers'"
|
||||
(defun doom/kill-unreal-buffers ()
|
||||
"Kill all buried, unreal buffers in current frame. See `doom-unreal-buffers'"
|
||||
(interactive)
|
||||
(let* ((all-buffers (narf/get-buffers))
|
||||
(real-buffers (narf/get-real-buffers all-buffers))
|
||||
(let* ((all-buffers (doom/get-buffers))
|
||||
(real-buffers (doom/get-real-buffers all-buffers))
|
||||
(kill-list (--filter (not (memq it real-buffers))
|
||||
(narf/get-buried-buffers all-buffers))))
|
||||
(doom/get-buried-buffers all-buffers))))
|
||||
(mapc 'kill-buffer kill-list)
|
||||
(narf/kill-process-buffers)
|
||||
(doom/kill-process-buffers)
|
||||
(message "Cleaned up %s buffers" (length kill-list))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/kill-process-buffers ()
|
||||
(defun doom/kill-process-buffers ()
|
||||
"Kill all buffers that represent running processes and aren't visible."
|
||||
(interactive)
|
||||
(let ((buffer-list (narf/get-buffers))
|
||||
(let ((buffer-list (doom/get-buffers))
|
||||
(killed-processes 0))
|
||||
(dolist (p (process-list))
|
||||
(let* ((process-name (process-name p))
|
||||
(assoc (assoc process-name narf-cleanup-processes-alist)))
|
||||
(assoc (assoc process-name doom-cleanup-processes-alist)))
|
||||
(when (and assoc
|
||||
(not (string= process-name "server"))
|
||||
(process-live-p p)
|
||||
|
@ -145,23 +147,23 @@ the buffer if it is being displayed in another window."
|
|||
(message "Cleaned up %s processes" killed-processes)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/kill-matching-buffers (regexp &optional buffer-list)
|
||||
(defun doom/kill-matching-buffers (regexp &optional buffer-list)
|
||||
(interactive)
|
||||
(let ((i 0))
|
||||
(mapc (lambda (b)
|
||||
(when (string-match-p regexp (buffer-name b))
|
||||
(kill-buffer b)
|
||||
(setq i (1+ i))))
|
||||
(if buffer-list buffer-list (narf/get-buffers)))
|
||||
(if buffer-list buffer-list (doom/get-buffers)))
|
||||
(message "Killed %s matches" i)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/cycle-real-buffers (&optional n)
|
||||
(defun doom/cycle-real-buffers (&optional n)
|
||||
"Switch to the previous buffer and avoid special buffers. If there's nothing
|
||||
left, create a scratch buffer."
|
||||
(let* ((start-buffer (current-buffer))
|
||||
(move-func (if (< n 0) 'switch-to-next-buffer 'switch-to-prev-buffer))
|
||||
(real-buffers (narf/get-real-buffers))
|
||||
(real-buffers (doom/get-real-buffers))
|
||||
(realc (length real-buffers))
|
||||
(max 25)
|
||||
(i 0)
|
||||
|
@ -169,16 +171,16 @@ left, create a scratch buffer."
|
|||
(if (or (= realc 0)
|
||||
(and (= realc 1) (eq (car real-buffers) (current-buffer))))
|
||||
(progn
|
||||
(narf|update-scratch-buffer-cwd)
|
||||
(switch-to-buffer "*scratch*")
|
||||
(doom|update-scratch-buffer-cwd)
|
||||
(switch-to-buffer doom-buffer-name)
|
||||
(message "Nowhere to go"))
|
||||
(funcall move-func)
|
||||
(while (and continue)
|
||||
(let ((current-buffer (current-buffer)))
|
||||
(cond ((or (eq current-buffer start-buffer)
|
||||
(>= i max))
|
||||
(narf|update-scratch-buffer-cwd)
|
||||
(switch-to-buffer "*scratch*")
|
||||
(doom|update-scratch-buffer-cwd)
|
||||
(switch-to-buffer doom-buffer-name)
|
||||
(setq continue nil))
|
||||
((not (memq current-buffer real-buffers))
|
||||
(funcall move-func))
|
||||
|
@ -187,70 +189,70 @@ left, create a scratch buffer."
|
|||
(cl-incf i)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/real-buffer-p (&optional buffer-or-name)
|
||||
(defun doom/real-buffer-p (&optional buffer-or-name)
|
||||
(let ((buffer (if buffer-or-name (get-buffer buffer-or-name) (current-buffer))))
|
||||
(when (buffer-live-p buffer)
|
||||
(not (--any? (if (stringp it)
|
||||
(string-match-p it (buffer-name buffer))
|
||||
(eq (buffer-local-value 'major-mode buffer) it))
|
||||
narf-unreal-buffers)))))
|
||||
doom-unreal-buffers)))))
|
||||
|
||||
;; Inspired by spacemacs <https://github.com/syl20bnr/spacemacs/blob/master/spacemacs/funcs.el>
|
||||
;;;###autoload
|
||||
(defun narf/next-real-buffer ()
|
||||
(defun doom/next-real-buffer ()
|
||||
"Switch to the next buffer and avoid special buffers."
|
||||
(interactive)
|
||||
(narf/cycle-real-buffers +1))
|
||||
(doom/cycle-real-buffers +1))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/previous-real-buffer ()
|
||||
(defun doom/previous-real-buffer ()
|
||||
"Switch to the previous buffer and avoid special buffers."
|
||||
(interactive)
|
||||
(narf/cycle-real-buffers -1))
|
||||
(doom/cycle-real-buffers -1))
|
||||
|
||||
(defun narf--kill-buffers (buffers &optional filter-func)
|
||||
(defun doom--kill-buffers (buffers &optional filter-func)
|
||||
(let ((buffers (if filter-func (-filter filter-func buffers) buffers))
|
||||
(affected 0))
|
||||
(mapc (lambda (b) (when (kill-buffer b) (incf affected))) buffers)
|
||||
(unless (narf/real-buffer-p)
|
||||
(narf/previous-real-buffer))
|
||||
(unless (doom/real-buffer-p)
|
||||
(doom/previous-real-buffer))
|
||||
(message "Killed %s buffers" affected)))
|
||||
|
||||
;;;###autoload (autoload 'narf:kill-all-buffers "defuns-buffers" nil t)
|
||||
(evil-define-command narf:kill-all-buffers (&optional bang)
|
||||
;;;###autoload (autoload 'doom:kill-all-buffers "defuns-buffers" nil t)
|
||||
(evil-define-command doom:kill-all-buffers (&optional bang)
|
||||
"Kill all project buffers. If BANG, kill *all* buffers (in workgroup)."
|
||||
(interactive "<!>")
|
||||
(narf--kill-buffers (narf/get-buffers (not bang)))
|
||||
(mapc (lambda (w) (when (eq (window-buffer w) (get-buffer "*scratch*"))
|
||||
(doom--kill-buffers (doom/get-buffers (not bang)))
|
||||
(mapc (lambda (w) (when (eq (window-buffer w) doom-buffer)
|
||||
(delete-window w)))
|
||||
(narf/get-visible-windows)))
|
||||
(doom/get-visible-windows)))
|
||||
|
||||
;;;###autoload (autoload 'narf:kill-other-buffers "defuns-buffers" nil t)
|
||||
(evil-define-command narf:kill-other-buffers (&optional bang)
|
||||
;;;###autoload (autoload 'doom:kill-other-buffers "defuns-buffers" nil t)
|
||||
(evil-define-command doom:kill-other-buffers (&optional bang)
|
||||
"Kill all other project buffers. If BANG, kill *all* other buffers (in workgroup)."
|
||||
(interactive "<!>")
|
||||
(narf--kill-buffers (narf/get-buffers (not bang))
|
||||
(doom--kill-buffers (doom/get-buffers (not bang))
|
||||
(lambda (b) (not (eq b (current-buffer)))))
|
||||
(when bang
|
||||
(delete-other-windows)))
|
||||
|
||||
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t)
|
||||
(evil-define-command narf:kill-buried-buffers (&optional bang)
|
||||
;;;###autoload (autoload 'doom:kill-buried-buffers "defuns-buffers" nil t)
|
||||
(evil-define-command doom:kill-buried-buffers (&optional bang)
|
||||
"Kill buried project buffers (in workgroup) and report how many it found. BANG = get all
|
||||
buffers regardless of project."
|
||||
(interactive "<!>")
|
||||
(narf--kill-buffers (narf/get-buried-buffers (narf/get-buffers (not bang)))))
|
||||
(doom--kill-buffers (doom/get-buried-buffers (doom/get-buffers (not bang)))))
|
||||
|
||||
;;;###autoload (autoload 'narf:kill-buried-buffers "defuns-buffers" nil t)
|
||||
(evil-define-command narf:kill-matching-buffers (&optional bang pattern)
|
||||
;;;###autoload (autoload 'doom:kill-buried-buffers "defuns-buffers" nil t)
|
||||
(evil-define-command doom:kill-matching-buffers (&optional bang pattern)
|
||||
"Kill project buffers matching regex pattern PATTERN. If BANG, then extend search to
|
||||
buffers regardless of project."
|
||||
:repeat nil
|
||||
(interactive "<!><a>")
|
||||
(narf-kill-buffers (narf/get-matching-buffers pattern (narf/get-buffers (not bang)))))
|
||||
(doom-kill-buffers (doom/get-matching-buffers pattern (doom/get-buffers (not bang)))))
|
||||
|
||||
;;;###autoload (autoload 'narf:send-to-scratch-or-org "defuns-buffers" nil t)
|
||||
(evil-define-operator narf:send-to-scratch-or-org (&optional beg end bang)
|
||||
;;;###autoload (autoload 'doom:send-to-scratch-or-org "defuns-buffers" nil t)
|
||||
(evil-define-operator doom:send-to-scratch-or-org (&optional beg end bang)
|
||||
"Send a selection to the scratch buffer. If BANG, then send it to org-capture instead."
|
||||
:move-point nil
|
||||
:type inclusive
|
||||
|
@ -261,9 +263,9 @@ buffers regardless of project."
|
|||
(if bang
|
||||
(org-capture-string text)
|
||||
;; or scratch buffer by default
|
||||
(let* ((project-dir (narf/project-root t))
|
||||
(buffer-name "*scratch*"))
|
||||
(narf/popup-buffer buffer-name)
|
||||
(let* ((project-dir (doom/project-root t))
|
||||
(buffer-name doom-buffer-name))
|
||||
(doom/popup-buffer buffer-name)
|
||||
(with-current-buffer buffer-name
|
||||
(when project-dir
|
||||
(cd project-dir))
|
||||
|
@ -271,19 +273,19 @@ buffers regardless of project."
|
|||
(funcall mode))
|
||||
))))
|
||||
|
||||
;;;###autoload (autoload 'narf:cd "defuns-buffers" nil t)
|
||||
(evil-define-command narf:cd (dir)
|
||||
;;;###autoload (autoload 'doom:cd "defuns-buffers" nil t)
|
||||
(evil-define-command doom:cd (dir)
|
||||
"Ex-command alias for `cd'"
|
||||
:repeat nil
|
||||
(interactive "<f>")
|
||||
(cd (if (zerop (length dir)) "~" dir)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/kill-all-buffers-do-not-remember ()
|
||||
(defun doom/kill-all-buffers-do-not-remember ()
|
||||
"Kill all buffers so that workgroups2 will wipe its current session."
|
||||
(interactive)
|
||||
(let ((confirm-kill-emacs nil))
|
||||
(mapc 'kill-buffer (narf/get-buffers))
|
||||
(mapc 'kill-buffer (doom/get-buffers))
|
||||
(kill-this-buffer)
|
||||
(delete-other-windows)
|
||||
(wg-save-session t)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
;;; defuns-company.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/company-evil-complete-next (&optional arg)
|
||||
(defun doom/company-evil-complete-next (&optional arg)
|
||||
(call-interactively 'company-dabbrev)
|
||||
(if (eq company-candidates-length 1)
|
||||
(company-complete)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/company-evil-complete-previous (&optional arg)
|
||||
(defun doom/company-evil-complete-previous (&optional arg)
|
||||
(let ((company-selection-wrap-around t))
|
||||
(call-interactively 'company-dabbrev)
|
||||
(if (eq company-candidates-length 1)
|
||||
|
@ -15,7 +15,7 @@
|
|||
(call-interactively 'company-select-previous))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/company-complete-common-or-complete-full ()
|
||||
(defun doom/company-complete-common-or-complete-full ()
|
||||
(interactive)
|
||||
(when (company-manual-begin)
|
||||
(if (eq last-command #'company-complete-common-or-cycle)
|
||||
|
@ -27,7 +27,7 @@
|
|||
(call-interactively #'company-complete-selection)
|
||||
(call-interactively #'company-complete))))))
|
||||
|
||||
(defun narf--company-whole-lines ()
|
||||
(defun doom--company-whole-lines ()
|
||||
(split-string
|
||||
(replace-regexp-in-string
|
||||
"^[\t\s]+" ""
|
||||
|
@ -36,22 +36,22 @@
|
|||
"\\(\r\n\\|[\n\r]\\)" t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/company-whole-lines (command &optional arg &rest ignored)
|
||||
(defun doom/company-whole-lines (command &optional arg &rest ignored)
|
||||
(interactive (list 'interactive))
|
||||
(let ((lines (narf--company-whole-lines)))
|
||||
(let ((lines (doom--company-whole-lines)))
|
||||
(cl-case command
|
||||
(interactive (company-begin-backend 'narf/company-whole-lines))
|
||||
(interactive (company-begin-backend 'doom/company-whole-lines))
|
||||
(prefix (company-grab-line "^[\t\s]*\\(.+\\)" 1))
|
||||
(candidates (all-completions arg lines)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/company-dict-or-keywords ()
|
||||
(defun doom/company-dict-or-keywords ()
|
||||
(interactive)
|
||||
(let ((company-backends '((company-keywords company-dict))))
|
||||
(call-interactively 'company-complete)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/company-complete ()
|
||||
(defun doom/company-complete ()
|
||||
"Bring up the completion popup. If there is only one result, auto-complete it."
|
||||
(interactive)
|
||||
(when (and (company-manual-begin)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
;;; defuns-dash.el --- Dash.app integration
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/dash-at-pt ()
|
||||
(defun doom/dash-at-pt ()
|
||||
(interactive)
|
||||
(if (evil-visual-state-p)
|
||||
(dash-at-point-run-search (buffer-substring-no-properties (region-beginning) (region-end))
|
||||
(dash-at-point-guess-docset))
|
||||
(dash-at-point)))
|
||||
|
||||
;;;###autoload (autoload 'narf:dash "defuns-dash" nil t)
|
||||
(evil-define-command narf:dash (bang input)
|
||||
;;;###autoload (autoload 'doom:dash "defuns-dash" nil t)
|
||||
(evil-define-command doom:dash (bang input)
|
||||
(interactive "<!><a>")
|
||||
(let ((docset (unless bang (dash-at-point-guess-docset)))
|
||||
(query input))
|
||||
|
|
|
@ -28,22 +28,22 @@
|
|||
(interactive)
|
||||
(message "Mode: %s" major-mode))
|
||||
|
||||
;;;###autoload (autoload 'narf:echo "defuns-debug" nil t)
|
||||
(evil-define-command narf:echo (bang message)
|
||||
;;;###autoload (autoload 'doom:echo "defuns-debug" nil t)
|
||||
(evil-define-command doom:echo (bang message)
|
||||
"Display MSG in echo-area without logging it in *Messages* buffer."
|
||||
(interactive "<!><a>")
|
||||
(let (message-log-max)
|
||||
(message "%s%s" (if bang ">> " "") message)))
|
||||
|
||||
;;;###autoload (autoload 'narf:debug "defuns-debug" nil t)
|
||||
(evil-define-command narf:debug (&optional path)
|
||||
;;;###autoload (autoload 'doom:debug "defuns-debug" nil t)
|
||||
(evil-define-command doom:debug (&optional path)
|
||||
"Initiate debugger for current major mode"
|
||||
(interactive "<f>")
|
||||
(let ((default-directory (narf/project-root)))
|
||||
(let ((default-directory (doom/project-root)))
|
||||
(cond ((memq major-mode '(c-mode c++-mode))
|
||||
(realgud:gdb (if path (concat "gdb " path))))
|
||||
((memq major-mode '(ruby-mode enh-ruby-mode))
|
||||
(narf:repl nil (format "run '%s'" (f-filename (or path buffer-file-name)))))
|
||||
(doom:repl nil (format "run '%s'" (f-filename (or path buffer-file-name)))))
|
||||
((eq major-mode 'sh-mode)
|
||||
(let ((shell sh-shell))
|
||||
(when (string= shell "sh")
|
||||
|
@ -60,16 +60,16 @@
|
|||
(haskell-debug))
|
||||
(t (user-error "No debugger for %s" major-mode)))))
|
||||
|
||||
;;;###autoload (autoload 'narf:debug-toggle-breakpoint "defuns-debug" nil t)
|
||||
(evil-define-command narf:debug-toggle-breakpoint (&optional bang)
|
||||
;;;###autoload (autoload 'doom:debug-toggle-breakpoint "defuns-debug" nil t)
|
||||
(evil-define-command doom:debug-toggle-breakpoint (&optional bang)
|
||||
(interactive "<!>")
|
||||
(call-interactively (if bang 'realgud:cmd-clear 'realgud:cmd-break)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/debug-quit ()
|
||||
(defun doom/debug-quit ()
|
||||
(interactive)
|
||||
(ignore-errors (call-interactively 'realgud:cmd-quit))
|
||||
(narf/popup-close)
|
||||
(doom/popup-close)
|
||||
(evil-normal-state))
|
||||
|
||||
(provide 'defuns-debug)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
(defvar *linum-mdown-line* nil)
|
||||
|
||||
(defun narf--line-at-click ()
|
||||
(defun doom--line-at-click ()
|
||||
(save-excursion
|
||||
(let ((click-y (cdr (cdr (mouse-position))))
|
||||
(line-move-visual-store line-move-visual))
|
||||
|
@ -16,18 +16,18 @@
|
|||
(1+ (line-number-at-pos)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/mouse-drag-line ()
|
||||
(defun doom/mouse-drag-line ()
|
||||
(interactive)
|
||||
(goto-line (narf--line-at-click))
|
||||
(goto-line (doom--line-at-click))
|
||||
(set-mark (point))
|
||||
(setq *linum-mdown-line* (line-number-at-pos)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/mouse-select-line ()
|
||||
(defun doom/mouse-select-line ()
|
||||
(interactive)
|
||||
(when *linum-mdown-line*
|
||||
(let (mu-line)
|
||||
(setq mu-line (narf--line-at-click))
|
||||
(setq mu-line (doom--line-at-click))
|
||||
(goto-line *linum-mdown-line*)
|
||||
(if (> mu-line *linum-mdown-line*)
|
||||
(progn
|
||||
|
@ -40,12 +40,12 @@
|
|||
(setq *linum-mdown-line* nil))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*load-hs-minor-mode ()
|
||||
(defun doom*load-hs-minor-mode ()
|
||||
(hs-minor-mode 1)
|
||||
(advice-remove 'evil-toggle-fold 'narf-load-hs-minor-mode))
|
||||
(advice-remove 'evil-toggle-fold 'doom-load-hs-minor-mode))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/reselect-paste ()
|
||||
(defun doom/reselect-paste ()
|
||||
(interactive)
|
||||
(evil-goto-mark ?\[)
|
||||
(evil-visual-state)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; defuns-embrace.el
|
||||
|
||||
(defun narf--embrace-get-pair (char)
|
||||
(defun doom--embrace-get-pair (char)
|
||||
(acond ((cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist))
|
||||
`(,(car it) . ,(cdr it)))
|
||||
((assoc-default char embrace--pairs-list)
|
||||
|
@ -11,23 +11,23 @@
|
|||
(t `(,char . ,char))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/embrace-escaped ()
|
||||
(defun doom/embrace-escaped ()
|
||||
"Escaped surround characters."
|
||||
(let ((char (read-char "\\")))
|
||||
(if (eq char 27)
|
||||
(cons "" "")
|
||||
(let ((pair (narf--embrace-get-pair (string char)))
|
||||
(let ((pair (doom--embrace-get-pair (string char)))
|
||||
(text (if (sp-point-in-string) "\\\\%s" "\\%s")))
|
||||
(cons (format text (car pair))
|
||||
(format text (cdr pair)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/embrace-latex ()
|
||||
(defun doom/embrace-latex ()
|
||||
"LaTeX commands"
|
||||
(cons (format "\\%s{" (read-string "\\")) "}"))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/embrace-elisp-fn ()
|
||||
(defun doom/embrace-elisp-fn ()
|
||||
(cons (format "(%s " (or (read-string "(") "")) ")"))
|
||||
|
||||
(provide 'defuns-embrace)
|
||||
|
|
|
@ -1,49 +1,48 @@
|
|||
;;; defuns-evil.el
|
||||
;; for ../core-evil.el
|
||||
|
||||
;;;###autoload (autoload 'narf:evil-open-folds "defuns-evil" nil t)
|
||||
(evil-define-command narf/evil-open-folds (count)
|
||||
;;;###autoload (autoload 'doom:evil-open-folds "defuns-evil" nil t)
|
||||
(evil-define-command doom/evil-open-folds (count)
|
||||
"Instead of `evil-open-folds'. Accepts COUNT for dictating fold level."
|
||||
(interactive "P")
|
||||
(unless (bound-and-true-p hs-minor-mode)
|
||||
(hs-minor-mode 1))
|
||||
(if count (hs-hide-level count) (evil-open-folds)))
|
||||
|
||||
;;;###autoload (autoload 'narf:evil-open-folds "defuns-evil" nil t)
|
||||
(evil-define-command narf/evil-close-folds (count)
|
||||
;;;###autoload (autoload 'doom:evil-open-folds "defuns-evil" nil t)
|
||||
(evil-define-command doom/evil-close-folds (count)
|
||||
"Instead of `evil-close-folds'. Accepts COUNT for dictating fold level."
|
||||
(interactive "P")
|
||||
(unless (bound-and-true-p hs-minor-mode)
|
||||
(hs-minor-mode 1))
|
||||
(if count (hs-hide-level count) (evil-close-folds)))
|
||||
|
||||
;;;###autoload (autoload 'narf/multi-next-line "defuns-evil" nil t)
|
||||
(evil-define-motion narf/multi-next-line (count)
|
||||
;;;###autoload (autoload 'doom/multi-next-line "defuns-evil" nil t)
|
||||
(evil-define-motion doom/multi-next-line (count)
|
||||
"Move down 6 lines"
|
||||
:type line
|
||||
(let ((line-move-visual visual-line-mode))
|
||||
(evil-line-move (* 6 (or count 1)))))
|
||||
|
||||
;;;###autoload (autoload 'narf/multi-previous-line "defuns-evil" nil t)
|
||||
(evil-define-motion narf/multi-previous-line (count)
|
||||
;;;###autoload (autoload 'doom/multi-previous-line "defuns-evil" nil t)
|
||||
(evil-define-motion doom/multi-previous-line (count)
|
||||
"Move up 6 lines"
|
||||
:type line
|
||||
(let ((line-move-visual visual-line-mode))
|
||||
(evil-line-move (- (* 6 (or count 1))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-visual-line-state-p ()
|
||||
(defun doom/evil-visual-line-state-p ()
|
||||
"Returns non-nil if in visual-line mode, nil otherwise."
|
||||
(and (evil-visual-state-p)
|
||||
(eq (evil-visual-type) 'line)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*evil-exchange-off ()
|
||||
(defun doom*evil-exchange-off ()
|
||||
(when evil-exchange--overlays
|
||||
(evil-exchange-cancel)))
|
||||
|
||||
;;;###autoload (autoload 'narf/evil-macro-on-all-lines "defuns-evil" nil t)
|
||||
(evil-define-operator narf/evil-macro-on-all-lines (beg end &optional macro)
|
||||
;;;###autoload (autoload 'doom/evil-macro-on-all-lines "defuns-evil" nil t)
|
||||
(evil-define-operator doom/evil-macro-on-all-lines (beg end &optional macro)
|
||||
"Apply macro to each line."
|
||||
:motion nil
|
||||
:move-point nil
|
||||
|
@ -57,8 +56,8 @@
|
|||
(or macro (read-char "@-"))))))
|
||||
|
||||
;;; Custom argument handlers
|
||||
(defvar narf-buffer-match-global evil-ex-substitute-global "")
|
||||
(defun narf--evil-ex-match-init (name &optional face update-hook)
|
||||
(defvar doom-buffer-match-global evil-ex-substitute-global "")
|
||||
(defun doom--evil-ex-match-init (name &optional face update-hook)
|
||||
(with-current-buffer evil-ex-current-buffer
|
||||
(cond
|
||||
((eq flag 'start)
|
||||
|
@ -70,7 +69,7 @@
|
|||
((eq flag 'stop)
|
||||
(evil-ex-delete-hl name)))))
|
||||
|
||||
(defun narf--evil-ex-buffer-match (arg &optional hl-name flags beg end)
|
||||
(defun doom--evil-ex-buffer-match (arg &optional hl-name flags beg end)
|
||||
(when (and (eq flag 'update)
|
||||
evil-ex-substitute-highlight-all
|
||||
(not (zerop (length arg))))
|
||||
|
@ -94,22 +93,22 @@
|
|||
(evil-ex-pattern-update-ex-info nil (format "?%s" lossage))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-ex-buffer-match (flag &optional arg)
|
||||
(defun doom/evil-ex-buffer-match (flag &optional arg)
|
||||
(let ((hl-name 'evil-ex-buffer-match))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(narf--evil-ex-match-init hl-name)
|
||||
(narf--evil-ex-buffer-match arg hl-name (list (if narf-buffer-match-global ?g))))))
|
||||
(doom--evil-ex-match-init hl-name)
|
||||
(doom--evil-ex-buffer-match arg hl-name (list (if doom-buffer-match-global ?g))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-ex-global-match (flag &optional arg)
|
||||
(defun doom/evil-ex-global-match (flag &optional arg)
|
||||
(let ((hl-name 'evil-ex-global-match))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(narf--evil-ex-match-init hl-name)
|
||||
(doom--evil-ex-match-init hl-name)
|
||||
(let ((result (car-safe (evil-ex-parse-global arg))))
|
||||
(narf--evil-ex-buffer-match result hl-name nil (point-min) (point-max))))))
|
||||
(doom--evil-ex-buffer-match result hl-name nil (point-min) (point-max))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-ex-undefine-cmd (cmd)
|
||||
(defun doom/evil-ex-undefine-cmd (cmd)
|
||||
(if (string-match "^[^][]*\\(\\[\\(.*\\)\\]\\)[^][]*$" cmd)
|
||||
(let ((abbrev (replace-match "" nil t cmd 1))
|
||||
(full (replace-match "\\2" nil nil cmd 1)))
|
||||
|
@ -117,10 +116,10 @@
|
|||
(setq evil-ex-commands (delq (assoc abbrev evil-ex-commands) evil-ex-commands)))
|
||||
(setq evil-ex-commands (delq (assoc cmd evil-ex-commands) evil-ex-commands))))
|
||||
|
||||
(defvar narf:map-maps '())
|
||||
(defvar doom:map-maps '())
|
||||
|
||||
;;;###autoload (autoload 'narf:map "defuns-evil" nil t)
|
||||
(evil-define-command narf:map (bang input &optional mode)
|
||||
;;;###autoload (autoload 'doom:map "defuns-evil" nil t)
|
||||
(evil-define-command doom:map (bang input &optional mode)
|
||||
"Map ex commands to keybindings. INPUT should be in the format [KEY] [EX COMMAND]."
|
||||
(interactive "<!><a>")
|
||||
(let* ((parts (s-split-up-to " " input 2 t))
|
||||
|
@ -138,31 +137,31 @@
|
|||
(evil-define-key mode nil key fn)
|
||||
(define-key map key fn))))
|
||||
|
||||
;;;###autoload (autoload 'narf:nmap "defuns-evil" nil t)
|
||||
(evil-define-command narf:nmap (bang input &optional mode)
|
||||
(interactive "<!><a>") (narf:map bang input 'normal))
|
||||
;;;###autoload (autoload 'doom:nmap "defuns-evil" nil t)
|
||||
(evil-define-command doom:nmap (bang input &optional mode)
|
||||
(interactive "<!><a>") (doom:map bang input 'normal))
|
||||
|
||||
;;;###autoload (autoload 'narf:imap "defuns-evil" nil t)
|
||||
(evil-define-command narf:imap (bang input &optional mode)
|
||||
(interactive "<!><a>") (narf:map bang input 'insert))
|
||||
;;;###autoload (autoload 'doom:imap "defuns-evil" nil t)
|
||||
(evil-define-command doom:imap (bang input &optional mode)
|
||||
(interactive "<!><a>") (doom:map bang input 'insert))
|
||||
|
||||
;;;###autoload (autoload 'narf:vmap "defuns-evil" nil t)
|
||||
(evil-define-command narf:vmap (bang input &optional mode)
|
||||
(interactive "<!><a>") (narf:map bang input 'visual))
|
||||
;;;###autoload (autoload 'doom:vmap "defuns-evil" nil t)
|
||||
(evil-define-command doom:vmap (bang input &optional mode)
|
||||
(interactive "<!><a>") (doom:map bang input 'visual))
|
||||
|
||||
;;;###autoload (autoload 'narf:mmap "defuns-evil" nil t)
|
||||
(evil-define-command narf:mmap (bang input &optional mode)
|
||||
(interactive "<!><a>") (narf:map bang input 'motion))
|
||||
;;;###autoload (autoload 'doom:mmap "defuns-evil" nil t)
|
||||
(evil-define-command doom:mmap (bang input &optional mode)
|
||||
(interactive "<!><a>") (doom:map bang input 'motion))
|
||||
|
||||
;;;###autoload (autoload 'narf:omap "defuns-evil" nil t)
|
||||
(evil-define-command narf:omap (bang input &optional mode)
|
||||
(interactive "<!><a>") (narf:map bang input 'operator))
|
||||
;;;###autoload (autoload 'doom:omap "defuns-evil" nil t)
|
||||
(evil-define-command doom:omap (bang input &optional mode)
|
||||
(interactive "<!><a>") (doom:map bang input 'operator))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-snipe-easymotion ()
|
||||
(defun doom/evil-snipe-easymotion ()
|
||||
(interactive)
|
||||
(require 'evil-easymotion)
|
||||
(call-interactively narf--evil-snipe-repeat-fn))
|
||||
(call-interactively doom--evil-snipe-repeat-fn))
|
||||
|
||||
(provide 'defuns-evil)
|
||||
;;; defuns-evil.el ends here
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-file.el
|
||||
|
||||
;;;###autoload (autoload 'narf:file-delete "defuns-file" nil t)
|
||||
(evil-define-command narf:file-delete (&optional bang filename)
|
||||
;;;###autoload (autoload 'doom:file-delete "defuns-file" nil t)
|
||||
(evil-define-command doom:file-delete (&optional bang filename)
|
||||
"Delete current buffer's file. If bang, then kill the buffer afterwards as well."
|
||||
:repeat nil
|
||||
(interactive "<!><f>")
|
||||
|
@ -14,18 +14,18 @@
|
|||
(mapc (lambda (file)
|
||||
(when (file-exists-p file)
|
||||
(delete-file file t)))
|
||||
(narf/org-attachments)))
|
||||
(doom/org-attachments)))
|
||||
(set-buffer-modified-p nil)
|
||||
(delete-file filename)
|
||||
(kill-this-buffer)
|
||||
(unless (narf/real-buffer-p)
|
||||
(narf/previous-real-buffer))
|
||||
(unless (doom/real-buffer-p)
|
||||
(doom/previous-real-buffer))
|
||||
(save-place-forget-unreadable-files)
|
||||
(message "File successfully deleted: %s" filename)))))
|
||||
|
||||
(defun narf--save-exit() (save-buffer) (kill-buffer) (remove-hook 'yas-after-exit-snippet-hook '--save-exit))
|
||||
;;;###autoload (autoload 'narf:file-create "defuns-file" nil t)
|
||||
(evil-define-command narf:file-create (path &optional bang)
|
||||
(defun doom--save-exit() (save-buffer) (kill-buffer) (remove-hook 'yas-after-exit-snippet-hook '--save-exit))
|
||||
;;;###autoload (autoload 'doom:file-create "defuns-file" nil t)
|
||||
(evil-define-command doom:file-create (path &optional bang)
|
||||
"Deploy files (and their associated templates) quickly. Will prompt
|
||||
you to fill in each snippet field before buffer closes unless BANG is
|
||||
provided."
|
||||
|
@ -40,12 +40,12 @@ provided."
|
|||
(if (f-exists? fullpath)
|
||||
(error "File already exists: %s" path)
|
||||
(find-file fullpath)
|
||||
(add-hook 'yas-after-exit-snippet-hook 'narf--save-exit)
|
||||
(if bang (narf--save-exit)))
|
||||
(add-hook 'yas-after-exit-snippet-hook 'doom--save-exit)
|
||||
(if bang (doom--save-exit)))
|
||||
(error "Directory doesn't exist: %s" dir))))
|
||||
|
||||
;;;###autoload (autoload 'narf:file-move "defuns-file" nil t)
|
||||
(evil-define-command narf:file-move (path)
|
||||
;;;###autoload (autoload 'doom:file-move "defuns-file" nil t)
|
||||
(evil-define-command doom:file-move (path)
|
||||
"Move current buffer's file to PATH. Replaces %, # and other variables (see
|
||||
`evil-ex-replace-special-filenames')"
|
||||
:repeat nil
|
||||
|
@ -56,13 +56,13 @@ provided."
|
|||
((f-dir? (f-dirname path))
|
||||
(f-full path))
|
||||
(t (user-error "Not a valid destination: %s" path))))
|
||||
(project-root (narf/project-root)))
|
||||
(project-root (doom/project-root)))
|
||||
;; Move all attachments if in org-mode
|
||||
(when (eq major-mode 'org-mode)
|
||||
(mapc (lambda (file)
|
||||
(when (and (file-exists-p file) (not (f-same? old-path new-path)))
|
||||
(rename-file file (f-expand (f-filename old-path) (f-dirname new-path)) t)))
|
||||
(narf/org-attachments)))
|
||||
(doom/org-attachments)))
|
||||
(when (buffer-modified-p)
|
||||
(save-buffer))
|
||||
(rename-file old-path new-path 1)
|
||||
|
@ -70,7 +70,7 @@ provided."
|
|||
(set-visited-file-name new-path)
|
||||
(set-buffer-modified-p nil)
|
||||
(save-place-forget-unreadable-files)
|
||||
(setq narf--spaceline-file-path nil)
|
||||
(setq doom--spaceline-file-path nil)
|
||||
(message "File '%s' successfully renamed to '%s'"
|
||||
(f-relative old-path project-root) (f-relative new-path project-root))))
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
;; for ../core-flycheck.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*flycheck-buffer ()
|
||||
(defun doom*flycheck-buffer ()
|
||||
(when (bound-and-true-p flycheck-mode)
|
||||
(flycheck-buffer)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/flycheck-next-error ()
|
||||
(defun doom/flycheck-next-error ()
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(if (bound-and-true-p flycheck-mode)
|
||||
|
@ -15,7 +15,7 @@
|
|||
'next-error)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/flycheck-previous-error ()
|
||||
(defun doom/flycheck-previous-error ()
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(if (bound-and-true-p flycheck-mode)
|
||||
|
@ -23,7 +23,7 @@
|
|||
'previous-error)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/flycheck-errors ()
|
||||
(defun doom/flycheck-errors ()
|
||||
(interactive)
|
||||
(when (bound-and-true-p flycheck-mode)
|
||||
(flycheck-buffer)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-git.el
|
||||
|
||||
;;;### (autoload 'narf/git-remote-browse "defuns-git" nil t)
|
||||
(evil-define-command narf:git-remote-browse (&optional bang)
|
||||
;;;### (autoload 'doom:git-remote-browse "defuns-git" nil t)
|
||||
(evil-define-command doom:git-remote-browse (&optional bang)
|
||||
"Open the website for the current (or specified) version controlled FILE. If BANG,
|
||||
then use hub to do it."
|
||||
(interactive "<!>")
|
||||
|
@ -11,7 +11,7 @@ then use hub to do it."
|
|||
(error
|
||||
(setq url (shell-command-to-string "hub browse -u --"))
|
||||
(setq url (if url
|
||||
(concat (s-trim url) "/" (f-relative (buffer-file-name) (narf/project-root))
|
||||
(concat (s-trim url) "/" (f-relative (buffer-file-name) (doom/project-root))
|
||||
(when (use-region-p) (format "#L%s-L%s"
|
||||
(line-number-at-pos (region-beginning))
|
||||
(line-number-at-pos (region-end)))))))))
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
;;; defuns-helm.el
|
||||
;; see ../core-helm.el
|
||||
|
||||
;;;###autoload (autoload 'narf:helm-recentf "defuns-helm" nil t)
|
||||
(evil-define-command narf:helm-recentf (&optional bang)
|
||||
;;;###autoload (autoload 'doom:helm-recentf "defuns-helm" nil t)
|
||||
(evil-define-command doom:helm-recentf (&optional bang)
|
||||
"Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
|
||||
`bang', then `search' is interpreted as regexp."
|
||||
:repeat nil
|
||||
|
@ -11,8 +10,8 @@
|
|||
|
||||
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
|
||||
;; regexp.
|
||||
;;;###autoload (autoload 'narf:helm-ag-search "defuns-helm" nil t)
|
||||
(evil-define-operator narf:helm-ag-search (beg end search regex-p &optional dir)
|
||||
;;;###autoload (autoload 'doom:helm-ag-search "defuns-helm" nil t)
|
||||
(evil-define-operator doom:helm-ag-search (beg end search regex-p &optional dir)
|
||||
"Preform an helm-ag search with SEARCH. If SEARCH is nil and in visual mode, use the
|
||||
selection, otherwise activate live ag searching in helm.
|
||||
|
||||
|
@ -22,7 +21,7 @@ DIR specifies the default-directory from which ag is run."
|
|||
:repeat nil
|
||||
(interactive "<r><a><!>")
|
||||
(require 'helm-ag)
|
||||
(let* ((helm-ag--default-directory (or dir (f-slash (narf/project-root))))
|
||||
(let* ((helm-ag--default-directory (or dir (f-slash (doom/project-root))))
|
||||
(helm-ag-command-option (unless regex-p "-Q "))
|
||||
(input "")
|
||||
(header-name (format "Search in %s" helm-ag--default-directory)))
|
||||
|
@ -40,56 +39,56 @@ DIR specifies the default-directory from which ag is run."
|
|||
|
||||
;; Ex-mode interface for `helm-do-ag'. If `bang', then `search' is interpreted
|
||||
;; as regexp
|
||||
;;;###autoload (autoload 'narf:helm-ag-search-cwd "defuns-helm" nil t)
|
||||
(evil-define-operator narf:helm-ag-search-cwd (beg end &optional search bang)
|
||||
;;;###autoload (autoload 'doom:helm-ag-search-cwd "defuns-helm" nil t)
|
||||
(evil-define-operator doom:helm-ag-search-cwd (beg end &optional search bang)
|
||||
:type inclusive :repeat nil
|
||||
(interactive "<r><a><!>")
|
||||
(narf:helm-ag-search beg end search bang default-directory))
|
||||
(doom:helm-ag-search beg end search bang default-directory))
|
||||
|
||||
;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or
|
||||
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is
|
||||
;; `scss-mode'
|
||||
;;;###autoload (autoload 'narf:helm-swoop "defuns-helm" nil t)
|
||||
(evil-define-command narf:helm-swoop (&optional search bang)
|
||||
;;;###autoload (autoload 'doom:helm-swoop "defuns-helm" nil t)
|
||||
(evil-define-command doom:helm-swoop (&optional search bang)
|
||||
:repeat nil
|
||||
(interactive "<a><!>")
|
||||
(if bang (helm-multi-swoop-all search) (helm-swoop :$query search)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/helm-find-in-emacsd ()
|
||||
(defun doom/helm-find-in-emacsd ()
|
||||
(interactive)
|
||||
(in! narf-emacs-dir (helm-projectile-find-file)))
|
||||
(in! doom-emacs-dir (helm-projectile-find-file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/helm-find-in-dotfiles ()
|
||||
(defun doom/helm-find-in-dotfiles ()
|
||||
(interactive)
|
||||
(in! (expand-file-name ".dotfiles" "~") (helm-projectile-find-file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/helm-buffers-dwim (&optional all-p)
|
||||
(defun doom/helm-buffers-dwim (&optional all-p)
|
||||
"Displays open buffers in current project. If ALL-P, then show all open
|
||||
buffers."
|
||||
(interactive)
|
||||
(let ((narf-helm-force-project-buffers (and (not all-p) (narf/project-p))))
|
||||
(let ((doom-helm-force-project-buffers (and (not all-p) (doom/project-p))))
|
||||
(helm-buffers-list)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*helm-replace-prompt (plist)
|
||||
(defun doom*helm-replace-prompt (plist)
|
||||
(if (keywordp (car plist))
|
||||
(setq plist (plist-put plist :prompt helm-global-prompt))
|
||||
(setcar (nthcdr 2 plist) helm-global-prompt))
|
||||
plist)
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*helm-hide-header (source &optional force)
|
||||
(defun doom*helm-hide-header (source &optional force)
|
||||
(setq header-line-format nil)
|
||||
(narf|hide-mode-line))
|
||||
(doom|hide-mode-line))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*helm-hide-source-header-maybe ()
|
||||
(defun doom*helm-hide-source-header-maybe ()
|
||||
(if (<= (length helm-sources) 1)
|
||||
(set-face-attribute 'helm-source-header nil :height 0.1 :foreground "#111111")
|
||||
(set-face-attribute 'helm-source-header nil :height 1.0 :foreground narf-helm-header-fg)))
|
||||
(set-face-attribute 'helm-source-header nil :height 1.0 :foreground doom-helm-header-fg)))
|
||||
|
||||
(provide 'defuns-helm)
|
||||
;;; defuns-helm.el ends here
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-highlight-indentation.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/add-whitespace (&optional start end)
|
||||
(defun doom/add-whitespace (&optional start end)
|
||||
"Maintain indentation whitespace in buffer. Used so that highlight-indentation will
|
||||
display consistent guides. Whitespace is stripped out on save, so this doesn't affect the
|
||||
end file."
|
||||
|
@ -38,7 +38,7 @@ end file."
|
|||
nil)
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*hl-indent-guess-offset ()
|
||||
(defun doom*hl-indent-guess-offset ()
|
||||
(string-to-int (gethash 'indent_size (editorconfig-get-properties))))
|
||||
|
||||
(provide 'defuns-highlight-indentation)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-ido.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*ido-sort-mtime ()
|
||||
(defun doom*ido-sort-mtime ()
|
||||
"Sort ido filelist by mtime instead of alphabetically."
|
||||
(setq ido-temp-list
|
||||
(sort ido-temp-list
|
||||
|
@ -16,7 +16,7 @@
|
|||
ido-temp-list))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|ido-setup-home-keybind ()
|
||||
(defun doom|ido-setup-home-keybind ()
|
||||
"Go to $HOME with ~"
|
||||
(define-key ido-file-completion-map (kbd "~")
|
||||
(λ! (if (looking-back "/")
|
||||
|
@ -24,37 +24,37 @@
|
|||
(call-interactively 'self-insert-command)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ido-find-file (&optional dir)
|
||||
(defun doom/ido-find-file (&optional dir)
|
||||
(interactive)
|
||||
(let ((default-directory (or dir default-directory)))
|
||||
(ido-find-file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ido-find-file-other-window (&optional dir)
|
||||
(defun doom/ido-find-file-other-window (&optional dir)
|
||||
(interactive)
|
||||
(let ((default-directory (or dir default-directory)))
|
||||
(ido-find-file-other-window)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ido-find-project-file ()
|
||||
(defun doom/ido-find-project-file ()
|
||||
(interactive)
|
||||
(let ((default-directory (narf/project-root)))
|
||||
(let ((default-directory (doom/project-root)))
|
||||
(ido-find-file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ido-recentf ()
|
||||
(defun doom/ido-recentf ()
|
||||
"Use `ido-completing-read' to \\[find-file] a recent file"
|
||||
(interactive)
|
||||
(if (find-file (ido-completing-read "Find recent file: " recentf-list))
|
||||
(message "Opening file...")
|
||||
(message "Aborting")))
|
||||
|
||||
;;;###autoload (autoload 'narf:ido-find-file-in-emacsd "defuns-ido" nil t)
|
||||
(evil-define-command narf:ido-find-file-in-emacsd (&optional bang) :repeat nil
|
||||
;;;###autoload (autoload 'doom:ido-find-file-in-emacsd "defuns-ido" nil t)
|
||||
(evil-define-command doom:ido-find-file-in-emacsd (&optional bang) :repeat nil
|
||||
(interactive "<!>")
|
||||
(if bang
|
||||
(ido-find-file-in-dir narf-modules-dir)
|
||||
(ido-find-file-in-dir narf-emacs-dir)))
|
||||
(ido-find-file-in-dir doom-modules-dir)
|
||||
(ido-find-file-in-dir doom-emacs-dir)))
|
||||
|
||||
(provide 'defuns-ido)
|
||||
;;; defuns-ido.el ends here
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;; for ../core-project.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/neotree ()
|
||||
(defun doom/neotree ()
|
||||
"Toggle the neotree window"
|
||||
(interactive)
|
||||
(let ((in-neotree (and (neo-global--window-exists-p)
|
||||
|
@ -11,14 +11,14 @@
|
|||
(path buffer-file-name))
|
||||
(if in-neotree
|
||||
(neotree-hide)
|
||||
(let ((project-root (narf/project-root)))
|
||||
(let ((project-root (doom/project-root)))
|
||||
(unless (and (neo-global--window-exists-p)
|
||||
(f-same? (neo-global--with-window neo-buffer--start-node) project-root))
|
||||
(neotree-dir project-root))
|
||||
(neotree-find path project-root)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro narf/neotree-save (&rest body)
|
||||
(defmacro doom/neotree-save (&rest body)
|
||||
`(let ((neo-p (neo-global--window-exists-p)))
|
||||
(when neo-p (neotree-hide))
|
||||
,@body
|
||||
|
@ -27,30 +27,30 @@
|
|||
(neotree-show)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|neotree-close-on-window-change (&rest _)
|
||||
(defun doom|neotree-close-on-window-change (&rest _)
|
||||
"Close neotree to prevent ensuing mindow buggery."
|
||||
(unless (and (neo-global--window-exists-p)
|
||||
(eq (current-buffer) (neo-global--get-buffer)))
|
||||
(neotree-hide)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*save-neotree (orig-fun &rest args)
|
||||
(defun doom*save-neotree (orig-fun &rest args)
|
||||
"Prevents messing up the neotree buffer on window changes"
|
||||
(narf/neotree-save (apply orig-fun args)))
|
||||
(doom/neotree-save (apply orig-fun args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*neotree-create-node (orig-fun &rest args)
|
||||
(defun doom*neotree-create-node (orig-fun &rest args)
|
||||
"Don't ask for confirmation when creating files"
|
||||
(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t)))
|
||||
(apply orig-fun args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*neotree-shorten-pwd (node)
|
||||
(defun doom*neotree-shorten-pwd (node)
|
||||
"Shorter pwd in neotree"
|
||||
(list (concat " " (projectile-project-name))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*neo-theme (name)
|
||||
(defun doom*neo-theme (name)
|
||||
"Custom hybrid ascii theme with leading whitespace."
|
||||
(let ((n-insert-symbol (lambda (n)
|
||||
(neo-buffer--insert-with-face
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
;;; defuns-nlinum.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/nlinum-toggle ()
|
||||
(defun doom/nlinum-toggle ()
|
||||
(interactive)
|
||||
(if (bound-and-true-p nlinum-mode)
|
||||
(narf|nlinum-disable)
|
||||
(narf|nlinum-enable)))
|
||||
(doom|nlinum-disable)
|
||||
(doom|nlinum-enable)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|nlinum-enable ()
|
||||
(defun doom|nlinum-enable ()
|
||||
(nlinum-mode +1)
|
||||
(add-hook 'post-command-hook 'narf|nlinum-hl-line nil t)
|
||||
(narf|nlinum-unhl-line))
|
||||
(add-hook 'post-command-hook 'doom|nlinum-hl-line nil t)
|
||||
(doom|nlinum-unhl-line))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|nlinum-disable ()
|
||||
(defun doom|nlinum-disable ()
|
||||
(nlinum-mode -1)
|
||||
(remove-hook 'post-command-hook 'narf|nlinum-hl-line t)
|
||||
(narf|nlinum-unhl-line))
|
||||
(remove-hook 'post-command-hook 'doom|nlinum-hl-line t)
|
||||
(doom|nlinum-unhl-line))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|nlinum-unhl-line ()
|
||||
(defun doom|nlinum-unhl-line ()
|
||||
"Unhighlight line number"
|
||||
(when narf--hl-nlinum-overlay
|
||||
(when doom--hl-nlinum-overlay
|
||||
(let* ((disp (get-text-property
|
||||
0 'display (overlay-get narf--hl-nlinum-overlay 'before-string)))
|
||||
0 'display (overlay-get doom--hl-nlinum-overlay 'before-string)))
|
||||
(str (nth 1 disp)))
|
||||
(put-text-property 0 (length str) 'face 'linum str)
|
||||
(setq narf--hl-nlinum-overlay nil
|
||||
narf--hl-nlinum-line nil)
|
||||
(setq doom--hl-nlinum-overlay nil
|
||||
doom--hl-nlinum-line nil)
|
||||
disp)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|nlinum-hl-line (&optional line)
|
||||
(defun doom|nlinum-hl-line (&optional line)
|
||||
"Highlight line number"
|
||||
(let ((line-no (or line (string-to-number (format-mode-line "%l")))))
|
||||
(if (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
||||
(if (and nlinum-mode (not (eq line-no doom--hl-nlinum-line)))
|
||||
(let* ((pbol (if line
|
||||
(save-excursion (goto-char 1)
|
||||
(forward-line line-no)
|
||||
|
@ -49,11 +49,11 @@
|
|||
(jit-lock-fontify-now pbol peol)
|
||||
(let ((ov (--first (overlay-get it 'nlinum) (overlays-in pbol peol))))
|
||||
(when ov
|
||||
(narf|nlinum-unhl-line)
|
||||
(doom|nlinum-unhl-line)
|
||||
(let ((str (nth 1 (get-text-property 0 'display (overlay-get ov 'before-string)))))
|
||||
(put-text-property 0 (length str) 'face 'linum-highlight-face str)
|
||||
(setq narf--hl-nlinum-overlay ov
|
||||
narf--hl-nlinum-line line-no))))))))
|
||||
(setq doom--hl-nlinum-overlay ov
|
||||
doom--hl-nlinum-line line-no))))))))
|
||||
|
||||
(provide 'defuns-nlinum)
|
||||
;;; defuns-nlinum.el ends here
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
;;; defuns-popups.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-remove (window)
|
||||
(setq narf-popup-windows (delete window narf-popup-windows)))
|
||||
(defun doom/popup-remove (window)
|
||||
(setq doom-popup-windows (delete window doom-popup-windows)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-p (&optional window)
|
||||
(defun doom/popup-p (&optional window)
|
||||
"Whether WINDOW is a shackle popup window or not."
|
||||
(and narf-popup-windows
|
||||
(and doom-popup-windows
|
||||
(-any? (lambda (w)
|
||||
(if (window-live-p w) t (narf/popup-remove w) nil))
|
||||
narf-popup-windows)
|
||||
(if (window-live-p w) t (doom/popup-remove w) nil))
|
||||
doom-popup-windows)
|
||||
(if window
|
||||
(-any? (lambda (w) (eq window w)) narf-popup-windows)
|
||||
(-any? (lambda (w) (eq window w)) doom-popup-windows)
|
||||
t)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro narf/popup-save (&rest body)
|
||||
`(let ((popup-p (narf/popup-p)))
|
||||
(when popup-p (narf/popup-close-all t))
|
||||
(defmacro doom/popup-save (&rest body)
|
||||
`(let ((popup-p (doom/popup-p)))
|
||||
(when popup-p (doom/popup-close-all t))
|
||||
,@body
|
||||
(when popup-p
|
||||
(save-selected-window
|
||||
(narf/popup-last-buffer)))))
|
||||
(doom/popup-last-buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-buffer (buffer &optional plist)
|
||||
(defun doom/popup-buffer (buffer &optional plist)
|
||||
"Display BUFFER in a shackle popup."
|
||||
(let ((buffer-name (if (stringp buffer) buffer (buffer-name buffer))))
|
||||
(shackle-display-buffer (get-buffer-create buffer-name)
|
||||
nil (or plist (shackle-match buffer-name)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-close (&optional window dont-kill dont-close-all)
|
||||
(defun doom/popup-close (&optional window dont-kill dont-close-all)
|
||||
"Find and close the currently active popup (if available)."
|
||||
(interactive)
|
||||
(when (not window)
|
||||
(if (narf/popup-p (selected-window))
|
||||
(if (doom/popup-p (selected-window))
|
||||
(setq window (selected-window))
|
||||
(unless dont-close-all
|
||||
(narf/popup-close-all dont-kill))))
|
||||
(doom/popup-close-all dont-kill))))
|
||||
(when (and window (window-live-p window))
|
||||
;; REPL buffer
|
||||
(cond ((and (derived-mode-p 'comint-mode)
|
||||
|
@ -49,59 +49,59 @@
|
|||
((eq major-mode 'messages-buffer-mode)
|
||||
(bury-buffer)
|
||||
(setq dont-kill t)))
|
||||
(narf/popup-remove window)
|
||||
(doom/popup-remove window)
|
||||
(unless dont-kill
|
||||
(let ((kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions)))
|
||||
(kill-buffer (window-buffer window))))
|
||||
(delete-window window)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-close-all (&optional dont-kill-buffers)
|
||||
(defun doom/popup-close-all (&optional dont-kill-buffers)
|
||||
"Closes all popup windows (and kills the buffers if DONT-KILL-BUFFERS is non-nil)"
|
||||
(interactive)
|
||||
(mapc (lambda (w) (narf/popup-close w dont-kill-buffers))
|
||||
narf-popup-windows)
|
||||
(setq narf-popup-windows nil))
|
||||
(mapc (lambda (w) (doom/popup-close w dont-kill-buffers))
|
||||
doom-popup-windows)
|
||||
(setq doom-popup-windows nil))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-toggle ()
|
||||
(defun doom/popup-toggle ()
|
||||
"Toggles the popup window, reopening the last popup (if available)."
|
||||
(interactive)
|
||||
(if (narf/popup-p)
|
||||
(narf/popup-close t)
|
||||
(narf/popup-last-buffer)))
|
||||
(if (doom/popup-p)
|
||||
(doom/popup-close t)
|
||||
(doom/popup-last-buffer)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-last-buffer ()
|
||||
(defun doom/popup-last-buffer ()
|
||||
"Pop up the last popup buffer."
|
||||
(interactive)
|
||||
(unless shackle-last-buffer
|
||||
(error "No popup to restore"))
|
||||
(narf/popup-buffer shackle-last-buffer))
|
||||
(doom/popup-buffer shackle-last-buffer))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/popup-messages ()
|
||||
(defun doom/popup-messages ()
|
||||
"Pop up the *Messages* buffer."
|
||||
(interactive)
|
||||
(narf/popup-buffer "*Messages*")
|
||||
(doom/popup-buffer "*Messages*")
|
||||
(with-current-buffer "*Messages*"
|
||||
(narf|hide-mode-line)
|
||||
(doom|hide-mode-line)
|
||||
(goto-char (point-max))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|popup-init ()
|
||||
(add-to-list 'narf-popup-windows (get-buffer-window))
|
||||
(local-set-key [escape escape] 'narf/popup-close)
|
||||
(defun doom|popup-init ()
|
||||
(add-to-list 'doom-popup-windows (get-buffer-window))
|
||||
(local-set-key [escape escape] 'doom/popup-close)
|
||||
(when (or (bound-and-true-p repl-toggle-mode)
|
||||
(derived-mode-p 'tabulated-list-mode)
|
||||
(memq major-mode '(messages-buffer-mode flycheck-error-list-mode-hook esup-mode)))
|
||||
(let ((map evil-normal-state-local-map))
|
||||
(define-key map [escape] 'narf/popup-close)
|
||||
(define-key map (kbd "ESC") 'narf/popup-close))))
|
||||
(define-key map [escape] 'doom/popup-close)
|
||||
(define-key map (kbd "ESC") 'doom/popup-close))))
|
||||
|
||||
(defvar shackle-popup-hook '() "Hook run whenever a popup is opened.")
|
||||
;;;###autoload
|
||||
(defun narf|run-popup-hooks (&rest _)
|
||||
(defun doom|run-popup-hooks (&rest _)
|
||||
(with-current-buffer shackle-last-buffer
|
||||
(run-hooks 'shackle-popup-hook)))
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
;;; defuns-project.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/project-root (&optional strict-p)
|
||||
"Get the path to the root of your project. Uses `narf-project-root-files' to
|
||||
(defun doom/project-root (&optional strict-p)
|
||||
"Get the path to the root of your project. Uses `doom-project-root-files' to
|
||||
determine if a directory is a project."
|
||||
(let (projectile-require-project-root strict-p)
|
||||
(projectile-project-root)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/project-has-files (files &optional root)
|
||||
(defun doom/project-has-files (files &optional root)
|
||||
"Return non-nil if FILES exist in the project root."
|
||||
(let ((root (or root (narf/project-root)))
|
||||
(let ((root (or root (doom/project-root)))
|
||||
(files (if (listp files) files (list files)))
|
||||
(found-p (if files t)))
|
||||
(while (and found-p files)
|
||||
|
@ -21,7 +21,10 @@ determine if a directory is a project."
|
|||
found-p))
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'narf/project-p 'projectile-project-p)
|
||||
(defalias 'doom/project-p 'projectile-project-p)
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'doom/project-name 'projectile-project-name)
|
||||
|
||||
(provide 'defuns-project)
|
||||
;;; defuns-project.el ends here
|
||||
|
|
|
@ -2,25 +2,25 @@
|
|||
|
||||
;;;; Code building ;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;###autoload
|
||||
(defvar narf--build-command '("make %s" . "Makefile"))
|
||||
(make-variable-buffer-local 'narf--build-command)
|
||||
(defvar doom--build-command '("make %s" . "Makefile"))
|
||||
(make-variable-buffer-local 'doom--build-command)
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/set-build-command (command &optional file)
|
||||
(defun doom/set-build-command (command &optional file)
|
||||
(when (or (null file)
|
||||
(narf/project-has-files file))
|
||||
(setq narf--build-command `(,command . ,file))))
|
||||
(doom/project-has-files file))
|
||||
(setq doom--build-command `(,command . ,file))))
|
||||
|
||||
;;;###autoload (autoload 'narf:build "defuns-quickrun" nil t)
|
||||
(evil-define-command narf:build (arg)
|
||||
;;;###autoload (autoload 'doom:build "defuns-quickrun" nil t)
|
||||
(evil-define-command doom:build (arg)
|
||||
"Call a build command in the current directory. If ARG is nil this function calls
|
||||
`recompile', otherwise it calls `compile' passing ARG as build command."
|
||||
(interactive "<sh>")
|
||||
(when (null narf--build-command)
|
||||
(when (null doom--build-command)
|
||||
(user-error "No build command was set"))
|
||||
(let ((build-file (cdr narf--build-command))
|
||||
(build-cmd (car narf--build-command))
|
||||
(project-dir (narf/project-root)))
|
||||
(let ((build-file (cdr doom--build-command))
|
||||
(build-cmd (car doom--build-command))
|
||||
(project-dir (doom/project-root)))
|
||||
(if (or (null build-file) (f-exists? (f-expand build-file project-dir)))
|
||||
(if (or (symbolp build-cmd) (functionp build-cmd))
|
||||
(if (commandp build-cmd)
|
||||
|
@ -31,17 +31,17 @@
|
|||
(error "Could not build!"))))
|
||||
|
||||
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;###autoload (autoload 'narf:eval-buffer "defuns-quickrun" nil t)
|
||||
(evil-define-command narf:eval-buffer ()
|
||||
;;;###autoload (autoload 'doom:eval-buffer "defuns-quickrun" nil t)
|
||||
(evil-define-command doom:eval-buffer ()
|
||||
"Evaluate the whole buffer."
|
||||
:move-point nil :repeat nil
|
||||
(interactive)
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
(narf:eval-region (point-min) (point-max)))
|
||||
(doom:eval-region (point-min) (point-max)))
|
||||
(t (quickrun))))
|
||||
|
||||
;;;###autoload (autoload 'narf:eval-region "defuns-quickrun" nil t)
|
||||
(evil-define-operator narf:eval-region (beg end)
|
||||
;;;###autoload (autoload 'doom:eval-region "defuns-quickrun" nil t)
|
||||
(evil-define-operator doom:eval-region (beg end)
|
||||
"Evaluate a region and, if large enough, prints its output to a popup buffer (if an
|
||||
elisp buffer). Otherwise forward the region to Quickrun."
|
||||
:move-point nil :repeat nil
|
||||
|
@ -62,11 +62,11 @@ elisp buffer). Otherwise forward the region to Quickrun."
|
|||
(insert out)
|
||||
(read-only-mode 1)
|
||||
(goto-char (point-min))
|
||||
(narf/popup-buffer (current-buffer))))))
|
||||
(doom/popup-buffer (current-buffer))))))
|
||||
(t (quickrun-region beg end))))
|
||||
|
||||
;;;###autoload (autoload 'narf:eval-region-and-replace "defuns-quickrun" nil t)
|
||||
(evil-define-operator narf:eval-region-and-replace (beg end)
|
||||
;;;###autoload (autoload 'doom:eval-region-and-replace "defuns-quickrun" nil t)
|
||||
(evil-define-operator doom:eval-region-and-replace (beg end)
|
||||
(interactive "<r>")
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
(kill-region beg end)
|
||||
|
|
|
@ -1,36 +1,35 @@
|
|||
;;; defuns-repl.el
|
||||
|
||||
;;;###autoload (autoload 'narf:repl "defuns-repl" nil t)
|
||||
(evil-define-command narf:repl (&optional bang command)
|
||||
;;;###autoload (autoload 'doom:repl "defuns-repl" nil t)
|
||||
(evil-define-command doom:repl (&optional bang command)
|
||||
:repeat nil
|
||||
(interactive "<!><a>")
|
||||
(if (and narf--repl-buffer (buffer-live-p narf--repl-buffer))
|
||||
(narf/popup-buffer narf--repl-buffer)
|
||||
(if (and doom--repl-buffer (buffer-live-p doom--repl-buffer))
|
||||
(doom/popup-buffer doom--repl-buffer)
|
||||
(rtog/toggle-repl (if (use-region-p) 4))
|
||||
(setq narf--repl-buffer (current-buffer))
|
||||
(setq doom--repl-buffer (current-buffer))
|
||||
(when command
|
||||
(with-current-buffer narf--repl-buffer
|
||||
(with-current-buffer doom--repl-buffer
|
||||
(insert command)
|
||||
(unless bang (comint-send-input))))))
|
||||
|
||||
;;;###autoload (autoload 'narf:repl-eval "defuns-repl" nil t)
|
||||
(evil-define-operator narf:repl-eval (&optional beg end bang)
|
||||
;;;###autoload (autoload 'doom:repl-eval "defuns-repl" nil t)
|
||||
(evil-define-operator doom:repl-eval (&optional beg end bang)
|
||||
:type inclusive
|
||||
:repeat nil
|
||||
(interactive "<r><!>")
|
||||
(let ((region-p (use-region-p))
|
||||
(selection (s-trim (buffer-substring-no-properties beg end))))
|
||||
(narf:repl bang)
|
||||
(doom:repl bang)
|
||||
(when (and region-p beg end)
|
||||
(let* ((buf narf--repl-buffer)
|
||||
(let* ((buf doom--repl-buffer)
|
||||
(win (get-buffer-window buf)))
|
||||
(unless (eq buf (narf/popup-p (get-buffer-window buf)))
|
||||
(narf/popup-buffer buf))
|
||||
(when (and narf--repl-buffer (buffer-live-p narf--repl-buffer))
|
||||
(with-current-buffer narf--repl-buffer
|
||||
(unless (eq buf (doom/popup-p (get-buffer-window buf)))
|
||||
(doom/popup-buffer buf))
|
||||
(when (and doom--repl-buffer (buffer-live-p doom--repl-buffer))
|
||||
(with-current-buffer doom--repl-buffer
|
||||
(goto-char (point-max))
|
||||
(insert selection)))))))
|
||||
|
||||
|
||||
(provide 'defuns-repl)
|
||||
;;; defuns-repl.el ends here
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-smartparens.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sp-insert-yasnippet (id action context)
|
||||
(defun doom/sp-insert-yasnippet (id action context)
|
||||
(forward-char -1)
|
||||
(if (sp-point-after-bol-p id action context)
|
||||
(yas-expand-from-trigger-key)
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
;;; defuns-spaceline.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|spaceline-env-update ()
|
||||
(when narf--env-command
|
||||
(let ((default-directory (narf/project-root)))
|
||||
(let ((s (shell-command-to-string narf--env-command)))
|
||||
(setq narf--env-version (if (string-match "[ \t\n\r]+\\'" s)
|
||||
(defun doom|spaceline-env-update ()
|
||||
(when doom--env-command
|
||||
(let ((default-directory (doom/project-root)))
|
||||
(let ((s (shell-command-to-string doom--env-command)))
|
||||
(setq doom--env-version (if (string-match "[ \t\n\r]+\\'" s)
|
||||
(replace-match "" t t s)
|
||||
s))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/-flycheck-count (state)
|
||||
(defun doom/-flycheck-count (state)
|
||||
"Return flycheck information for the given error type STATE."
|
||||
(when (flycheck-has-current-errors-p state)
|
||||
(if (eq 'running flycheck-last-status-change)
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
;;; defuns-ui.el
|
||||
;; for ../core-ui.el
|
||||
|
||||
;;;###autoload (autoload 'narf:toggle-fullscreen "defuns-ui" nil t)
|
||||
;;;###autoload (autoload 'narf:set-columns "defuns-ui" nil t)
|
||||
;;;###autoload (autoload 'doom:toggle-fullscreen "defuns-ui" nil t)
|
||||
;;;###autoload (autoload 'doom:set-columns "defuns-ui" nil t)
|
||||
(after! evil
|
||||
(evil-define-command narf:set-columns (&optional bang columns)
|
||||
(evil-define-command doom:set-columns (&optional bang columns)
|
||||
"Adjusts visual-fill-column-width on the fly."
|
||||
(interactive "<!><a>")
|
||||
(if (or (= (length columns) 0) bang)
|
||||
|
@ -19,33 +18,33 @@
|
|||
(visual-fill-column--adjust-window)
|
||||
(visual-fill-column-mode 1)))
|
||||
|
||||
(evil-define-command narf:toggle-fullscreen ()
|
||||
(evil-define-command doom:toggle-fullscreen ()
|
||||
(interactive)
|
||||
(set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/reset-theme ()
|
||||
(defun doom/reset-theme ()
|
||||
(interactive)
|
||||
(narf/load-theme (or narf-current-theme narf-default-theme)))
|
||||
(doom/load-theme (or doom-current-theme doom-default-theme)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/load-font (font)
|
||||
(defun doom/load-font (font)
|
||||
(interactive)
|
||||
(set-frame-font font t)
|
||||
(setq narf-current-font font))
|
||||
(setq doom-current-font font))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/load-theme (theme &optional suppress-font)
|
||||
(defun doom/load-theme (theme &optional suppress-font)
|
||||
(interactive)
|
||||
(when narf-current-theme
|
||||
(disable-theme narf-current-theme))
|
||||
(when doom-current-theme
|
||||
(disable-theme doom-current-theme))
|
||||
(load-theme theme t)
|
||||
(unless suppress-font
|
||||
(narf/load-font narf-current-font))
|
||||
(setq narf-current-theme theme))
|
||||
(doom/load-font doom-current-font))
|
||||
(setq doom-current-theme theme))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/show-as (how &optional pred)
|
||||
(defun doom/show-as (how &optional pred)
|
||||
(let* ((beg (match-beginning 1))
|
||||
(end (match-end 1))
|
||||
(ok (or (not pred) (funcall pred beg end))))
|
||||
|
@ -54,16 +53,17 @@
|
|||
nil))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/imenu-list-quit ()
|
||||
(defun doom/imenu-list-quit ()
|
||||
(interactive)
|
||||
(quit-window)
|
||||
(mapc (lambda (b) (with-current-buffer b
|
||||
(when imenu-list-minor-mode
|
||||
(imenu-list-minor-mode -1))))
|
||||
(narf/get-visible-buffers (narf/get-real-buffers))))
|
||||
(doom/get-visible-buffers (doom/get-real-buffers))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|hide-mode-line (&rest _)
|
||||
(defun doom|hide-mode-line (&rest _)
|
||||
(set-window-fringes (selected-window) 0 0 nil)
|
||||
(setq mode-line-format nil))
|
||||
|
||||
(provide 'defuns-ui)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
;;; defuns-whitespace.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf--point-at-bol-non-blank()
|
||||
(defun doom--point-at-bol-non-blank()
|
||||
(save-excursion (evil-first-non-blank) (point)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/surrounded-p ()
|
||||
(defun doom/surrounded-p ()
|
||||
(and (looking-back "[[{(]\\(\s+\\|\n\\)?\\(\s\\|\t\\)*")
|
||||
(let* ((whitespace (match-string 1))
|
||||
(match-str (concat whitespace (match-string 2) "[])}]")))
|
||||
(looking-at-p match-str))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/backward-kill-to-bol-and-indent ()
|
||||
(defun doom/backward-kill-to-bol-and-indent ()
|
||||
"Kill line to the first non-blank character. If invoked again
|
||||
afterwards, kill line to column 1."
|
||||
(interactive)
|
||||
|
@ -22,12 +22,12 @@ afterwards, kill line to column 1."
|
|||
(indent-according-to-mode))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/move-to-bol ()
|
||||
(defun doom/move-to-bol ()
|
||||
"Moves cursor to the first non-blank character on the line. If
|
||||
already there, move it to the true bol."
|
||||
(interactive)
|
||||
(evil-save-goal-column
|
||||
(let ((point-at-bol (narf--point-at-bol-non-blank))
|
||||
(let ((point-at-bol (doom--point-at-bol-non-blank))
|
||||
(point (point)))
|
||||
(if (= point-at-bol point)
|
||||
(evil-move-beginning-of-line)
|
||||
|
@ -35,20 +35,20 @@ already there, move it to the true bol."
|
|||
(evil-first-non-blank))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/move-to-eol ()
|
||||
(defun doom/move-to-eol ()
|
||||
(interactive)
|
||||
(evil-save-goal-column
|
||||
(let ((old-point (point)))
|
||||
(when (comment-search-forward (point-at-eol) t)
|
||||
(goto-char (match-beginning 0))
|
||||
(skip-syntax-backward " ^<*" (narf--point-at-bol-non-blank))
|
||||
(skip-syntax-backward " ^<*" (doom--point-at-bol-non-blank))
|
||||
|
||||
(if (eq old-point (point)) ;
|
||||
(evil-move-end-of-line))))))
|
||||
|
||||
;; Mimic expandtab in vim
|
||||
;;;###autoload
|
||||
(defun narf/backward-delete-whitespace-to-column ()
|
||||
(defun doom/backward-delete-whitespace-to-column ()
|
||||
"Delete back to the previous column of whitespace, or as much
|
||||
whitespace as possible, or just one char if that's not possible."
|
||||
(interactive)
|
||||
|
@ -75,7 +75,7 @@ whitespace as possible, or just one char if that's not possible."
|
|||
(t (backward-delete-char-untabify 1))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/dumb-indent (&optional smart)
|
||||
(defun doom/dumb-indent (&optional smart)
|
||||
"Inserts a tab character (or spaces x tab-width). Checks if the
|
||||
auto-complete window is open."
|
||||
(interactive)
|
||||
|
@ -86,14 +86,14 @@ auto-complete window is open."
|
|||
(insert (s-repeat spaces " ")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/smart-indent ()
|
||||
(defun doom/smart-indent ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(back-to-indentation)
|
||||
(narf/dumb-indent)))
|
||||
(doom/dumb-indent)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/dumb-dedent ()
|
||||
(defun doom/dumb-dedent ()
|
||||
(interactive)
|
||||
(if indent-tabs-mode
|
||||
(delete-char -1)
|
||||
|
@ -105,23 +105,23 @@ auto-complete window is open."
|
|||
(delete-char (- spaces))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/inflate-space-maybe ()
|
||||
(defun doom/inflate-space-maybe ()
|
||||
"Checks if point is surrounded by {} [] () delimiters and adds a
|
||||
space on either side of the point if so."
|
||||
(interactive)
|
||||
(if (narf/surrounded-p)
|
||||
(if (doom/surrounded-p)
|
||||
(progn (call-interactively 'self-insert-command)
|
||||
(save-excursion (call-interactively 'self-insert-command)))
|
||||
(call-interactively 'self-insert-command)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/deflate-space-maybe ()
|
||||
(defun doom/deflate-space-maybe ()
|
||||
"Checks if point is surrounded by {} [] () delimiters, and deletes
|
||||
spaces on either side of the point if so. Resorts to
|
||||
`narf/backward-delete-whitespace-to-column' otherwise."
|
||||
`doom/backward-delete-whitespace-to-column' otherwise."
|
||||
(interactive)
|
||||
(save-match-data
|
||||
(if (narf/surrounded-p)
|
||||
(if (doom/surrounded-p)
|
||||
(let ((whitespace-match (match-string 1)))
|
||||
(cond ((not whitespace-match)
|
||||
(call-interactively 'sp-backward-delete-char))
|
||||
|
@ -131,10 +131,10 @@ spaces on either side of the point if so. Resorts to
|
|||
(save-excursion (delete-char 1)))
|
||||
(t
|
||||
(just-one-space 0))))
|
||||
(narf/backward-delete-whitespace-to-column))))
|
||||
(doom/backward-delete-whitespace-to-column))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/newline-and-indent ()
|
||||
(defun doom/newline-and-indent ()
|
||||
(interactive)
|
||||
(cond ((sp-point-in-string)
|
||||
(newline))
|
||||
|
@ -158,8 +158,8 @@ spaces on either side of the point if so. Resorts to
|
|||
(newline nil t)
|
||||
(indent-according-to-mode))))
|
||||
|
||||
;;;###autoload (autoload 'narf:whitespace-retab "defuns-whitespace" nil t)
|
||||
(evil-define-operator narf:whitespace-retab (beg end)
|
||||
;;;###autoload (autoload 'doom:whitespace-retab "defuns-whitespace" nil t)
|
||||
(evil-define-operator doom:whitespace-retab (beg end)
|
||||
"Akin to vim's retab, this changes all tabs-to-spaces or spaces-to-tabs,
|
||||
depending on `indent-tab-mode'. Untested."
|
||||
:motion nil
|
||||
|
@ -173,8 +173,8 @@ spaces on either side of the point if so. Resorts to
|
|||
(tabify beg end)
|
||||
(untabify beg end)))
|
||||
|
||||
;;;###autoload (autoload 'narf:whitespace-align "defuns-whitespace" nil t)
|
||||
(evil-define-command narf:whitespace-align (beg end &optional regexp bang)
|
||||
;;;###autoload (autoload 'doom:whitespace-align "defuns-whitespace" nil t)
|
||||
(evil-define-command doom:whitespace-align (beg end &optional regexp bang)
|
||||
:repeat nil
|
||||
(interactive "<r><a><!>")
|
||||
(when regexp
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
;;; defuns-window.el --- library for acting on windows
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-window-split ()
|
||||
(defun doom/evil-window-split ()
|
||||
(interactive)
|
||||
(call-interactively 'evil-window-split)
|
||||
(evil-window-down 1))
|
||||
(doom/neotree-save
|
||||
(call-interactively 'evil-window-split)
|
||||
(evil-window-down 1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-window-vsplit ()
|
||||
(defun doom/evil-window-vsplit ()
|
||||
(interactive)
|
||||
(call-interactively 'evil-window-vsplit)
|
||||
(evil-window-right 1))
|
||||
(doom/neotree-save
|
||||
(call-interactively 'evil-window-vsplit)
|
||||
(evil-window-right 1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-window-move (direction)
|
||||
(defun doom/evil-window-move (direction)
|
||||
"Move current window to the next window in DIRECTION. If there are no windows
|
||||
there and there is only one window, split in that direction and place this
|
||||
window there. If there are no windows and this isn't the only window, use
|
||||
|
@ -23,7 +25,7 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
|||
(that-window (windmove-find-other-window direction nil this-window))
|
||||
(that-buffer (window-buffer that-window)))
|
||||
(when (or (minibufferp that-buffer)
|
||||
(narf/popup-p that-window))
|
||||
(doom/popup-p that-window))
|
||||
(setq that-buffer nil that-window nil))
|
||||
(if (not (or that-window (one-window-p t)))
|
||||
(funcall (case direction
|
||||
|
@ -37,7 +39,7 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
|||
((eq direction 'down) 'below)
|
||||
(t direction))))
|
||||
(with-selected-window that-window
|
||||
(switch-to-buffer "*scratch*"))
|
||||
(switch-to-buffer doom-buffer))
|
||||
(setq that-buffer (window-buffer that-window)))
|
||||
(with-selected-window this-window
|
||||
(switch-to-buffer that-buffer))
|
||||
|
@ -46,61 +48,61 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
|||
(select-window that-window))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/new-buffer ()
|
||||
(defun doom/new-buffer ()
|
||||
(interactive)
|
||||
(switch-to-buffer (generate-new-buffer "*new*")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/new-frame ()
|
||||
(defun doom/new-frame ()
|
||||
(interactive)
|
||||
(let ((nlinum-p (and (featurep 'nlinum)
|
||||
(memq 'nlinum--setup-window window-configuration-change-hook))))
|
||||
;; Disable nlinum to fix elusive "invalid face linum" bug
|
||||
(remove-hook 'window-configuration-change-hook 'nlinum--setup-window t)
|
||||
(let ((frame (new-frame))
|
||||
(frame-name (format "*new-%s*" (length narf-wg-frames))))
|
||||
(frame-name (format "*new-%s*" (length doom-wg-frames))))
|
||||
(with-selected-frame frame
|
||||
(wg-create-workgroup frame-name t)
|
||||
(add-to-list 'narf-wg-frames (cons frame frame-name))))
|
||||
(add-to-list 'doom-wg-frames (cons frame frame-name))))
|
||||
(when nlinum-p
|
||||
(add-hook 'window-configuration-change-hook 'nlinum--setup-window nil t))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/close-frame ()
|
||||
(defun doom/close-frame ()
|
||||
(interactive)
|
||||
(aif (assq (selected-frame) narf-wg-frames)
|
||||
(aif (assq (selected-frame) doom-wg-frames)
|
||||
(progn (wg-delete-workgroup (wg-get-workgroup (cdr it)))
|
||||
(delete-frame (car it)))
|
||||
(delete-frame)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/evil-window-resize (direction &optional count)
|
||||
(defun doom/evil-window-resize (direction &optional count)
|
||||
(interactive)
|
||||
(let ((count (or count 1))
|
||||
(next-window (window-in-direction direction)))
|
||||
(when (or (not next-window) (not (narf/real-buffer-p (window-buffer next-window))))
|
||||
(when (or (not next-window) (not (doom/real-buffer-p (window-buffer next-window))))
|
||||
(setq count (- count)))
|
||||
(cond ((memq direction '(left right))
|
||||
(evil-window-increase-width count))
|
||||
((memq direction '(above below))
|
||||
(evil-window-increase-height count)))))
|
||||
|
||||
;;;###autoload (autoload 'narf/evil-window-resize-r "defuns-window" nil t)
|
||||
(evil-define-command narf/evil-window-resize-r (&optional count)
|
||||
(interactive "<c>") (narf/evil-window-resize 'right count))
|
||||
;;;###autoload (autoload 'narf/evil-window-resize-l "defuns-window" nil t)
|
||||
(evil-define-command narf/evil-window-resize-l (&optional count)
|
||||
(interactive "<c>") (narf/evil-window-resize 'left count))
|
||||
;;;###autoload (autoload 'narf/evil-window-resize-u "defuns-window" nil t)
|
||||
(evil-define-command narf/evil-window-resize-u (&optional count)
|
||||
;;;###autoload (autoload 'doom/evil-window-resize-r "defuns-window" nil t)
|
||||
(evil-define-command doom/evil-window-resize-r (&optional count)
|
||||
(interactive "<c>") (doom/evil-window-resize 'right count))
|
||||
;;;###autoload (autoload 'doom/evil-window-resize-l "defuns-window" nil t)
|
||||
(evil-define-command doom/evil-window-resize-l (&optional count)
|
||||
(interactive "<c>") (doom/evil-window-resize 'left count))
|
||||
;;;###autoload (autoload 'doom/evil-window-resize-u "defuns-window" nil t)
|
||||
(evil-define-command doom/evil-window-resize-u (&optional count)
|
||||
:repeat nil
|
||||
(interactive "<c>") (narf/evil-window-resize 'above count))
|
||||
;;;###autoload (autoload 'narf/evil-window-resize-d "defuns-window" nil t)
|
||||
(evil-define-command narf/evil-window-resize-d (&optional count)
|
||||
(interactive "<c>") (narf/evil-window-resize 'below count))
|
||||
(interactive "<c>") (doom/evil-window-resize 'above count))
|
||||
;;;###autoload (autoload 'doom/evil-window-resize-d "defuns-window" nil t)
|
||||
(evil-define-command doom/evil-window-resize-d (&optional count)
|
||||
(interactive "<c>") (doom/evil-window-resize 'below count))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/window-reorient ()
|
||||
(defun doom/window-reorient ()
|
||||
"Reorient all windows that are scrolled to the right."
|
||||
(interactive)
|
||||
(let ((i 0))
|
||||
|
@ -109,7 +111,7 @@ evil-window-move-* (e.g. `evil-window-move-far-left')"
|
|||
(when (> (window-hscroll) 0)
|
||||
(cl-incf i)
|
||||
(evil-beginning-of-line))))
|
||||
(narf/get-visible-windows))
|
||||
(doom/get-visible-windows))
|
||||
(message "Reoriented %s windows" i)))
|
||||
|
||||
(provide 'defuns-window)
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
;;; defuns-workgroup.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|wg-cleanup ()
|
||||
(narf/popup-close-all)
|
||||
(defun doom|wg-cleanup ()
|
||||
(doom/popup-close-all)
|
||||
(when (and (featurep 'neotree) (neo-global--window-exists-p))
|
||||
(neotree-hide)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/wg-projectile-switch-project ()
|
||||
(let ((project-root (narf/project-root)))
|
||||
(narf:workgroup-new nil (file-name-nondirectory (directory-file-name project-root)) t)
|
||||
(narf|update-scratch-buffer-cwd project-root)
|
||||
(defun doom/wg-projectile-switch-project ()
|
||||
(let ((project-root (doom/project-root)))
|
||||
(doom:workgroup-new nil (file-name-nondirectory (directory-file-name project-root)) t)
|
||||
(doom|update-scratch-buffer-cwd project-root)
|
||||
(when (featurep 'neotree)
|
||||
(neotree-projectile-action))))
|
||||
|
||||
;;;###autoload (autoload 'narf:save-session "defuns-workgroup" nil t)
|
||||
(evil-define-command narf:save-session (&optional bang session-name)
|
||||
;;;###autoload (autoload 'doom:save-session "defuns-workgroup" nil t)
|
||||
(evil-define-command doom:save-session (&optional bang session-name)
|
||||
(interactive "<!><a>")
|
||||
(unless (wg-workgroup-list)
|
||||
(wg-create-workgroup wg-first-wg-name))
|
||||
(narf|wg-cleanup)
|
||||
(doom|wg-cleanup)
|
||||
(wg-save-session-as (if session-name
|
||||
(concat wg-workgroup-directory session-name)
|
||||
(if bang
|
||||
(concat wg-workgroup-directory (f-filename (narf/project-root)))
|
||||
(concat wg-workgroup-directory (f-filename (doom/project-root)))
|
||||
wg-session-file))))
|
||||
|
||||
;;;###autoload (autoload 'narf:load-session "defuns-workgroup" nil t)
|
||||
(evil-define-command narf:load-session (&optional bang session-name)
|
||||
;;;###autoload (autoload 'doom:load-session "defuns-workgroup" nil t)
|
||||
(evil-define-command doom:load-session (&optional bang session-name)
|
||||
(interactive "<!><a>")
|
||||
(let ((session-file (if session-name
|
||||
(concat wg-workgroup-directory session-name)
|
||||
(let ((sess (concat wg-workgroup-directory (f-filename (narf/project-root)))))
|
||||
(let ((sess (concat wg-workgroup-directory (f-filename (doom/project-root)))))
|
||||
(if bang
|
||||
(when (file-exists-p sess)
|
||||
sess)
|
||||
|
@ -39,16 +39,16 @@
|
|||
(unless session-file
|
||||
(user-error "No session found"))
|
||||
(wg-open-session session-file))
|
||||
(narf/workgroup-display t))
|
||||
(doom/workgroup-display t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/clear-sessions ()
|
||||
(defun doom/clear-sessions ()
|
||||
"Delete all session files."
|
||||
(interactive)
|
||||
(mapc 'delete-file (f-glob (expand-file-name "*" wg-workgroup-directory))))
|
||||
|
||||
;;;###autoload (autoload 'narf:workgroup-new "defuns-workgroup" nil t)
|
||||
(evil-define-command narf:workgroup-new (bang name &optional silent)
|
||||
;;;###autoload (autoload 'doom:workgroup-new "defuns-workgroup" nil t)
|
||||
(evil-define-command doom:workgroup-new (bang name &optional silent)
|
||||
"Create a new workgroup. If BANG, overwrite any workgroup named NAME."
|
||||
(interactive "<!><a>")
|
||||
(unless name
|
||||
|
@ -58,43 +58,43 @@
|
|||
(wg-delete-workgroup new-wg)
|
||||
(setq new-wg nil))
|
||||
(setq new-wg (or new-wg (wg-make-and-add-workgroup name t)))
|
||||
(add-to-list 'narf-wg-names (wg-workgroup-uid new-wg))
|
||||
(add-to-list 'doom-wg-names (wg-workgroup-uid new-wg))
|
||||
(wg-switch-to-workgroup new-wg))
|
||||
(unless silent
|
||||
(narf--workgroup-display (wg-previous-workgroup t)
|
||||
(doom--workgroup-display (wg-previous-workgroup t)
|
||||
(format "Created %s" name)
|
||||
'success)))
|
||||
|
||||
;;;###autoload (autoload 'narf:workgroup-rename "defuns-workgroup" nil t)
|
||||
(evil-define-command narf:workgroup-rename (bang &optional new-name)
|
||||
;;;###autoload (autoload 'doom:workgroup-rename "defuns-workgroup" nil t)
|
||||
(evil-define-command doom:workgroup-rename (bang &optional new-name)
|
||||
(interactive "<!><a>")
|
||||
(let* ((wg (wg-current-workgroup))
|
||||
(wg-uid (wg-workgroup-uid wg))
|
||||
(old-name (wg-workgroup-name wg)))
|
||||
(if bang
|
||||
(setq narf-wg-names (delete wg-uid narf-wg-names))
|
||||
(setq doom-wg-names (delete wg-uid doom-wg-names))
|
||||
(unless new-name
|
||||
(user-error "You didn't enter in a name"))
|
||||
(wg-rename-workgroup new-name wg)
|
||||
(add-to-list 'narf-wg-names wg-uid)
|
||||
(narf--workgroup-display wg (format "Renamed '%s'->'%s'" old-name new-name) 'success))))
|
||||
(add-to-list 'doom-wg-names wg-uid)
|
||||
(doom--workgroup-display wg (format "Renamed '%s'->'%s'" old-name new-name) 'success))))
|
||||
|
||||
;;;###autoload (autoload 'narf:workgroup-delete "defuns-workgroup" nil t)
|
||||
(evil-define-command narf:workgroup-delete (&optional bang name)
|
||||
;;;###autoload (autoload 'doom:workgroup-delete "defuns-workgroup" nil t)
|
||||
(evil-define-command doom:workgroup-delete (&optional bang name)
|
||||
(interactive "<!><a>")
|
||||
(let* ((current-wg (wg-current-workgroup))
|
||||
(wg-name (or name (wg-workgroup-name current-wg))))
|
||||
(when bang
|
||||
(setq wg-name (wg-read-workgroup-name)))
|
||||
(let ((wg (wg-get-workgroup name)))
|
||||
(setq narf-wg-names (delete (wg-workgroup-uid wg) narf-wg-names))
|
||||
(setq doom-wg-names (delete (wg-workgroup-uid wg) doom-wg-names))
|
||||
(if (eq wg current-wg)
|
||||
(wg-kill-workgroup)
|
||||
(wg-delete-workgroup wg))
|
||||
(narf--workgroup-display nil (format "Deleted %s" wg-name) 'success))))
|
||||
(doom--workgroup-display nil (format "Deleted %s" wg-name) 'success))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:kill-other-workgroups ()
|
||||
(defun doom:kill-other-workgroups ()
|
||||
"Kill all other workgroups."
|
||||
(interactive)
|
||||
(let (workgroup (wg-current-workgroup))
|
||||
|
@ -102,7 +102,7 @@
|
|||
(unless (wg-current-workgroup-p w)
|
||||
(wg-kill-workgroup w)))))
|
||||
|
||||
(defun narf--num-to-unicode (num)
|
||||
(defun doom--num-to-unicode (num)
|
||||
"Return a nice unicode representation of a single-digit number STR."
|
||||
(cl-case num
|
||||
(1 "➊")
|
||||
|
@ -116,22 +116,22 @@
|
|||
(9 "➒")
|
||||
(0 "➓")))
|
||||
|
||||
(defun narf--workgroup-display (&optional suppress-update message message-face)
|
||||
(message "%s%s" (narf/workgroup-display suppress-update t)
|
||||
(defun doom--workgroup-display (&optional suppress-update message message-face)
|
||||
(message "%s%s" (doom/workgroup-display suppress-update t)
|
||||
(propertize message 'face message-face)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/workgroup-display (&optional suppress-update return-p message)
|
||||
(defun doom/workgroup-display (&optional suppress-update return-p message)
|
||||
(interactive)
|
||||
(when (wg-current-session t)
|
||||
(unless (eq suppress-update t)
|
||||
(narf/workgroup-update-names (if (wg-workgroup-p suppress-update) suppress-update)))
|
||||
(doom/workgroup-update-names (if (wg-workgroup-p suppress-update) suppress-update)))
|
||||
(let ((output (wg-display-internal
|
||||
(lambda (workgroup index)
|
||||
(if (not workgroup) wg-nowg-string
|
||||
(wg-element-display
|
||||
workgroup
|
||||
(format " %s %s " (narf--num-to-unicode (1+ index)) (wg-workgroup-name workgroup))
|
||||
(format " %s %s " (doom--num-to-unicode (1+ index)) (wg-workgroup-name workgroup))
|
||||
'wg-current-workgroup-p)))
|
||||
(wg-workgroup-list))))
|
||||
(if return-p
|
||||
|
@ -139,16 +139,16 @@
|
|||
(message "%s%s" output (or message ""))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/workgroup-update-names (&optional wg)
|
||||
(defun doom/workgroup-update-names (&optional wg)
|
||||
(let ((wg (or wg (wg-current-workgroup))))
|
||||
(unless (member (wg-workgroup-uid wg) narf-wg-names)
|
||||
(unless (member (wg-workgroup-uid wg) doom-wg-names)
|
||||
(ignore-errors
|
||||
(let ((old-name (wg-workgroup-name wg))
|
||||
(new-name (f-filename (narf/project-root))))
|
||||
(new-name (f-filename (doom/project-root))))
|
||||
(unless (string= new-name old-name)
|
||||
(wg-rename-workgroup new-name wg)))))))
|
||||
|
||||
(defun narf--switch-to-workgroup (direction &optional count)
|
||||
(defun doom--switch-to-workgroup (direction &optional count)
|
||||
(interactive "<c>")
|
||||
(assert (memq direction '(left right)))
|
||||
(condition-case err
|
||||
|
@ -156,52 +156,52 @@
|
|||
(if count
|
||||
(wg-switch-to-workgroup-at-index (1- count))
|
||||
(funcall (intern (format "wg-switch-to-workgroup-%s" direction))))
|
||||
(narf/workgroup-display t))
|
||||
(error (narf/workgroup-display t nil (format "Nope! %s" (cadr err))))))
|
||||
(doom/workgroup-display t))
|
||||
(error (doom/workgroup-display t nil (format "Nope! %s" (cadr err))))))
|
||||
|
||||
;;;###autoload (autoload 'narf:switch-to-workgroup-left "defuns-workgroup" nil t)
|
||||
(evil-define-command narf:switch-to-workgroup-left (count)
|
||||
;;;###autoload (autoload 'doom:switch-to-workgroup-left "defuns-workgroup" nil t)
|
||||
(evil-define-command doom:switch-to-workgroup-left (count)
|
||||
(interactive "<c>")
|
||||
(narf--switch-to-workgroup 'left))
|
||||
(doom--switch-to-workgroup 'left))
|
||||
|
||||
;;;###autoload (autoload 'narf:switch-to-workgroup-right "defuns-workgroup" nil t)
|
||||
(evil-define-command narf:switch-to-workgroup-right (count)
|
||||
;;;###autoload (autoload 'doom:switch-to-workgroup-right "defuns-workgroup" nil t)
|
||||
(evil-define-command doom:switch-to-workgroup-right (count)
|
||||
(interactive "<c>")
|
||||
(narf--switch-to-workgroup 'right))
|
||||
(doom--switch-to-workgroup 'right))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:switch-to-workgroup-at-index (index)
|
||||
(defun doom:switch-to-workgroup-at-index (index)
|
||||
(interactive)
|
||||
(narf/workgroup-update-names)
|
||||
(doom/workgroup-update-names)
|
||||
(let ((wg (nth index (wg-workgroup-list-or-error)))
|
||||
msg)
|
||||
(if wg
|
||||
(unless (eq wg (wg-current-workgroup t))
|
||||
(wg-switch-to-workgroup-at-index index))
|
||||
(setq msg (format "No tab #%s" (1+ index))))
|
||||
(narf/workgroup-display t nil msg)))
|
||||
(doom/workgroup-display t nil msg)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/undo-window-change ()
|
||||
(defun doom/undo-window-change ()
|
||||
(interactive)
|
||||
(call-interactively (if (wg-current-workgroup t) 'wg-undo-wconfig-change 'winner-undo)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/redo-window-change ()
|
||||
(defun doom/redo-window-change ()
|
||||
(interactive)
|
||||
(call-interactively (if (wg-current-workgroup t) 'wg-redo-wconfig-change 'winner-redo)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/close-window-or-workgroup ()
|
||||
(defun doom/close-window-or-workgroup ()
|
||||
(interactive)
|
||||
(if (memq (get-buffer-window) narf-popup-windows)
|
||||
(narf/popup-close)
|
||||
(narf/kill-real-buffer)
|
||||
(if (memq (get-buffer-window) doom-popup-windows)
|
||||
(doom/popup-close)
|
||||
(doom/kill-real-buffer)
|
||||
(if (and (one-window-p t)
|
||||
(> (length (wg-workgroup-list)) 1))
|
||||
(if (string= (wg-workgroup-name (wg-current-workgroup)) wg-first-wg-name)
|
||||
(evil-window-delete)
|
||||
(narf:workgroup-delete))
|
||||
(doom:workgroup-delete))
|
||||
(evil-window-delete))))
|
||||
|
||||
(provide 'defuns-workgroup)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
;; for ../core-yasnippet.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|yas-before-expand ()
|
||||
(defun doom|yas-before-expand ()
|
||||
"Strip out the shitespace before a line selection."
|
||||
(when (narf/evil-visual-line-state-p)
|
||||
(when (doom/evil-visual-line-state-p)
|
||||
(setq-local
|
||||
yas-selected-text
|
||||
(replace-regexp-in-string
|
||||
|
@ -13,13 +13,13 @@
|
|||
(1- (region-end)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|yas-after-expand ()
|
||||
(defun doom|yas-after-expand ()
|
||||
"Switch to insert mode when expanding a template via backtab, or go back to
|
||||
normal mode if there are no fields."
|
||||
(setq yas-selected-text nil))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/yas-insert-snippet ()
|
||||
(defun doom/yas-insert-snippet ()
|
||||
"Switch to insert mode when expanding a template via backtab, or go back to
|
||||
normal mode if there are no fields."
|
||||
(interactive)
|
||||
|
@ -36,7 +36,7 @@ normal mode if there are no fields."
|
|||
(unless fields (evil-change-state 'normal))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/yas-goto-start-of-field ()
|
||||
(defun doom/yas-goto-start-of-field ()
|
||||
"Go to the beginning of a field."
|
||||
(interactive)
|
||||
(let* ((snippet (car (yas--snippets-at-point)))
|
||||
|
@ -46,7 +46,7 @@ normal mode if there are no fields."
|
|||
(goto-char position))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/yas-goto-end-of-field ()
|
||||
(defun doom/yas-goto-end-of-field ()
|
||||
(interactive)
|
||||
(let* ((snippet (car (yas--snippets-at-point)))
|
||||
(position (yas--field-end (yas--snippet-active-field snippet))))
|
||||
|
@ -55,7 +55,7 @@ normal mode if there are no fields."
|
|||
(goto-char position))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/yas-backspace (&optional field)
|
||||
(defun doom/yas-backspace (&optional field)
|
||||
"Prevents Yas from stepping on my toes when I use backspace."
|
||||
(interactive)
|
||||
(let ((field (or field (and yas--active-field-overlay
|
||||
|
@ -65,7 +65,7 @@ normal mode if there are no fields."
|
|||
(t (delete-char -1)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/yas-delete (&optional field)
|
||||
(defun doom/yas-delete (&optional field)
|
||||
(interactive)
|
||||
(let ((field (or field (and yas--active-field-overlay
|
||||
(overlay-buffer yas--active-field-overlay)
|
||||
|
@ -79,7 +79,7 @@ normal mode if there are no fields."
|
|||
(t (delete-char 1)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/yas-clear-to-sof (&optional field)
|
||||
(defun doom/yas-clear-to-sof (&optional field)
|
||||
(interactive)
|
||||
(let* ((field (or field (and yas--active-field-overlay
|
||||
(overlay-buffer yas--active-field-overlay)
|
||||
|
@ -90,10 +90,11 @@ normal mode if there are no fields."
|
|||
|
||||
;; Snippet helpers ;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;###autoload
|
||||
(defun narf/yas-find-file ()
|
||||
(defun doom/yas-find-file ()
|
||||
"Browse through snippets folder"
|
||||
;; FIXME
|
||||
(interactive)
|
||||
(narf/ido-find-file (car narf-snippet-dirs)))
|
||||
(doom/ido-find-file (car doom-snippet-dirs)))
|
||||
|
||||
(provide 'defuns-yasnippet)
|
||||
;;; nlinum-defuns.el ends here
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
(defmacro def-company-backend! (hooks backends)
|
||||
"Register a company backend for a mode."
|
||||
(let* ((hooks (if (listp hooks) hooks (list hooks)))
|
||||
(def-name (intern (format "narf--init-company-%s"
|
||||
(def-name (intern (format "doom--init-company-%s"
|
||||
(mapconcat 'identity (mapcar 'symbol-name hooks) "-"))))
|
||||
(quoted (eq (car-safe backends) 'quote)))
|
||||
`(progn
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
(chars (plist-get rest :chars))
|
||||
(words (plist-get rest :words)))
|
||||
(when (or chars words)
|
||||
(let ((fn-name (intern (format "narf--electric-%s" (s-join "-" (mapcar 'symbol-name modes))))))
|
||||
(let ((fn-name (intern (format "doom--electric-%s" (s-join "-" (mapcar 'symbol-name modes))))))
|
||||
`(progn
|
||||
(defun ,fn-name ()
|
||||
(electric-indent-local-mode +1)
|
||||
,(if chars `(setq electric-indent-chars ',chars))
|
||||
,(if words `(setq narf-electric-indent-words ',words)))
|
||||
,(if words `(setq doom-electric-indent-words ',words)))
|
||||
(add-hook! ,modes ',fn-name))))))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -23,7 +23,7 @@
|
|||
(words (plist-get rest :words))
|
||||
(patterns (plist-get rest :patterns)))
|
||||
(when (or symbols words patterns)
|
||||
(let ((fn-name (intern (format "narf--rotate-%s" (s-join "-" (mapcar 'symbol-name modes))))))
|
||||
(let ((fn-name (intern (format "doom--rotate-%s" (s-join "-" (mapcar 'symbol-name modes))))))
|
||||
`(progn
|
||||
(defun ,fn-name ()
|
||||
,(if symbols `(setq-local rotate-text-local-symbols ',symbols))
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
(defmacro def-builder! (mode command &optional build-file)
|
||||
"Register major/minor MODE with build COMMAND. If FILES are provided, do an additional
|
||||
check to make sure they exist in the project root."
|
||||
(let ((fn (intern (format "narf--init-builder-%s" mode))))
|
||||
(let ((fn (intern (format "doom--init-builder-%s" mode))))
|
||||
`(progn
|
||||
(defun ,fn ()
|
||||
(when (or (null ,build-file)
|
||||
(narf/project-has-files ,build-file))
|
||||
(setq narf--build-command '(,command . ,build-file))))
|
||||
(doom/project-has-files ,build-file))
|
||||
(setq doom--build-command '(,command . ,build-file))))
|
||||
(add-hook! ,mode ',fn))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
(mapc (lambda (cmd) (evil-ex-define-cmd (car cmd) (cdr cmd)))
|
||||
',commands))
|
||||
(defun ,cmd-off (&rest _)
|
||||
(mapc (lambda (cmd) (narf/evil-ex-undefine-cmd (car cmd)))
|
||||
(mapc (lambda (cmd) (doom/evil-ex-undefine-cmd (car cmd)))
|
||||
',commands))))
|
||||
|
||||
;; Shortcuts for the evil expression register
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(words (plist-get rest :words))
|
||||
(patterns (plist-get rest :patterns))
|
||||
fn-name)
|
||||
(setq fn-name (intern (format "narf--rotate-%s"
|
||||
(setq fn-name (intern (format "doom--rotate-%s"
|
||||
(s-join "-" (mapcar 'symbol-name modes)))))
|
||||
`(progn
|
||||
(defun ,fn-name ()
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
;;;###autoload
|
||||
(defmacro def-version-cmd! (modes command)
|
||||
"Define a COMMAND for MODE that will set `narf--env-command' when that mode is
|
||||
"Define a COMMAND for MODE that will set `doom--env-command' when that mode is
|
||||
activated, which should return the version number of the current environment. It is used
|
||||
by `narf|spaceline-env-update' to display a version number in the modeline. For instance:
|
||||
by `doom|spaceline-env-update' to display a version number in the modeline. For instance:
|
||||
|
||||
(def-version-cmd! ruby-mode \"ruby --version | cut -d' ' -f2\")
|
||||
|
||||
This will display the ruby version in the modeline in ruby-mode buffers. It is cached the
|
||||
first time."
|
||||
(add-hook! (focus-in find-file) 'narf|spaceline-env-update)
|
||||
`(add-hook! ,modes (setq narf--env-command ,command)))
|
||||
(add-hook! (focus-in find-file) 'doom|spaceline-env-update)
|
||||
`(add-hook! ,modes (setq doom--env-command ,command)))
|
||||
|
||||
(provide 'defuns-spaceline)
|
||||
;;; defuns-spaceline.el ends here
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
;;; macros-yasnippet.el
|
||||
;; for ../core-yasnippet.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro def-yas-mode! (mode)
|
||||
|
|
78
init.el
78
init.el
|
@ -4,62 +4,47 @@
|
|||
;; URL: https://github.com/hlissner/.emacs.d
|
||||
;; Version: 1.0.1
|
||||
;;
|
||||
;;; Are you pondering what I'm pondering, Pinky?
|
||||
;; ================= =============== =============== ======== ========
|
||||
;; \\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //
|
||||
;; ||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||
|
||||
;; || . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||
|
||||
;; ||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||
|
||||
;; || . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||
|
||||
;; ||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||
|
||||
;; || . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||
|
||||
;; ||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||
|
||||
;; || ||_-' || || `-_|| || || ||_-' || || | \ / | `||
|
||||
;; || `' || || `' || || `' || || | \ / | ||
|
||||
;; || .===' `===. .==='.`===. .===' /==. | \/ | ||
|
||||
;; || .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||
|
||||
;; || .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||
|
||||
;; || .==' _-' '-__\._-' '-_./__-' `' |. /| | ||
|
||||
;; ||.==' _-' `' | /==.||
|
||||
;; ==' _-' \/ `==
|
||||
;; \ _-' `-_ /
|
||||
;; `'' ``'
|
||||
;;
|
||||
;; ,,, !/:.
|
||||
;; /::\". !!:::
|
||||
;; :::::\". ," \:,::
|
||||
;; ::::::\ ". ,","\::.
|
||||
;; \:::::":\ "/""v' :'
|
||||
;; !::::\ ! \ \ __
|
||||
;; "::::\ \ ! \.&&&&,
|
||||
;; ," __ ", cd,&&&&&&'
|
||||
;; \ ". "" / \&&&" _,---
|
||||
;; "",__\_ / _,:":::::
|
||||
;; _," ,"" ,-,__,/":,_ ,",":::::::
|
||||
;; _," ," `'' ::::,",__,,----,,__," /:::::::::
|
||||
;; ," ,".__, \:::," " /:::":::::/
|
||||
;; ," ,/"::::::\ >" (_-"/::::::
|
||||
;; / ,"_!:::::::/, ," _,,--, /::::::/
|
||||
;; / "" _,"\:::::::' ! ," ){:::::/
|
||||
;; ! _," \ "", \,"""-,____,"__,,,"_," _/
|
||||
;; ""t" \\ \ "-,_(*)&&&&(*)," \ ."
|
||||
;; / \", ! , \ ! - )
|
||||
;; ! \ "" ! !==!"-,__,'
|
||||
;; ! \ """_""""`, ", /"_
|
||||
;; \ , .l /" " ", \! ,_/
|
||||
;; ), \ / \ \/ ,, /! !
|
||||
;; ,::\ \," \ ! \/ ! !
|
||||
;; _,::::" ) )\ ," ___ \ -,_, ,"",! !
|
||||
;; __,,,::::"" ," ,":::,-:::--:" __\_!__/_""-,_!
|
||||
;; ,,:::""""""" ,:_,""__...._"""::::"" /:::::" ""::::::
|
||||
;; (:._ l::::::::::::\\/ "" ""
|
||||
;; """"--,,,--- """"
|
||||
;; These demons are not part of GNU Emacs.
|
||||
;;
|
||||
;; These mice are not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: MIT
|
||||
;;; License: GPLv3
|
||||
|
||||
(load (concat user-emacs-directory "bootstrap.el"))
|
||||
;;
|
||||
|
||||
(defconst narf-default-theme 'narf-one)
|
||||
(defconst narf-terminal-theme 'narf-dark)
|
||||
(defconst narf-default-font (font-spec :family "Fira Mono" :size 12))
|
||||
(defconst doom-default-theme 'doom-one)
|
||||
(defconst doom-terminal-theme 'doom-dark)
|
||||
(defconst doom-default-font (font-spec :family "Fira Mono" :size 12))
|
||||
|
||||
(defconst narf-leader-prefix "," "Prefix for <leader> bindings")
|
||||
(defconst narf-localleader-prefix "\\" "Prefix for <localleader> bindings")
|
||||
(defconst doom-leader "," "Prefix for <leader> bindings")
|
||||
(defconst doom-localleader "\\" "Prefix for <localleader> bindings")
|
||||
|
||||
;; Load packages
|
||||
(narf `(core ; core/core.el
|
||||
(doom `(core ; core/core.el
|
||||
|
||||
;; OS-specific config
|
||||
,(cond (IS-MAC 'core-os-osx)
|
||||
(IS-LINUX 'core-os-linux)
|
||||
(IS-WINDOWS 'core-os-win32))
|
||||
|
||||
;; The heart of NARF
|
||||
core-popup ; taming sudden and inevitable windows
|
||||
;; The heart of DOOM
|
||||
core-ui ; draw me like one of your French editors
|
||||
core-evil ; come to the dark side, we have cookies
|
||||
core-editor ; filling the editor-shaped hole in the emacs OS
|
||||
|
@ -72,6 +57,7 @@
|
|||
core-helm ; a search engine for life and love
|
||||
core-workgroups ; cure Emacs alzheimers + tab emulation
|
||||
core-eval ; run code, run; debug too
|
||||
core-popup ; taming sudden and inevitable windows
|
||||
|
||||
;; Environments
|
||||
module-apple ; Applescript, Swift, Launchbar & other wallet syphons
|
||||
|
@ -108,9 +94,9 @@
|
|||
extra-tmux ; close the rift between GUI & terminal
|
||||
extra-write ; Emacs as a word processor
|
||||
|
||||
;; Customization
|
||||
my-bindings
|
||||
;; Personal
|
||||
my-commands
|
||||
my-bindings
|
||||
))
|
||||
|
||||
;;; I think so Brain...
|
||||
;;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; defuns-cc.el --- for module-cc.el
|
||||
|
||||
(defun narf--c-lineup-inclass (langelem)
|
||||
(defun doom--c-lineup-inclass (langelem)
|
||||
(let ((inclass (assoc 'inclass c-syntactic-context)))
|
||||
(save-excursion
|
||||
(goto-char (c-langelem-pos inclass))
|
||||
|
@ -10,7 +10,7 @@
|
|||
'++))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/c-lineup-arglist (orig-fun &rest args)
|
||||
(defun doom/c-lineup-arglist (orig-fun &rest args)
|
||||
"Improve indentation of continued C++11 lambda function opened as argument."
|
||||
(if (and (eq major-mode 'c++-mode)
|
||||
(ignore-errors
|
||||
|
@ -23,7 +23,7 @@
|
|||
(apply orig-fun args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|init-c/c++-settings ()
|
||||
(defun doom|init-c/c++-settings ()
|
||||
(when (memq major-mode '(c-mode c++-mode objc-mode))
|
||||
(c-toggle-electric-state -1)
|
||||
(c-toggle-auto-newline -1)
|
||||
|
@ -33,7 +33,7 @@
|
|||
(c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level
|
||||
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
|
||||
(c-set-offset 'access-label '-)
|
||||
(c-set-offset 'inclass 'narf--c-lineup-inclass)
|
||||
(c-set-offset 'inclass 'doom--c-lineup-inclass)
|
||||
(c-set-offset 'arglist-intro '+)
|
||||
(c-set-offset 'arglist-close '0)
|
||||
;; Certain mappings interfere with smartparens and custom bindings
|
||||
|
@ -52,11 +52,11 @@
|
|||
(define-key c++-mode-map "}" nil)
|
||||
;; FIXME: fix smartparens
|
||||
;; (define-key c++-mode-map ">" nil)
|
||||
(map! :map (c-mode-base-map c++-mode-map) :i ">" 'narf/autoclose->-maybe)
|
||||
(map! :map (c-mode-base-map c++-mode-map) :i ">" 'doom/autoclose->-maybe)
|
||||
(define-key c++-mode-map "<" nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/autoclose->-maybe ()
|
||||
(defun doom/autoclose->-maybe ()
|
||||
"For some reason smartparens won't autoskip >'s, this hack does."
|
||||
(interactive)
|
||||
(if (save-excursion
|
||||
|
@ -65,22 +65,22 @@
|
|||
(forward-char)
|
||||
(call-interactively 'self-insert-command)))
|
||||
|
||||
(defun narf--copy-face (new-face face)
|
||||
(defun doom--copy-face (new-face face)
|
||||
"Define NEW-FACE from existing FACE."
|
||||
(copy-face face new-face)
|
||||
(eval `(defvar ,new-face nil))
|
||||
(set new-face new-face))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|init-c++-C11-highlights ()
|
||||
(defun doom|init-c++-C11-highlights ()
|
||||
;; C++11 syntax support (until cc-mode is updated)
|
||||
(require 'font-lock)
|
||||
;; labels, case, public, private, protected, namespace-tags
|
||||
(narf--copy-face 'font-lock-label-face 'font-lock-keyword-face)
|
||||
(doom--copy-face 'font-lock-label-face 'font-lock-keyword-face)
|
||||
;; comment markups such as Javadoc-tags
|
||||
(narf--copy-face 'font-lock-doc-markup-face 'font-lock-doc-face)
|
||||
(doom--copy-face 'font-lock-doc-markup-face 'font-lock-doc-face)
|
||||
;; comment markups
|
||||
(narf--copy-face 'font-lock-doc-string-face 'font-lock-comment-face)
|
||||
(doom--copy-face 'font-lock-doc-string-face 'font-lock-comment-face)
|
||||
(setq font-lock-maximum-decoration t)
|
||||
|
||||
;; We could place some regexes into `c-mode-common-hook', but
|
||||
|
@ -119,7 +119,7 @@
|
|||
) t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/append-semicolon ()
|
||||
(defun doom/append-semicolon ()
|
||||
"Append a semicolon to the end of this (or each selected) non-empty line."
|
||||
(interactive)
|
||||
(let ((beg (if (evil-visual-state-p) evil-visual-beginning (line-beginning-position)))
|
||||
|
@ -137,12 +137,12 @@
|
|||
(evil-normal-state))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sp-point-is-template-p (id action context)
|
||||
(defun doom/sp-point-is-template-p (id action context)
|
||||
(and (sp-in-code-p id action context)
|
||||
(sp-point-after-word-p id action context)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sp-point-after-include-p (id action context)
|
||||
(defun doom/sp-point-after-include-p (id action context)
|
||||
(and (sp-in-code-p id action context)
|
||||
(save-excursion
|
||||
(goto-char (line-beginning-position))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-scss.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/css-toggle-inline-or-block ()
|
||||
(defun doom/css-toggle-inline-or-block ()
|
||||
"Toggles between a SCSS multiline block and one-line block."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
|
@ -28,10 +28,10 @@
|
|||
(just-one-space)))))
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'narf/sass-build 'narf/scss-build)
|
||||
(defalias 'doom/sass-build 'doom/scss-build)
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/scss-build ()
|
||||
(defun doom/scss-build ()
|
||||
"Compile all sass/scss files in project"
|
||||
(interactive)
|
||||
(let ((scss-dir (f-slash (or (f-traverse-upwards (lambda (d)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
;;; defuns-eshell.el ---
|
||||
;;; defuns-eshell.el
|
||||
|
||||
(defun narf--eshell-in-prompt-p (&optional offset)
|
||||
(defun doom--eshell-in-prompt-p (&optional offset)
|
||||
(>= (- (point) (or offset 0)) (save-excursion (eshell-bol) (point))))
|
||||
|
||||
(defun narf--eshell-current-git-branch ()
|
||||
(defun doom--eshell-current-git-branch ()
|
||||
(let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n")
|
||||
when (string-match "^\*" match)
|
||||
collect match))))
|
||||
|
@ -12,48 +12,48 @@
|
|||
"")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-prompt ()
|
||||
(defun doom/eshell-prompt ()
|
||||
(concat (propertize (abbreviate-file-name (eshell/pwd)) 'face 'eshell-prompt)
|
||||
(propertize (narf--eshell-current-git-branch) 'face 'font-lock-function-name-face)
|
||||
(propertize (doom--eshell-current-git-branch) 'face 'font-lock-function-name-face)
|
||||
(propertize " $ " 'face 'font-lock-constant-face)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-append ()
|
||||
(defun doom/eshell-evil-append ()
|
||||
(interactive)
|
||||
(goto-char (point-max))
|
||||
(call-interactively 'evil-append))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-append-maybe ()
|
||||
(defun doom/eshell-evil-append-maybe ()
|
||||
(interactive)
|
||||
(if (narf--eshell-in-prompt-p)
|
||||
(if (doom--eshell-in-prompt-p)
|
||||
(call-interactively 'evil-insert)
|
||||
(narf/eshell-append)))
|
||||
(doom/eshell-append)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-prepend ()
|
||||
(defun doom/eshell-evil-prepend ()
|
||||
(interactive)
|
||||
(eshell-bol)
|
||||
(call-interactively 'evil-insert))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-prepend-maybe ()
|
||||
(defun doom/eshell-evil-prepend-maybe ()
|
||||
(interactive)
|
||||
(if (narf--eshell-in-prompt-p)
|
||||
(if (doom--eshell-in-prompt-p)
|
||||
(call-interactively 'evil-insert)
|
||||
(narf/eshell-prepend)))
|
||||
(doom/eshell-prepend)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-replace-maybe ()
|
||||
(defun doom/eshell-evil-replace-maybe ()
|
||||
(interactive)
|
||||
(if (narf--eshell-in-prompt-p)
|
||||
(if (doom--eshell-in-prompt-p)
|
||||
(call-interactively 'evil-replace)
|
||||
(user-error "Cannot edit read-only region")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/eshell-evil-replace-state-maybe ()
|
||||
(defun doom/eshell-evil-replace-state-maybe ()
|
||||
(interactive)
|
||||
(if (narf--eshell-in-prompt-p)
|
||||
(if (doom--eshell-in-prompt-p)
|
||||
(call-interactively 'evil-replace-state)
|
||||
(user-error "Cannot edit read-only region")))
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
;;; defuns-go.el
|
||||
|
||||
;; TODO Implement narf:go-get-package
|
||||
(defun narf--go-get-package ())
|
||||
;; TODO Implement doom:go-get-package
|
||||
(defun doom--go-get-package ())
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:go-test-run-all ()
|
||||
(defun doom:go-test-run-all ()
|
||||
(interactive)
|
||||
(async-shell-command (format "cd '%s' && go test" (narf/project-root))))
|
||||
(async-shell-command (format "cd '%s' && go test" (doom/project-root))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf:go-test-run-package ()
|
||||
(defun doom:go-test-run-package ()
|
||||
(interactive)
|
||||
(error "Not yet implemented")
|
||||
(async-shell-command (format "cd '%s' && go test %s" (narf/project-root) (narf--go-get-package))))
|
||||
(async-shell-command (format "cd '%s' && go test %s" (doom/project-root) (doom--go-get-package))))
|
||||
|
||||
(provide 'defuns-go)
|
||||
;;; defuns-go.el ends here
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
;;; defuns-java.el ---
|
||||
;;; defuns-java.el
|
||||
|
||||
;; yasnippet defuns
|
||||
;;;###autoload
|
||||
(defun narf/java-android-mode-is-layout-file ()
|
||||
(defun doom/java-android-mode-is-layout-file ()
|
||||
(and android-mode
|
||||
(eq major-mode 'nxml-mode)
|
||||
(string-equal (file-name-base (directory-file-name default-directory)) "layout")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/java-android-mode-in-tags (&rest tags)
|
||||
(defun doom/java-android-mode-in-tags (&rest tags)
|
||||
(-contains? tags (android-mode-tag-name)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/java-android-mode-tag-name ()
|
||||
(defun doom/java-android-mode-tag-name ()
|
||||
(save-excursion
|
||||
(let (beg end)
|
||||
(nxml-backward-up-element)
|
||||
|
@ -23,13 +23,13 @@
|
|||
(buffer-substring-no-properties beg end))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|android-mode-enable-maybe ()
|
||||
(let ((root (narf/project-root)))
|
||||
(when (or (narf/project-has-files "local.properties" root)
|
||||
(narf/project-has-files "AndroidManifest.xml" root)
|
||||
(narf/project-has-files "src/main/AndroidManifest.xml" root))
|
||||
(defun doom|android-mode-enable-maybe ()
|
||||
(let ((root (doom/project-root)))
|
||||
(when (or (doom/project-has-files "local.properties" root)
|
||||
(doom/project-has-files "AndroidManifest.xml" root)
|
||||
(doom/project-has-files "src/main/AndroidManifest.xml" root))
|
||||
(android-mode +1)
|
||||
(narf/set-build-command "./gradlew %s" "build.gradle"))))
|
||||
(doom/set-build-command "./gradlew %s" "build.gradle"))))
|
||||
|
||||
(provide 'defuns-java)
|
||||
;;; defuns-java.el ends here
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-julia.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/julia-repl ()
|
||||
(defun doom/julia-repl ()
|
||||
"Run an inferior instance of `julia' inside Emacs."
|
||||
(interactive)
|
||||
(let ((buffer (get-buffer-create "*Julia*")))
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
;;; defuns-lisp.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/elisp-find-function-at-pt ()
|
||||
(defun doom/elisp-find-function-at-pt ()
|
||||
(interactive)
|
||||
(let ((func (function-called-at-point)))
|
||||
(if func (find-function func))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/elisp-find-function-at-pt-other-window ()
|
||||
(defun doom/elisp-find-function-at-pt-other-window ()
|
||||
(interactive)
|
||||
(let ((func (function-called-at-point)))
|
||||
(if func (find-function-other-window func))))
|
||||
|
||||
(defun narf--ert-pre ()
|
||||
(defun doom--ert-pre ()
|
||||
(save-buffer)
|
||||
(eval-buffer))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-run-test ()
|
||||
(defun doom/ert-run-test ()
|
||||
(interactive)
|
||||
(let (case-fold-search)
|
||||
(narf--ert-pre)
|
||||
(doom--ert-pre)
|
||||
(aif (thing-at-point 'defun t)
|
||||
(if (string-match "(ert-deftest \\([^ ]+\\)" it)
|
||||
(ert-run-tests-interactively (substring it (match-beginning 1) (match-end 1)))
|
||||
|
@ -28,34 +28,34 @@
|
|||
(user-error "No test found at point"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-rerun-test ()
|
||||
(defun doom/ert-rerun-test ()
|
||||
(interactive)
|
||||
(let (case-fold-search)
|
||||
(narf--ert-pre)
|
||||
(doom--ert-pre)
|
||||
(aif (car-safe ert--selector-history)
|
||||
(ert-run-tests-interactively it)
|
||||
(message "No test found in history, looking for test at point")
|
||||
(narf/ert-run-test))))
|
||||
(doom/ert-run-test))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-run-all-tests ()
|
||||
(defun doom/ert-run-all-tests ()
|
||||
(interactive)
|
||||
(ert-delete-all-tests)
|
||||
(narf--ert-pre)
|
||||
(doom--ert-pre)
|
||||
(ert-run-tests-interactively t))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/elisp-auto-compile ()
|
||||
(defun doom/elisp-auto-compile ()
|
||||
(when (let ((file-name (buffer-file-name)))
|
||||
(and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name)))
|
||||
(--any? (f-child-of? file-name it)
|
||||
(append (list narf-core-dir narf-modules-dir
|
||||
narf-core-dir narf-modules-dir
|
||||
narf-private-dir)))))
|
||||
(narf:compile-el)))
|
||||
(append (list doom-core-dir doom-modules-dir
|
||||
doom-core-dir doom-modules-dir
|
||||
doom-private-dir)))))
|
||||
(doom:compile-el)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/elisp-inf-ielm ()
|
||||
(defun doom/elisp-inf-ielm ()
|
||||
(ielm)
|
||||
(let ((buf (current-buffer)))
|
||||
(bury-buffer)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-lua.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/inf-lua ()
|
||||
(defun doom/inf-lua ()
|
||||
(interactive)
|
||||
(lua-start-process "lua" "lua")
|
||||
(pop-to-buffer lua-process-buffer))
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
;;; defuns-markdown.el --- for module-markdown.el
|
||||
;;; defuns-markdown.el
|
||||
|
||||
;; Implement strike-through formatting
|
||||
(defvar narf--markdown-regex-del
|
||||
(defvar doom--markdown-regex-del
|
||||
"\\(^\\|[^\\]\\)\\(\\(~\\{2\\}\\)\\([^ \n \\]\\|[^ \n ]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(\\3\\)\\)")
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/markdown-insert-del ()
|
||||
(defun doom/markdown-insert-del ()
|
||||
"Surround region in github strike-through delimiters."
|
||||
(interactive)
|
||||
(let ((delim "~~"))
|
||||
|
@ -13,13 +13,12 @@
|
|||
;; Active region
|
||||
(let ((bounds (markdown-unwrap-things-in-region
|
||||
(region-beginning) (region-end)
|
||||
narf--markdown-regex-del 2 4)))
|
||||
doom--markdown-regex-del 2 4)))
|
||||
(markdown-wrap-or-insert delim delim nil (car bounds) (cdr bounds)))
|
||||
;; Bold markup removal, bold word at point, or empty markup insertion
|
||||
(if (thing-at-point-looking-at narf--markdown-regex-del)
|
||||
(if (thing-at-point-looking-at doom--markdown-regex-del)
|
||||
(markdown-unwrap-thing-at-point nil 2 4)
|
||||
(markdown-wrap-or-insert delim delim 'word nil nil)))))
|
||||
|
||||
|
||||
(provide 'defuns-markdown)
|
||||
;;; defuns-markdown.el ends here
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
;;; defuns-org-notebook.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org ()
|
||||
(defun doom/org ()
|
||||
(interactive)
|
||||
(find-file (f-expand "inbox.org" org-directory)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-notebook-new ()
|
||||
(defun doom/org-notebook-new ()
|
||||
(interactive)
|
||||
(projectile-invalidate-cache nil)
|
||||
(let* ((default-directory org-directory)
|
||||
(dir (projectile-complete-dir))
|
||||
(narf-org-quicknote-dir dir))
|
||||
(doom-org-quicknote-dir dir))
|
||||
(when dir
|
||||
(narf/org-notebook-quick-note))))
|
||||
(doom/org-notebook-quick-note))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-notebook-quick-note ()
|
||||
(defun doom/org-notebook-quick-note ()
|
||||
(interactive)
|
||||
(let (text)
|
||||
(when (evil-visual-state-p)
|
||||
(setq text (buffer-substring-no-properties evil-visual-beginning evil-visual-end)))
|
||||
(switch-to-buffer (generate-new-buffer "*quick-note*"))
|
||||
(setq default-directory narf-org-quicknote-dir)
|
||||
(setq default-directory doom-org-quicknote-dir)
|
||||
(erase-buffer)
|
||||
(insert text)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-download-dnd (uri action)
|
||||
(defun doom/org-download-dnd (uri action)
|
||||
(if (eq major-mode 'org-mode)
|
||||
(narf:org-attach uri)
|
||||
(doom:org-attach uri)
|
||||
(let ((dnd-protocol-alist
|
||||
(rassq-delete-all 'narf/org-download-dnd (copy-alist dnd-protocol-alist))))
|
||||
(rassq-delete-all 'doom/org-download-dnd (copy-alist dnd-protocol-alist))))
|
||||
(dnd-handle-one-url nil action uri))))
|
||||
|
||||
;;;###autoload (autoload 'narf:org-attach "defuns-org-notebook" nil t)
|
||||
(evil-define-command narf:org-attach (&optional uri)
|
||||
;;;###autoload (autoload 'doom:org-attach "defuns-org-notebook" nil t)
|
||||
(evil-define-command doom:org-attach (&optional uri)
|
||||
(interactive "<a>")
|
||||
(unless (eq major-mode 'org-mode)
|
||||
(user-error "Not in an org-mode buffer"))
|
||||
|
@ -51,22 +51,22 @@
|
|||
(if (evil-visual-state-p)
|
||||
(org-insert-link nil (format "./%s" rel-path)
|
||||
(concat (buffer-substring-no-properties (region-beginning) (region-end))
|
||||
" " (narf/org-attach-icon rel-path)))
|
||||
" " (doom/org-attach-icon rel-path)))
|
||||
|
||||
(insert (if image-p
|
||||
(format "[[./%s]]" rel-path)
|
||||
(format "%s [[./%s][%s]]"
|
||||
(narf/org-attach-icon rel-path)
|
||||
(doom/org-attach-icon rel-path)
|
||||
rel-path (f-filename rel-path)))))
|
||||
(when (string-match-p (regexp-opt '("jpg" "jpeg" "gif" "png")) (f-ext rel-path))
|
||||
(org-toggle-inline-images)))
|
||||
(let ((attachments (narf-org-attachments)))
|
||||
(let ((attachments (doom-org-attachments)))
|
||||
(unless attachments
|
||||
(user-error "No attachments in this file"))
|
||||
(helm :sources (helm-build-sync-source "Attachments" :candidates attachments)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-attach-icon (path)
|
||||
(defun doom/org-attach-icon (path)
|
||||
(char-to-string (pcase (downcase (f-ext path))
|
||||
("jpg" ?) ("jpeg" ?) ("png" ?) ("gif" ?)
|
||||
("pdf" ?)
|
||||
|
@ -79,7 +79,7 @@
|
|||
(t ?))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-attachments ()
|
||||
(defun doom/org-attachments ()
|
||||
"Retrieves a list of all the attachments pertinent to the currect org-mode buffer."
|
||||
(org-save-outline-visibility nil
|
||||
(let ((attachments '())
|
||||
|
@ -100,15 +100,15 @@
|
|||
(-distinct attachments))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-cleanup-attachments ()
|
||||
(defun doom/org-cleanup-attachments ()
|
||||
"Deletes any attachments that are no longer present in the org-mode buffer."
|
||||
(let* ((attachments (narf/org-attachments))
|
||||
(to-delete (-difference narf-org-attachments-list attachments)))
|
||||
(let* ((attachments (doom/org-attachments))
|
||||
(to-delete (-difference doom-org-attachments-list attachments)))
|
||||
(mapc (lambda (f)
|
||||
(message "Deleting attachment: %s" f)
|
||||
(delete-file f t))
|
||||
to-delete)
|
||||
(setq narf-org-attachments-list attachments)))
|
||||
(setq doom-org-attachments-list attachments)))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -117,10 +117,10 @@
|
|||
|
||||
;; Ex-mode interface for `helm-ag'. If `bang', then `search' is interpreted as
|
||||
;; regexp.
|
||||
;;;###autoload (autoload 'narf:org-helm-search "defuns-org-notebook" nil t)
|
||||
(evil-define-operator narf:org-helm-search (beg end &optional search bang)
|
||||
;;;###autoload (autoload 'doom:org-helm-search "defuns-org-notebook" nil t)
|
||||
(evil-define-operator doom:org-helm-search (beg end &optional search bang)
|
||||
(interactive "<r><a><!>")
|
||||
(narf:helm-ag-search beg end (if bang (concat "^\\*+.*" search ".*$") search) t org-directory))
|
||||
(doom:helm-ag-search beg end (if bang (concat "^\\*+.*" search ".*$") search) t org-directory))
|
||||
|
||||
(provide 'defuns-org-notebook)
|
||||
;;; defuns-org-notebook.el ends here
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
;;; defuns-org.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-find-file-in-notes ()
|
||||
(defun doom/org-find-file-in-notes ()
|
||||
(interactive)
|
||||
(in! (f-slash org-directory)
|
||||
(helm-projectile-find-file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-find-file ()
|
||||
(defun doom/org-find-file ()
|
||||
(interactive)
|
||||
(in! (f-slash org-directory)
|
||||
(helm-find-files nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-find-exported-file ()
|
||||
(defun doom/org-find-exported-file ()
|
||||
(interactive)
|
||||
(in! (f-slash narf-org-export-directory)
|
||||
(in! (f-slash doom-org-export-directory)
|
||||
(helm-find-files nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-get-property (name)
|
||||
(defun doom/org-get-property (name)
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char 1)
|
||||
|
@ -27,7 +27,7 @@
|
|||
(buffer-substring-no-properties (match-beginning 1) (match-end 1))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-indent ()
|
||||
(defun doom/org-indent ()
|
||||
(interactive)
|
||||
(cond
|
||||
((and (org-on-heading-p)
|
||||
|
@ -37,7 +37,7 @@
|
|||
(t (call-interactively 'self-insert-command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-dedent ()
|
||||
(defun doom/org-dedent ()
|
||||
(interactive)
|
||||
(cond
|
||||
((and (org-on-heading-p)
|
||||
|
@ -47,7 +47,7 @@
|
|||
(t (call-interactively 'self-insert-command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-insert-item (direction)
|
||||
(defun doom/org-insert-item (direction)
|
||||
"Inserts a new heading or item, depending on the context. I use this instead of
|
||||
`org-insert-item' or `org-insert-heading' because they try to do too much and end up doing
|
||||
this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
||||
|
@ -74,7 +74,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
('below
|
||||
(org-table-insert-row))
|
||||
('above
|
||||
(narf/org-table-prepend-row-or-shift-up))))
|
||||
(doom/org-table-prepend-row-or-shift-up))))
|
||||
(t
|
||||
(let ((level (save-excursion
|
||||
(org-back-to-heading)
|
||||
|
@ -104,7 +104,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
(evil-append-line 1)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-toggle-checkbox ()
|
||||
(defun doom/org-toggle-checkbox ()
|
||||
(interactive)
|
||||
(let ((context (org-element-lineage (org-element-context) '(item) t)))
|
||||
(when context
|
||||
|
@ -116,7 +116,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
(insert "[ ] ")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-dwim-at-point ()
|
||||
(defun doom/org-dwim-at-point ()
|
||||
(interactive)
|
||||
(let* ((scroll-pt (window-start))
|
||||
(context (org-element-context))
|
||||
|
@ -160,14 +160,14 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
((memq type '(link))
|
||||
(let ((path (org-element-property :path (org-element-lineage (org-element-context) '(link) t))))
|
||||
(if (and path (image-type-from-file-name path))
|
||||
(narf/org-refresh-inline-images)
|
||||
(doom/org-refresh-inline-images)
|
||||
(org-open-at-point))))
|
||||
|
||||
(t (narf/org-refresh-inline-images)))
|
||||
(t (doom/org-refresh-inline-images)))
|
||||
(set-window-start nil scroll-pt)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-refresh-inline-images ()
|
||||
(defun doom/org-refresh-inline-images ()
|
||||
(interactive)
|
||||
(if (> (length org-inline-image-overlays) 0)
|
||||
(org-remove-inline-images)
|
||||
|
@ -182,7 +182,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
|
||||
;; Formatting shortcuts
|
||||
;;;###autoload
|
||||
(defun narf/org-surround (delim)
|
||||
(defun doom/org-surround (delim)
|
||||
(if (region-active-p)
|
||||
(save-excursion
|
||||
(goto-char (region-beginning))
|
||||
|
@ -193,7 +193,7 @@ this otherwise simple task wrong (e.g. whitespace in the wrong places)."
|
|||
(save-excursion (insert delim))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-word-count (beg end &optional count-footnotes?)
|
||||
(defun doom/org-word-count (beg end &optional count-footnotes?)
|
||||
"Report the number of words in the Org mode buffer or selected region.
|
||||
Ignores:
|
||||
- comments
|
||||
|
@ -265,7 +265,7 @@ COUNT-FOOTNOTES? is non-nil."
|
|||
(if mark-active "region" "buffer")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-remove-link ()
|
||||
(defun doom/org-remove-link ()
|
||||
"Replace an org link by its description or if empty its address"
|
||||
(interactive)
|
||||
(if (org-in-regexp org-bracket-link-regexp 1)
|
||||
|
@ -277,52 +277,52 @@ COUNT-FOOTNOTES? is non-nil."
|
|||
(insert description))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-next-row ()
|
||||
(defun doom/org-table-next-row ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-table-next-row) (org-down-element)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-previous-row ()
|
||||
(defun doom/org-table-previous-row ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (narf--org-table-previous-row) (org-up-element)))
|
||||
(if (org-at-table-p) (doom--org-table-previous-row) (org-up-element)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-next-field ()
|
||||
(defun doom/org-table-next-field ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-table-next-field) (org-end-of-line)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-previous-field ()
|
||||
(defun doom/org-table-previous-field ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-table-previous-field) (org-beginning-of-line)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-append-field-or-shift-right ()
|
||||
(defun doom/org-table-append-field-or-shift-right ()
|
||||
(interactive)
|
||||
(org-shiftmetaright)
|
||||
(when (org-at-table-p) (org-metaright)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-prepend-field-or-shift-left ()
|
||||
(defun doom/org-table-prepend-field-or-shift-left ()
|
||||
(interactive)
|
||||
(if (org-at-table-p)
|
||||
(org-shiftmetaright)
|
||||
(org-shiftmetaleft)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-append-row-or-shift-down ()
|
||||
(defun doom/org-table-append-row-or-shift-down ()
|
||||
(interactive)
|
||||
(org-shiftmetadown)
|
||||
(when (org-at-table-p) (org-metadown)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/org-table-prepend-row-or-shift-up ()
|
||||
(defun doom/org-table-prepend-row-or-shift-up ()
|
||||
(interactive)
|
||||
(if (org-at-table-p)
|
||||
(org-shiftmetadown)
|
||||
(org-shiftmetaup)))
|
||||
|
||||
(defun narf--org-table-previous-row ()
|
||||
(defun doom--org-table-previous-row ()
|
||||
"Go to the previous row (same column) in the current table. Before doing so,
|
||||
re-align the table if necessary. (Necessary because org-mode has a
|
||||
`org-table-next-row', but not `org-table-previous-row')"
|
||||
|
@ -340,8 +340,8 @@ re-align the table if necessary. (Necessary because org-mode has a
|
|||
(skip-chars-backward "^|\n\r")
|
||||
(when (org-looking-at-p " ") (forward-char))))
|
||||
|
||||
;;;###autoload (autoload 'narf:org-link "defuns-org" nil t)
|
||||
(evil-define-command narf:org-link (link)
|
||||
;;;###autoload (autoload 'doom:org-link "defuns-org" nil t)
|
||||
(evil-define-command doom:org-link (link)
|
||||
"Add LINK to the org buffer. If a selection is active, link selection to LINK."
|
||||
(interactive "<a>")
|
||||
(unless (eq major-mode 'org-mode)
|
||||
|
@ -351,7 +351,7 @@ re-align the table if necessary. (Necessary because org-mode has a
|
|||
(org-insert-link nil link (when (and beg end) (buffer-substring-no-properties beg end)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sp-org-skip-asterisk (ms mb me)
|
||||
(defun doom/sp-org-skip-asterisk (ms mb me)
|
||||
(or (and (= (line-beginning-position) mb)
|
||||
(eq 32 (char-after (1+ mb))))
|
||||
(and (= (1+ (line-beginning-position)) me)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
;;; defuns-python.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf*anaconda-mode-doc-buffer ()
|
||||
(defun doom*anaconda-mode-doc-buffer ()
|
||||
"Delete the window on escape or C-g."
|
||||
(with-current-buffer (get-buffer "*anaconda-doc*")
|
||||
(local-set-key [escape] 'anaconda-nav-quit)
|
||||
(local-set-key [?\C-g] 'anaconda-nav-quit)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/inf-python ()
|
||||
(defun doom/inf-python ()
|
||||
(run-python python-shell-interpreter t t))
|
||||
|
||||
(provide 'defuns-python)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
;;; defuns-regex.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|reb-cleanup ()
|
||||
(defun doom|reb-cleanup ()
|
||||
(replace-regexp "^[ \n]*" "" nil (point-min) (point-max))
|
||||
(text-scale-set 2)
|
||||
(goto-char 2))
|
||||
|
||||
;;;###autoload (autoload 'narf:regex "defuns-regex" nil t)
|
||||
(evil-define-operator narf:regex (beg end type &optional regexstr bang)
|
||||
;;;###autoload (autoload 'doom:regex "defuns-regex" nil t)
|
||||
(evil-define-operator doom:regex (beg end type &optional regexstr bang)
|
||||
"Either a) converts selected (or entered-in) pcre regex into elisp
|
||||
regex, OR b) opens up re-builder."
|
||||
:move-point nil
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; defuns-sh.el
|
||||
|
||||
(defvar sh-extra-font-lock--keywords
|
||||
`((narf/sh-extra-font-lock--match-var-in-double-quoted-string
|
||||
`((doom/sh-extra-font-lock--match-var-in-double-quoted-string
|
||||
(2 font-lock-variable-name-face prepend))
|
||||
(,(concat
|
||||
"\\<"
|
||||
|
@ -10,13 +10,13 @@
|
|||
(0 'font-lock-builtin-face))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sh-extra-font-lock--is-in-double-quoted-string ()
|
||||
(defun doom/sh-extra-font-lock--is-in-double-quoted-string ()
|
||||
"Non-nil if point in inside a double-quoted string."
|
||||
(let ((state (syntax-ppss)))
|
||||
(eq (nth 3 state) ?\")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/sh-extra-font-lock--match-var-in-double-quoted-string (limit)
|
||||
(defun doom/sh-extra-font-lock--match-var-in-double-quoted-string (limit)
|
||||
"Search for variables in double-quoted strings bounded by LIMIT."
|
||||
(let (res)
|
||||
(while
|
||||
|
@ -24,11 +24,11 @@
|
|||
(re-search-forward
|
||||
"\\$\\({#?\\)?\\([[:alpha:]_][[:alnum:]_]*\\|[-#?@!]\\)"
|
||||
limit t))
|
||||
(not (narf/sh-extra-font-lock--is-in-double-quoted-string))))
|
||||
(not (doom/sh-extra-font-lock--is-in-double-quoted-string))))
|
||||
res))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|sh-extra-font-lock-activate ()
|
||||
(defun doom|sh-extra-font-lock-activate ()
|
||||
"Activate sh-extra-font-lock."
|
||||
(interactive)
|
||||
(font-lock-add-keywords nil sh-extra-font-lock--keywords)
|
||||
|
@ -39,7 +39,7 @@
|
|||
(font-lock-fontify-buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/inf-shell ()
|
||||
(defun doom/inf-shell ()
|
||||
(let* ((dest-sh (symbol-name sh-shell))
|
||||
(sh-shell-file dest-sh))
|
||||
(sh-shell-process t)
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
;;; defuns-web.el
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/web-html-email2mailto (beg end)
|
||||
(defun doom/web-html-email2mailto (beg end)
|
||||
(interactive "r")
|
||||
(replace-regexp "\\b\\([a-zA-Z0-9._+-%]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]+\\)\\b"
|
||||
"<a href=\"mailto:\\1\">\\1</a>"
|
||||
nil beg end))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/web-html-url2anchor (beg end)
|
||||
(defun doom/web-html-url2anchor (beg end)
|
||||
(interactive "r")
|
||||
(replace-regexp "\\bhttps?://.+?\\b"
|
||||
"<a href=\"\\1\">\\1</a>"
|
||||
nil beg end))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/web-refresh-browser ()
|
||||
(defun doom/web-refresh-browser ()
|
||||
(interactive)
|
||||
(call-process-shell-command "osascript -e 'tell application \"Google Chrome\" to tell the active tab of its first window to reload' &" nil 0))
|
||||
|
||||
;;;###autoload (autoload 'narf/html-entities "defuns-web" nil t)
|
||||
(evil-define-operator narf/html-entities (bang beg end)
|
||||
;;;###autoload (autoload 'doom/html-entities "defuns-web" nil t)
|
||||
(evil-define-operator doom/html-entities (bang beg end)
|
||||
"HTML encode/decode the selected region. Based on Xah's replace HTML named entities
|
||||
function @ http://ergoemacs.org/emacs/elisp_replace_html_entities_command.html"
|
||||
(interactive "<!><r>")
|
||||
|
|
|
@ -4,20 +4,20 @@
|
|||
(defmacro define-org-section! (type directory &optional id-func link-glob)
|
||||
(setq directory (f-slash directory))
|
||||
(let* ((type-str (symbol-name type))
|
||||
(link-sym (intern (format "narf/org-link-%s" type-str)))
|
||||
(link-sym (intern (format "doom/org-link-%s" type-str)))
|
||||
(dir-var (intern (format "org-directory-%s" type-str))))
|
||||
`(progn
|
||||
;; Variable containing directory: `org-directory-%s'
|
||||
(defvar ,dir-var ,(expand-file-name directory org-directory))
|
||||
|
||||
;; Open helm in directory: `narf/helm-org-%s'
|
||||
(evil-define-command ,(intern (format "narf:org-search-%s" type-str)) ()
|
||||
;; Open helm in directory: `doom/helm-org-%s'
|
||||
(evil-define-command ,(intern (format "doom:org-search-%s" type-str)) ()
|
||||
(interactive)
|
||||
(let ((default-directory (concat ,dir-var "/" (format-time-string "%Y") "/")))
|
||||
(helm-find-files nil)))
|
||||
|
||||
;; Open helm in directory: `narf/helm-org-%s'
|
||||
(defun ,(intern (format "narf/helm-org-find-file-in-%s" type-str)) ()
|
||||
;; Open helm in directory: `doom/helm-org-%s'
|
||||
(defun ,(intern (format "doom/helm-org-find-file-in-%s" type-str)) ()
|
||||
(interactive)
|
||||
(helm-do-ag (f-slash ,dir-var)))
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
:init-value nil
|
||||
:lighter " BIG"
|
||||
:global t
|
||||
(narf/load-font (if big-mode big-mode-font narf-default-font))
|
||||
(doom/load-font (if big-mode big-mode-font doom-default-font))
|
||||
(setq-default powerline-height
|
||||
(if big-mode
|
||||
big-mode-modeline-height
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
;; WIP
|
||||
|
||||
(defvar narf-ctags-alist
|
||||
(defvar doom-ctags-alist
|
||||
'((ruby-mode :exec "ripper-tags -R -f %t --emacs")
|
||||
(c++-mode :ext "cpp")
|
||||
(c-mode :ext "c")
|
||||
|
@ -11,26 +11,26 @@
|
|||
))
|
||||
|
||||
|
||||
(add-hook 'find-file-hook 'narf|init-tags)
|
||||
(defun narf|init-tags ()
|
||||
(awhen (narf/tags-p)
|
||||
(add-hook 'find-file-hook 'doom|init-tags)
|
||||
(defun doom|init-tags ()
|
||||
(awhen (doom/tags-p)
|
||||
(setq tags-table-list (list it))))
|
||||
|
||||
;; TODO
|
||||
;; (defun narf/tags-generate ()
|
||||
;; (defun doom/tags-generate ()
|
||||
;; (interactive)
|
||||
;; (let ((command (assoc major-mode narf-ctags-alist))
|
||||
;; (default-directory (narf/project-root)))
|
||||
;; (let ((command (assoc major-mode doom-ctags-alist))
|
||||
;; (default-directory (doom/project-root)))
|
||||
;; (unless command
|
||||
;; (user-error "No tag generator for %s" major-mode))
|
||||
;; (async-shell-command command "*narf:generate-tags*")))
|
||||
;; (async-shell-command command "*doom:generate-tags*")))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/find-def ()
|
||||
(defun doom/find-def ()
|
||||
(interactive)
|
||||
(let ((orig-pt (point))
|
||||
(orig-file (buffer-file-name)))
|
||||
(cond ((and (narf/tags-p)
|
||||
(cond ((and (doom/tags-p)
|
||||
(progn (call-interactively 'helm-etags-select)
|
||||
(and (/= orig-pt (point))
|
||||
(f-same? orig-file buffer-file-name)))))
|
||||
|
@ -40,8 +40,8 @@
|
|||
(t (call-interactively 'evil-goto-definition)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tags-p ()
|
||||
(let ((path (expand-file-name ".tags" (narf/project-root))))
|
||||
(defun doom/tags-p ()
|
||||
(let ((path (expand-file-name ".tags" (doom/project-root))))
|
||||
(and (f-exists? path) path)))
|
||||
|
||||
(provide 'extra-tags)
|
||||
|
|
|
@ -24,37 +24,37 @@
|
|||
:ex-arg shell
|
||||
(list (when (evil-ex-p) (evil-ex-file-arg))))
|
||||
|
||||
;;;###autoload (autoload 'narf:tmux-cd "extra-tmux" nil t)
|
||||
(evil-define-command narf:tmux-cd (&optional bang)
|
||||
;;;###autoload (autoload 'doom:tmux-cd "extra-tmux" nil t)
|
||||
(evil-define-command doom:tmux-cd (&optional bang)
|
||||
(interactive "<!>")
|
||||
(if bang
|
||||
(narf/tmux-cd-to-project)
|
||||
(narf/tmux-cd-to-here)))
|
||||
(doom/tmux-cd-to-project)
|
||||
(doom/tmux-cd-to-here)))
|
||||
|
||||
(defvar narf-tmux-last-command nil "The last command sent to tmux")
|
||||
;;;###autoload (autoload 'narf:tmux "extra-tmux" nil t)
|
||||
(evil-define-operator narf:tmux (&optional command bang)
|
||||
(defvar doom-tmux-last-command nil "The last command sent to tmux")
|
||||
;;;###autoload (autoload 'doom:tmux "extra-tmux" nil t)
|
||||
(evil-define-operator doom:tmux (&optional command bang)
|
||||
"Sends input to tmux. Use `bang' to append to tmux"
|
||||
:type inclusive
|
||||
(interactive "<term><!>")
|
||||
(unless command
|
||||
(setq command narf-tmux-last-command))
|
||||
(setq command doom-tmux-last-command))
|
||||
(if (not command)
|
||||
(os-switch-to-term)
|
||||
(tmux command (not bang))
|
||||
(setq narf-tmux-last-command command)
|
||||
(setq doom-tmux-last-command command)
|
||||
(when (evil-ex-p)
|
||||
(message "[Tmux] %s" command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-cd-to-here (&optional dir)
|
||||
(defun doom/tmux-cd-to-here (&optional dir)
|
||||
(interactive)
|
||||
(tmux (format "cd '%s'" (or dir default-directory))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/tmux-cd-to-project ()
|
||||
(defun doom/tmux-cd-to-project ()
|
||||
(interactive)
|
||||
(narf/tmux-cd-to-here (narf/project-root)))
|
||||
(doom/tmux-cd-to-here (doom/project-root)))
|
||||
|
||||
(provide 'extra-tmux)
|
||||
;;; extra-tmux.el ends here
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
|
||||
;; Write-mode settings
|
||||
(defconst write-mode nil)
|
||||
(defconst write-mode-theme 'narf-light)
|
||||
(defconst write-mode-theme 'doom-light)
|
||||
(defconst write-mode-font (font-spec :family "Hack" :size 12))
|
||||
|
||||
(defconst write-mode--last-mode-line mode-line-format)
|
||||
(defconst write-mode--last-theme doom-current-theme)
|
||||
(defconst write-mode--last-line-spacing line-spacing)
|
||||
|
||||
(spaceline-compile
|
||||
|
@ -40,8 +41,8 @@ functionality with buffer-local ones, which can be buggy in a minor-mode."
|
|||
(interactive)
|
||||
(let* ((mode-p write-mode)
|
||||
(on-off (if mode-p -1 +1)))
|
||||
(narf/load-theme (if mode-p 'narf-dark write-mode-theme) t)
|
||||
(narf/load-font (if mode-p narf-default-font write-mode-font))
|
||||
(doom/load-theme (if mode-p write-mode--last-theme write-mode-theme) t)
|
||||
(doom/load-font (if mode-p doom-default-font write-mode-font))
|
||||
(if mode-p
|
||||
(remove-hook 'org-mode-hook 'write-mode|org-hook)
|
||||
(add-hook 'org-mode-hook 'write-mode|org-hook))
|
||||
|
@ -54,7 +55,7 @@ functionality with buffer-local ones, which can be buggy in a minor-mode."
|
|||
(unless mode-p
|
||||
(setq mode-line-format write-mode--last-mode-line
|
||||
header-line-format nil))))
|
||||
(narf/get-buffers-in-modes '(org-mode markdown-mode)))
|
||||
(doom/get-buffers-in-modes '(org-mode markdown-mode)))
|
||||
(setq write-mode (not mode-p))))
|
||||
|
||||
(when (> emacs-major-version 24)
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
:commands (c-mode c++-mode objc-mode java-mode)
|
||||
:mode ("\\.mm" . objc-mode)
|
||||
:init
|
||||
(add-hook! c++-mode '(highlight-numbers-mode narf|init-c++-C11-highlights))
|
||||
(add-hook 'c-initialization-hook 'narf|init-c/c++-settings)
|
||||
(add-hook! c++-mode '(highlight-numbers-mode doom|init-c++-C11-highlights))
|
||||
(add-hook 'c-initialization-hook 'doom|init-c/c++-settings)
|
||||
|
||||
;; C++ header files
|
||||
(push (cons (lambda () (and (f-ext? buffer-file-name "h")
|
||||
|
@ -30,22 +30,22 @@
|
|||
(setq c-tab-always-indent nil
|
||||
c-electric-flag nil)
|
||||
|
||||
(map! :map c-mode-base-map (:localleader :nv ";" 'narf/append-semicolon))
|
||||
(map! :map c-mode-base-map (:localleader :nv ";" 'doom/append-semicolon))
|
||||
|
||||
(sp-with-modes '(c-mode c++-mode objc-mode java-mode)
|
||||
(sp-local-pair "<" ">" :when '(narf/sp-point-is-template-p narf/sp-point-after-include-p))
|
||||
(sp-local-pair "<" ">" :when '(doom/sp-point-is-template-p doom/sp-point-after-include-p))
|
||||
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
;; Doxygen blocks
|
||||
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
|
||||
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
|
||||
|
||||
;; Improve indentation of inline lambdas in C++11
|
||||
(advice-add 'c-lineup-arglist :around 'narf/c-lineup-arglist))
|
||||
(advice-add 'c-lineup-arglist :around 'doom/c-lineup-arglist))
|
||||
|
||||
(use-package irony
|
||||
:after cc-mode
|
||||
:config
|
||||
(setq irony-server-install-prefix (concat narf-temp-dir "/irony/"))
|
||||
(setq irony-server-install-prefix (concat doom-temp-dir "/irony/"))
|
||||
(add-hook! c++-mode
|
||||
(make-variable-buffer-local 'irony-additional-clang-options)
|
||||
(push "-std=c++11" irony-additional-clang-options))
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
:commands (omnisharp-mode)
|
||||
:preface
|
||||
(setq omnisharp-auto-complete-want-documentation nil
|
||||
omnisharp-server-executable-path (concat narf-ext-dir "/OmniSharp.exe"))
|
||||
omnisharp-server-executable-path (concat doom-ext-dir "/OmniSharp.exe"))
|
||||
:when (file-exists-p omnisharp-server-executable-path)
|
||||
:init (add-hook! csharp-mode '(turn-on-eldoc-mode omnisharp-mode))
|
||||
:config
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; module-css.el
|
||||
|
||||
(after! emr
|
||||
(emr-declare-command 'narf/css-toggle-inline-or-block
|
||||
(emr-declare-command 'doom/css-toggle-inline-or-block
|
||||
:title "toggle inline/block"
|
||||
:modes '(css-mode less-css-mode scss-mode)
|
||||
:predicate (lambda () (not (use-region-p)))))
|
||||
|
@ -35,7 +35,7 @@
|
|||
(use-package sass-mode
|
||||
:mode "\\.sass$"
|
||||
:config
|
||||
(def-builder! sass-mode narf/sass-build)
|
||||
(def-builder! sass-mode doom/sass-build)
|
||||
(def-company-backend! sass-mode (css yasnippet))
|
||||
(def-docset! sass-mode "sass,bourbon")
|
||||
(push '("sass" "css") projectile-other-file-alist))
|
||||
|
@ -43,15 +43,15 @@
|
|||
(use-package scss-mode
|
||||
:mode "\\.scss$"
|
||||
:config
|
||||
(def-builder! scss-mode narf/scss-build)
|
||||
(def-builder! scss-mode doom/scss-build)
|
||||
(def-company-backend! scss-mode (css yasnippet))
|
||||
(def-docset! scss-mode "sass,bourbon")
|
||||
(push '("scss" "css") projectile-other-file-alist)
|
||||
(setq scss-compile-at-save nil))
|
||||
|
||||
(map! :map (css-mode-map sass-mode-map scss-mode-map)
|
||||
:n "M-R" 'narf/web-refresh-browser
|
||||
(:localleader :nv ";" 'narf/append-semicolon)
|
||||
:n "M-R" 'doom/web-refresh-browser
|
||||
(:localleader :nv ";" 'doom/append-semicolon)
|
||||
(:leader
|
||||
:n ";" 'helm-css-scss
|
||||
:n ":" 'helm-css-scss-multi))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
:defer t
|
||||
:init
|
||||
(evil-set-initial-state 'eshell-mode 'normal)
|
||||
(setq eshell-directory-name (concat narf-temp-dir "/eshell")
|
||||
(setq eshell-directory-name (concat doom-temp-dir "/eshell")
|
||||
eshell-scroll-to-bottom-on-input 'all
|
||||
eshell-buffer-shorthand t
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
eshell-error-if-no-glob t
|
||||
|
||||
;; em-alias
|
||||
eshell-aliases-file (concat narf-temp-dir "/.eshell-aliases"))
|
||||
eshell-aliases-file (concat doom-temp-dir "/.eshell-aliases"))
|
||||
|
||||
;; plan 9 smart shell
|
||||
(require 'em-smart)
|
||||
|
@ -24,15 +24,15 @@
|
|||
(setq eshell-smart-space-goes-to-end t)
|
||||
|
||||
;; em-prompt
|
||||
(setq eshell-prompt-function 'narf/eshell-prompt)
|
||||
(setq eshell-prompt-function 'doom/eshell-prompt)
|
||||
|
||||
(map! :map eshell-mode-map
|
||||
:n "i" 'narf/eshell-evil-prepend-maybe
|
||||
:n "I" 'narf/eshell-evil-prepend
|
||||
:n "a" 'narf/eshell-evil-append-maybe
|
||||
:n "A" 'narf/eshell-evil-append
|
||||
:n "r" 'narf/eshell-evil-replace-maybe
|
||||
:n "R" 'narf/eshell-evil-replace-state-maybe))
|
||||
:n "i" 'doom/eshell-evil-prepend-maybe
|
||||
:n "I" 'doom/eshell-evil-prepend
|
||||
:n "a" 'doom/eshell-evil-append-maybe
|
||||
:n "A" 'doom/eshell-evil-append
|
||||
:n "r" 'doom/eshell-evil-replace-maybe
|
||||
:n "R" 'doom/eshell-evil-replace-state-maybe))
|
||||
|
||||
(provide 'module-eshell)
|
||||
;;; module-eshell.el ends here
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
(:leader :n "h" 'godef-describe)
|
||||
(:localleader
|
||||
:n "p" 'helm-go-package
|
||||
:n "tr" 'narf:go-test-run-all
|
||||
:n "ta" 'narf:go-test-run-all
|
||||
:n "ts" 'narf:go-test-run-package))
|
||||
:n "tr" 'doom:go-test-run-all
|
||||
:n "ta" 'doom:go-test-run-all
|
||||
:n "ts" 'doom:go-test-run-package))
|
||||
|
||||
(mapc (lambda (x)
|
||||
(let ((command-name (car x))
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
(use-package inf-haskell
|
||||
:commands (inferior-haskell-mode inf-haskell-mode switch-to-haskell)
|
||||
:config
|
||||
(map! :map inf-haskell-mode-map "ESC ESC" 'narf/popup-close))
|
||||
(map! :map inf-haskell-mode-map "ESC ESC" 'doom/popup-close))
|
||||
|
||||
(provide 'module-haskell)
|
||||
;;; module-haskell.el ends here
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
;;; module-java.el --- the poster child for carpal tunnel
|
||||
|
||||
(def-docset! java-mode "java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc")
|
||||
(after! c-initialization
|
||||
(def-docset! java-mode
|
||||
"java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc"))
|
||||
|
||||
(use-package eclim
|
||||
:functions (eclim--project-dir eclim--project-name)
|
||||
|
@ -29,7 +31,7 @@
|
|||
(use-package android-mode
|
||||
:commands android-mode
|
||||
:init
|
||||
(add-hook! (java-mode groovy-mode nxml-mode) 'narf|android-mode-enable-maybe)
|
||||
(add-hook! (java-mode groovy-mode nxml-mode) 'doom|android-mode-enable-maybe)
|
||||
:config
|
||||
(def-yas-mode! 'android-mode)
|
||||
(after! company-dict
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
;; [pedantry intensifies]
|
||||
(add-hook! js2-mode (setq mode-name "JS2"))
|
||||
|
||||
(map! :map js2-mode-map (:localleader :nv ";" 'narf/append-semicolon)))
|
||||
(map! :map js2-mode-map (:localleader :nv ";" 'doom/append-semicolon)))
|
||||
|
||||
(use-package tern
|
||||
:after js2-mode
|
||||
|
@ -95,14 +95,14 @@
|
|||
(setq tide-format-options
|
||||
'(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t
|
||||
:placeOpenBraceOnNewLineForFunctions nil))
|
||||
(defun narf|tide-setup ()
|
||||
(defun doom|tide-setup ()
|
||||
(tide-setup)
|
||||
(flycheck-mode +1)
|
||||
(eldoc-mode +1))
|
||||
(add-hook 'typescript-mode-hook 'narf|tide-setup)
|
||||
(add-hook 'typescript-mode-hook 'doom|tide-setup)
|
||||
(add-hook! web-mode
|
||||
(when (f-ext? buffer-file-name "tsx")
|
||||
(narf|tide-setup)))
|
||||
(doom|tide-setup)))
|
||||
|
||||
(map! :map typescript-mode-map
|
||||
:m "gd" 'tide-jump-to-definition
|
||||
|
@ -115,7 +115,7 @@
|
|||
:files ("package.json")
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project-path (narf/project-root))
|
||||
(let* ((project-path (doom/project-root))
|
||||
(hash (gethash project-path npm-conf))
|
||||
(package-file (f-expand "package.json" project-path))
|
||||
deps)
|
||||
|
@ -128,7 +128,7 @@
|
|||
:modes (nodejs-project-mode bower-project-mode)
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(awhen (gethash (narf/project-root) npm-conf)
|
||||
(awhen (gethash (doom/project-root) npm-conf)
|
||||
(assq 'express (cdr-safe (assq 'dependencies it))))))
|
||||
|
||||
;; TODO electron-compile support
|
||||
|
@ -137,7 +137,7 @@
|
|||
:files ("app/index.html" "app/main.js")
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(awhen (gethash (narf/project-root) npm-conf)
|
||||
(awhen (gethash (doom/project-root) npm-conf)
|
||||
(let ((deps (append (car-safe (assq 'dependencies it))
|
||||
(car-safe (assq 'devDependencies it)))))
|
||||
(or (assq 'electron-prebuilt deps)
|
||||
|
@ -148,7 +148,7 @@
|
|||
:modes (nodejs-project-mode bower-project-mode)
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project (narf/project-root))
|
||||
(let* ((project (doom/project-root))
|
||||
(deps (append (cdr-safe (assq 'dependencies (gethash project bower-conf)))
|
||||
(cdr-safe (assq 'dependencies (gethash project npm-conf))))))
|
||||
(assq 'react deps))))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
(use-package julia-mode
|
||||
:mode "\\.jl$"
|
||||
:interpreter "julia"
|
||||
:config (def-repl! julia-mode narf/julia-repl))
|
||||
:config (def-repl! julia-mode doom/julia-repl))
|
||||
|
||||
(provide 'module-julia)
|
||||
;;; module-julia.el ends here
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; module-latex.el
|
||||
|
||||
(defvar bibtex-dir "~/Dropbox/docs/biblio")
|
||||
(defvar doom-bibtex-dir "~/Dropbox/docs/biblio")
|
||||
|
||||
(use-package reftex
|
||||
:commands turn-on-reftex
|
||||
|
@ -8,7 +8,7 @@
|
|||
(setq reftex-plug-into-AUCTeX t
|
||||
reftex-ref-style-default-list '("Cleveref" "Hyperref" "Fancyref")
|
||||
reftex-default-bibliography
|
||||
`(,(expand-file-name "phys.bib" bibtex-dir)))
|
||||
`(,(expand-file-name "phys.bib" doom-bibtex-dir)))
|
||||
(add-hook! (LaTeX-mode latex-mode) 'turn-on-reftex))
|
||||
|
||||
(use-package helm-bibtex
|
||||
|
@ -26,12 +26,12 @@
|
|||
|
||||
:config
|
||||
(setq helm-bibtex-bibliography
|
||||
(list (f-expand "phys.bib" bibtex-dir))
|
||||
(list (f-expand "phys.bib" doom-bibtex-dir))
|
||||
|
||||
helm-bibtex-library-path
|
||||
(list (f-expand "phys-pdf" bibtex-dir))
|
||||
(list (f-expand "phys-pdf" doom-bibtex-dir))
|
||||
|
||||
helm-bibtex-notes-path (f-expand "notes.org" bibtex-dir)
|
||||
helm-bibtex-notes-path (f-expand "notes.org" doom-bibtex-dir)
|
||||
|
||||
helm-bibtex-pdf-open-function
|
||||
(lambda (fpath) (async-start-process "open-pdf" "/usr/bin/open" nil fpath))))
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
(add-hook! emacs-lisp-mode '(turn-on-eldoc-mode flycheck-mode highlight-numbers-mode))
|
||||
|
||||
;; Real go-to-definition for elisp
|
||||
(map! :map emacs-lisp-mode-map :m "gd" 'narf/elisp-find-function-at-pt)
|
||||
(map! :map emacs-lisp-mode-map :m "gd" 'doom/elisp-find-function-at-pt)
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook 'narf/elisp-init)
|
||||
(defun narf/elisp-init ()
|
||||
(add-hook 'emacs-lisp-mode-hook 'doom/elisp-init)
|
||||
(defun doom/elisp-init ()
|
||||
(def-company-backend! emacs-lisp-mode (elisp yasnippet))
|
||||
(def-repl! emacs-lisp-mode narf/elisp-inf-ielm)
|
||||
(def-repl! emacs-lisp-mode doom/elisp-inf-ielm)
|
||||
(def-rotate! emacs-lisp-mode
|
||||
:symbols (("t" "nil")
|
||||
("let" "let*")
|
||||
|
@ -23,16 +23,16 @@
|
|||
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
|
||||
editorconfig-indentation-alist))
|
||||
|
||||
(remove-hook 'emacs-lisp-mode-hook 'narf/elisp-init))
|
||||
(remove-hook 'emacs-lisp-mode-hook 'doom/elisp-init))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook 'narf/elisp-hook)
|
||||
(defun narf/elisp-hook ()
|
||||
(add-hook 'emacs-lisp-mode-hook 'doom/elisp-hook)
|
||||
(defun doom/elisp-hook ()
|
||||
(setq mode-name "Elisp") ; [pedantry intensifies]
|
||||
|
||||
(font-lock-add-keywords
|
||||
nil `(("(\\(lambda\\)" (1 (narf/show-as ?λ)))
|
||||
("(\\(narf\\)\\>" (1 font-lock-keyword-face append))
|
||||
;; Highlight narf macros (macros are fontified in emacs 25+)
|
||||
nil `(("(\\(lambda\\)" (1 (doom/show-as ?λ)))
|
||||
("(\\(doom\\)\\(-[^) ]+\\)?)" (0 font-lock-keyword-face append))
|
||||
;; Highlight doom macros (macros are fontified in emacs 25+)
|
||||
(,(concat
|
||||
"(\\(def-"
|
||||
(regexp-opt '("electric" "project-type" "company-backend"
|
||||
|
@ -43,7 +43,7 @@
|
|||
(1 font-lock-keyword-face append))
|
||||
(,(concat
|
||||
"(\\("
|
||||
(regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
|
||||
(regexp-opt '("λ" "in" "map" "after" "shut-up" "add-hook"
|
||||
"associate" "define-org-link" "ex"
|
||||
"define-org-section"))
|
||||
"!\\)")
|
||||
|
@ -58,7 +58,7 @@
|
|||
(2 font-lock-function-name-face))))
|
||||
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
|
||||
(add-hook 'after-save-hook 'narf/elisp-auto-compile nil t)
|
||||
(add-hook 'after-save-hook 'doom/elisp-auto-compile nil t)
|
||||
|
||||
(dolist (i '(("Evil Command" "\\(^\\s-*(evil-define-command +\\)\\(\\_<.+\\_>\\)" 2)
|
||||
("Evil Operator" "\\(^\\s-*(evil-define-operator +\\)\\(\\_<.+\\_>\\)" 2)
|
||||
|
@ -107,10 +107,10 @@
|
|||
:modes (emacs-lisp-mode)
|
||||
:match "/test/.+-test\\.el$"
|
||||
:bind (:localleader
|
||||
:n "tr" 'narf/ert-rerun-test
|
||||
:n "ta" 'narf/ert-run-all-tests
|
||||
:n "ts" 'narf/ert-run-test)
|
||||
(add-hook 'ert-results-mode-hook 'narf|hide-mode-line))
|
||||
:n "tr" 'doom/ert-rerun-test
|
||||
:n "ta" 'doom/ert-run-all-tests
|
||||
:n "ts" 'doom/ert-run-test)
|
||||
(add-hook 'ert-results-mode-hook 'doom|hide-mode-line))
|
||||
|
||||
(provide 'module-lisp)
|
||||
;;; module-elisp.el ends here
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
:config
|
||||
(def-company-backend! lua-mode (lua yasnippet))
|
||||
(def-electric! lua-mode :words ("else" "end"))
|
||||
(def-repl! lua-mode narf/inf-lua)
|
||||
(def-repl! lua-mode doom/inf-lua)
|
||||
(sp-with-modes '(lua-mode)
|
||||
;; disable defaults
|
||||
(sp-local-pair "if" nil :actions :rem)
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
;;; module-org-crm.el
|
||||
|
||||
(defun narf|org-crm-init ()
|
||||
(define-org-section! cproject "Work")
|
||||
(define-org-section! project "Projects")
|
||||
(define-org-section! contact "Contacts")
|
||||
(add-hook 'org-load-hook 'doom|org-crm-init)
|
||||
|
||||
(defvar org-directory-crm (expand-file-name "/crm/" org-directory))
|
||||
|
||||
(defun doom|org-crm-init ()
|
||||
;; (define-org-section! work "Work")
|
||||
;; (define-org-section! project "Projects")
|
||||
;; (define-org-section! contact "Contacts")
|
||||
)
|
||||
|
||||
(defun narf/org-crm-new (type name)
|
||||
;;
|
||||
(defun doom/org-crm-new (type name)
|
||||
)
|
||||
|
||||
(defun narf/org-crm-visit-project (&optional name)
|
||||
(defun doom/org-crm-visit-project (&optional name)
|
||||
)
|
||||
|
||||
(defun narf/org-crm-visit-contact (&optional name)
|
||||
(defun doom/org-crm-visit-contact (&optional name)
|
||||
)
|
||||
|
||||
(defun narf/org-crm-visit-invoice (&optional name)
|
||||
(defun doom/org-crm-visit-invoice (&optional name)
|
||||
)
|
||||
|
||||
(provide 'module-org-crm)
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
;; for images and documents into org files
|
||||
;; + A pandoc-powered export system
|
||||
|
||||
(add-hook 'org-load-hook 'narf|org-notebook-init t)
|
||||
(add-hook 'org-load-hook 'narf|org-attach-init t)
|
||||
(add-hook 'org-load-hook 'narf|org-export-init t)
|
||||
(add-hook 'org-load-hook 'doom|org-notebook-init t)
|
||||
(add-hook 'org-load-hook 'doom|org-attach-init t)
|
||||
(add-hook 'org-load-hook 'doom|org-export-init t)
|
||||
|
||||
(defvar org-directory-notebook (expand-file-name "/notebook/" org-directory))
|
||||
(defvar org-default-notes-file (expand-file-name "inbox.org" org-directory))
|
||||
|
||||
(defvar org-attach-directory ".attach/")
|
||||
(defvar narf-org-export-directory (concat org-directory ".export"))
|
||||
(defvar narf-org-quicknote-dir (concat org-directory "Inbox/"))
|
||||
(defvar doom-org-export-directory (concat org-directory ".export"))
|
||||
(defvar doom-org-quicknote-dir (concat org-directory "Inbox/"))
|
||||
|
||||
;; Keep track of attachments
|
||||
(defvar-local narf-org-attachments-list '()
|
||||
(defvar-local doom-org-attachments-list '()
|
||||
"A list of attachments for the current buffer")
|
||||
|
||||
;; Tell helm to ignore these directories
|
||||
|
@ -31,14 +31,14 @@
|
|||
|
||||
|
||||
;;
|
||||
(defun narf|org-notebook-init ()
|
||||
(defun doom|org-notebook-init ()
|
||||
;; (define-org-section! course "Classes"
|
||||
;; (lambda (path) (substring path 0 (s-index-of " " path))) "%s*.org")
|
||||
;; (exmap "ocl[ass]" 'narf:org-search-course)
|
||||
(narf-fix-unicode "FontAwesome" '(? ? ? ? ? ? ? ? ?) 13))
|
||||
;; (exmap "ocl[ass]" 'doom:org-search-course)
|
||||
(doom-fix-unicode "FontAwesome" '(? ? ? ? ? ? ? ?) 13))
|
||||
|
||||
;;
|
||||
(defun narf|org-attach-init ()
|
||||
(defun doom|org-attach-init ()
|
||||
;; Drag-and-drop support
|
||||
(require 'org-download)
|
||||
(setq-default org-download-image-dir org-attach-directory
|
||||
|
@ -50,23 +50,23 @@
|
|||
|
||||
;; Write download paths relative to current file
|
||||
(defun org-download--dir-2 () nil)
|
||||
(defun narf*org-download--fullname (path)
|
||||
(defun doom*org-download--fullname (path)
|
||||
(f-relative path (f-dirname (buffer-file-name))))
|
||||
(advice-add 'org-download--fullname :filter-return 'narf*org-download--fullname)
|
||||
(advice-add 'org-download--fullname :filter-return 'doom*org-download--fullname)
|
||||
|
||||
;; Add another drag-and-drop handler that will handle anything but image files
|
||||
(setq dnd-protocol-alist `(("^\\(https?\\|ftp\\|file\\|nfs\\):\\(//\\)?" . narf/org-download-dnd)
|
||||
(setq dnd-protocol-alist `(("^\\(https?\\|ftp\\|file\\|nfs\\):\\(//\\)?" . doom/org-download-dnd)
|
||||
,@dnd-protocol-alist))
|
||||
|
||||
;; ...auto-delete attachments once all references to it have been deleted.
|
||||
(add-hook 'org-mode-hook 'narf|org-attach-track-init)
|
||||
(defun narf|org-attach-track-init ()
|
||||
(setq narf-org-attachments-list (narf/org-attachments))
|
||||
(add-hook 'after-save-hook 'narf/org-cleanup-attachments nil t)))
|
||||
(add-hook 'org-mode-hook 'doom|org-attach-track-init)
|
||||
(defun doom|org-attach-track-init ()
|
||||
(setq doom-org-attachments-list (doom/org-attachments))
|
||||
(add-hook 'after-save-hook 'doom/org-cleanup-attachments nil t)))
|
||||
|
||||
|
||||
;;
|
||||
(defun narf|org-export-init ()
|
||||
(defun doom|org-export-init ()
|
||||
"Set up my own exporting system."
|
||||
(setq org-export-backends '(ascii html latex md)
|
||||
org-export-with-toc t
|
||||
|
@ -76,21 +76,21 @@
|
|||
(setq org-pandoc-options '((standalone . t) (mathjax . t) (parse-raw . t)))
|
||||
|
||||
;; Export to a central directory (why isn't this easier?)
|
||||
(unless (file-directory-p narf-org-export-directory)
|
||||
(mkdir narf-org-export-directory))
|
||||
(defun narf*org-export-output-file-name (args)
|
||||
(unless (file-directory-p doom-org-export-directory)
|
||||
(mkdir doom-org-export-directory))
|
||||
(defun doom*org-export-output-file-name (args)
|
||||
(unless (nth 2 args)
|
||||
(setq args (append args (list narf-org-export-directory))))
|
||||
(setq args (append args (list doom-org-export-directory))))
|
||||
args)
|
||||
(advice-add 'org-export-output-file-name :filter-args 'narf*org-export-output-file-name))
|
||||
(advice-add 'org-export-output-file-name :filter-args 'doom*org-export-output-file-name))
|
||||
|
||||
|
||||
;;
|
||||
;; (defvar narf-org-tags '())
|
||||
;; (defun narf|org-tag-init ()
|
||||
;; (defvar doom-org-tags '())
|
||||
;; (defun doom|org-tag-init ()
|
||||
;; (async-start
|
||||
;; `(lambda ()
|
||||
;; (let ((default-directory (narf/project-root))
|
||||
;; (let ((default-directory (doom/project-root))
|
||||
;; (data (s-trim (shell-command-to-string "ag --nocolor --nonumbers '^#\\+TAGS:'")))
|
||||
;; (alist '()))
|
||||
;; (unless (zerop (length data))
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
;;; module-org.el
|
||||
|
||||
(add-hook 'org-load-hook 'narf|org-init t)
|
||||
(add-hook 'org-load-hook 'narf|org-keybinds t)
|
||||
(add-hook 'org-mode-hook 'narf|org-hook)
|
||||
(add-hook 'org-load-hook 'doom|org-init t)
|
||||
(add-hook 'org-load-hook 'doom|org-keybinds t)
|
||||
(add-hook 'org-mode-hook 'doom|org-hook)
|
||||
|
||||
(defvar org-directory (expand-file-name "~/Dropbox/notes/"))
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
(require 'module-org-notebook)
|
||||
|
||||
;;
|
||||
(defun narf|org-hook ()
|
||||
(defun doom|org-hook ()
|
||||
(evil-org-mode +1)
|
||||
(visual-line-mode +1)
|
||||
(setq line-spacing 2)
|
||||
|
@ -29,14 +29,14 @@
|
|||
(outline-previous-visible-heading 1)
|
||||
(org-show-subtree))))
|
||||
|
||||
(defun narf|org-update ()
|
||||
(defun doom|org-update ()
|
||||
(when (file-exists-p buffer-file-name)
|
||||
(org-update-statistics-cookies t)))
|
||||
|
||||
(add-hook 'before-save-hook 'narf|org-update nil t)
|
||||
(add-hook 'evil-insert-state-exit-hook 'narf|org-update nil t))
|
||||
(add-hook 'before-save-hook 'doom|org-update nil t)
|
||||
(add-hook 'evil-insert-state-exit-hook 'doom|org-update nil t))
|
||||
|
||||
(defun narf|org-init ()
|
||||
(defun doom|org-init ()
|
||||
(setq-default
|
||||
org-export-coding-system 'utf-8
|
||||
|
||||
|
@ -109,7 +109,7 @@
|
|||
org-highlight-latex-and-related '(latex)
|
||||
org-latex-create-formula-image-program 'dvipng
|
||||
org-latex-image-default-width ".9\\linewidth"
|
||||
org-latex-preview-ltxpng-directory (concat narf-temp-dir "/ltxpng/")
|
||||
org-latex-preview-ltxpng-directory (concat doom-temp-dir "/ltxpng/")
|
||||
org-latex-remove-logfiles nil
|
||||
org-startup-with-latex-preview nil
|
||||
;; org-latex-packages-alist
|
||||
|
@ -122,7 +122,7 @@
|
|||
;; TODO: New vocabulary word
|
||||
|
||||
("c" "Changelog" entry
|
||||
(file+headline (f-expand "CHANGELOG.org" (narf/project-root)) "Unreleased")
|
||||
(file+headline (f-expand "CHANGELOG.org" (doom/project-root)) "Unreleased")
|
||||
"* %?")
|
||||
|
||||
;; ("p" "Project Notes" entry
|
||||
|
@ -142,8 +142,8 @@
|
|||
;; "** %i%?\n")
|
||||
))
|
||||
|
||||
(narf-fix-unicode "DejaVu Sans" '(?♭ ?♯))
|
||||
(narf-fix-unicode "Hack" '(?× ?∙ ?÷ ?⌉ ?⌈ ?⌊ ?⌋
|
||||
(doom-fix-unicode "DejaVu Sans" '(?♭ ?♯))
|
||||
(doom-fix-unicode "Hack" '(?× ?∙ ?÷ ?⌉ ?⌈ ?⌊ ?⌋
|
||||
?∩ ?∪ ?⊆ ?⊂ ?⊄ ?⊇ ?⊃ ?⊅
|
||||
?⇒ ?⇐ ?⇔ ?↔ ?→ ?≡ ?∴ ?∵ ?⊕ ?∀ ?∃ ?∄ ?∈ ?∉
|
||||
?∨ ?∧ ?¬))
|
||||
|
@ -196,13 +196,13 @@
|
|||
(pushnew 'org-is-agenda-file recentf-exclude)
|
||||
|
||||
;; Remove highlights on ESC
|
||||
(defun narf*org-remove-occur-highlights (&rest args)
|
||||
(defun doom*org-remove-occur-highlights (&rest args)
|
||||
(when (eq major-mode 'org-mode) (org-remove-occur-highlights)))
|
||||
(advice-add 'evil-force-normal-state :before 'narf*org-remove-occur-highlights)
|
||||
(advice-add 'evil-force-normal-state :before 'doom*org-remove-occur-highlights)
|
||||
|
||||
;; smartparens config
|
||||
(sp-with-modes '(org-mode)
|
||||
(sp-local-pair "*" "*" :unless '(sp-point-after-word-p sp-point-at-bol-p) :skip-match 'narf/sp-org-skip-asterisk)
|
||||
(sp-local-pair "*" "*" :unless '(sp-point-after-word-p sp-point-at-bol-p) :skip-match 'doom/sp-org-skip-asterisk)
|
||||
(sp-local-pair "_" "_" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p))
|
||||
(sp-local-pair "/" "/" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p) :post-handlers '(("[d1]" "SPC")))
|
||||
(sp-local-pair "~" "~" :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-symbol-p) :post-handlers '(("[d1]" "SPC")))
|
||||
|
@ -213,12 +213,12 @@
|
|||
(sp-local-pair "$$" "$$" :post-handlers '((:add " | ")) :unless '(sp-point-at-bol-p))
|
||||
(sp-local-pair "{" nil)))
|
||||
|
||||
(defun narf|org-keybinds ()
|
||||
(defun doom|org-keybinds ()
|
||||
(map! (:map org-mode-map
|
||||
"RET" nil
|
||||
"C-j" nil
|
||||
"C-k" nil
|
||||
:i [remap narf/inflate-space-maybe] 'org-self-insert-command
|
||||
:i [remap doom/inflate-space-maybe] 'org-self-insert-command
|
||||
:i "RET" 'org-return-indent)
|
||||
|
||||
(:map evil-org-mode-map
|
||||
|
@ -227,36 +227,36 @@
|
|||
:ni "A-k" 'org-metaup
|
||||
:ni "A-j" 'org-metadown
|
||||
;; Expand tables (or shiftmeta move)
|
||||
:ni "A-L" 'narf/org-table-append-field-or-shift-right
|
||||
:ni "A-H" 'narf/org-table-prepend-field-or-shift-left
|
||||
:ni "A-K" 'narf/org-table-prepend-row-or-shift-up
|
||||
:ni "A-J" 'narf/org-table-append-row-or-shift-down
|
||||
:ni "A-L" 'doom/org-table-append-field-or-shift-right
|
||||
:ni "A-H" 'doom/org-table-prepend-field-or-shift-left
|
||||
:ni "A-K" 'doom/org-table-prepend-row-or-shift-up
|
||||
:ni "A-J" 'doom/org-table-append-row-or-shift-down
|
||||
|
||||
:i "C-L" 'narf/org-table-next-field
|
||||
:i "C-H" 'narf/org-table-previous-field
|
||||
:i "C-K" 'narf/org-table-previous-row
|
||||
:i "C-J" 'narf/org-table-next-row
|
||||
:i "C-L" 'doom/org-table-next-field
|
||||
:i "C-H" 'doom/org-table-previous-field
|
||||
:i "C-K" 'doom/org-table-previous-row
|
||||
:i "C-J" 'doom/org-table-next-row
|
||||
|
||||
:i "C-e" 'org-end-of-line
|
||||
:i "C-a" 'org-beginning-of-line
|
||||
:i "<tab>" 'narf/org-indent
|
||||
:i "<S-tab>" 'narf/org-dedent
|
||||
:i "<tab>" 'doom/org-indent
|
||||
:i "<S-tab>" 'doom/org-dedent
|
||||
|
||||
:nv "j" 'evil-next-visual-line
|
||||
:nv "k" 'evil-previous-visual-line
|
||||
:v "<S-tab>" 'narf/yas-insert-snippet
|
||||
:v "<S-tab>" 'doom/yas-insert-snippet
|
||||
|
||||
:i "M-a" (λ! (evil-visual-state) (org-mark-element))
|
||||
:n "M-a" 'org-mark-element
|
||||
:v "M-a" 'mark-whole-buffer
|
||||
|
||||
:ni "<M-return>" (λ! (narf/org-insert-item 'below))
|
||||
:ni "<S-M-return>" (λ! (narf/org-insert-item 'above))
|
||||
:ni "<M-return>" (λ! (doom/org-insert-item 'below))
|
||||
:ni "<S-M-return>" (λ! (doom/org-insert-item 'above))
|
||||
|
||||
:i "M-b" (λ! (narf/org-surround "*")) ; bold
|
||||
:i "M-u" (λ! (narf/org-surround "_")) ; underline
|
||||
:i "M-i" (λ! (narf/org-surround "/")) ; italics
|
||||
:i "M-`" (λ! (narf/org-surround "+")) ; strikethrough
|
||||
:i "M-b" (λ! (doom/org-surround "*")) ; bold
|
||||
:i "M-u" (λ! (doom/org-surround "_")) ; underline
|
||||
:i "M-i" (λ! (doom/org-surround "/")) ; italics
|
||||
:i "M-`" (λ! (doom/org-surround "+")) ; strikethrough
|
||||
|
||||
:v "M-b" "S*"
|
||||
:v "M-u" "S_"
|
||||
|
@ -265,7 +265,7 @@
|
|||
|
||||
(:leader
|
||||
:n ";" 'helm-org-in-buffer-headings
|
||||
:n "oa" 'narf/org-attachment-reveal)
|
||||
:n "oa" 'doom/org-attachment-reveal)
|
||||
|
||||
(:localleader
|
||||
:n "/" 'org-sparse-tree
|
||||
|
@ -276,18 +276,18 @@
|
|||
:n "=" 'org-align-all-tags
|
||||
:nv "l" 'org-insert-link
|
||||
:n "L" 'org-store-link
|
||||
:n "x" 'narf/org-remove-link
|
||||
:n "x" 'doom/org-remove-link
|
||||
;; :n "w" 'writing-mode
|
||||
:n "v" 'variable-pitch-mode
|
||||
:n "SPC" 'narf/org-toggle-checkbox
|
||||
:n "SPC" 'doom/org-toggle-checkbox
|
||||
:n "RET" 'org-archive-subtree
|
||||
|
||||
:n "a" 'org-agenda
|
||||
:n "A" 'narf:org-attachment-list
|
||||
:n "A" 'doom:org-attachment-list
|
||||
|
||||
:n "d" 'org-time-stamp
|
||||
:n "D" 'org-deadline
|
||||
:n "i" 'narf/org-toggle-inline-images-at-point
|
||||
:n "i" 'doom/org-toggle-inline-images-at-point
|
||||
:n "t" (λ! (org-todo (if (org-entry-is-todo-p) 'none 'todo)))
|
||||
:v "t" (λ! (evil-ex-normal evil-visual-beginning evil-visual-end "\\t"))
|
||||
:n "T" 'org-todo
|
||||
|
@ -312,7 +312,7 @@
|
|||
:m "]l" 'org-next-link
|
||||
:m "[l" 'org-previous-link
|
||||
|
||||
:n "RET" 'narf/org-dwim-at-point
|
||||
:n "RET" 'doom/org-dwim-at-point
|
||||
|
||||
:m "gh" 'outline-up-heading
|
||||
:m "gj" 'org-forward-heading-same-level
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
:init
|
||||
(add-hook 'php-mode-hook 'flycheck-mode)
|
||||
(setq php-template-compatibility nil
|
||||
php-extras-eldoc-functions-file (concat narf-temp-dir "/php-extras-eldoc-functions"))
|
||||
php-extras-eldoc-functions-file (concat doom-temp-dir "/php-extras-eldoc-functions"))
|
||||
|
||||
:config
|
||||
(def-repl! php-mode php-boris)
|
||||
(def-docset! php-mode "php,laravel")
|
||||
(def-company-backend! php-mode '(php-extras-company company-yasnippet))
|
||||
|
||||
(map! :map php-mode-map (:localleader :nv ";" 'narf/append-semicolon))
|
||||
(map! :map php-mode-map (:localleader :nv ";" 'doom/append-semicolon))
|
||||
|
||||
(sp-with-modes '(php-mode)
|
||||
(sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
|
||||
|
@ -85,7 +85,7 @@
|
|||
:files ("composer.json")
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project-path (narf/project-root))
|
||||
(let* ((project-path (doom/project-root))
|
||||
(hash (gethash project-path php-composer-conf))
|
||||
(package-file (f-expand "composer.json" project-path))
|
||||
deps)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
:commands (processing-mode processing-find-sketch)
|
||||
:mode "\\.pde$"
|
||||
:init
|
||||
(add-hook 'processing-compilation-mode-hook 'narf|hide-mode-line)
|
||||
(add-hook 'processing-compilation-mode-hook 'doom|hide-mode-line)
|
||||
|
||||
:config
|
||||
(def-builder! processing-mode processing-sketch-build)
|
||||
|
@ -28,7 +28,7 @@
|
|||
(quickrun-add-command
|
||||
"processing" `((:command . ,processing-location)
|
||||
(:exec . (lambda () (format "--sketch=%s --output=%s --force --run"
|
||||
(narf/project-root) processing-output-dir)))
|
||||
(doom/project-root) processing-output-dir)))
|
||||
(:description . "Run Processing sketch"))
|
||||
:mode 'processing-mode))
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
:commands python-mode
|
||||
:init
|
||||
(setq-default
|
||||
python-environment-directory narf-temp-dir
|
||||
python-environment-directory doom-temp-dir
|
||||
python-shell-interpreter "ipython"
|
||||
python-shell-interpreter-args "--deep-reload"
|
||||
python-shell-prompt-regexp "In \\[[0-9]+\\]: "
|
||||
|
@ -23,7 +23,7 @@
|
|||
(def-company-backend! python-mode (anaconda))
|
||||
(def-docset! python-mode "py,py3,python")
|
||||
(def-version-cmd! python-mode "python --version 2>&1 | cut -d' ' -f2")
|
||||
(def-repl! python-mode narf/inf-python)
|
||||
(def-repl! python-mode doom/inf-python)
|
||||
|
||||
(define-key python-mode-map (kbd "DEL") nil)) ; interferes with smartparens
|
||||
|
||||
|
@ -31,14 +31,14 @@
|
|||
:after python
|
||||
:init
|
||||
(add-hook! python-mode '(anaconda-mode anaconda-eldoc-mode eldoc-mode))
|
||||
(setq anaconda-mode-installation-directory (concat narf-temp-dir "/anaconda/")
|
||||
(setq anaconda-mode-installation-directory (concat doom-temp-dir "/anaconda/")
|
||||
anaconda-mode-eldoc-as-single-line t)
|
||||
|
||||
:config
|
||||
(map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions)
|
||||
(map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit)
|
||||
|
||||
(advice-add 'anaconda-mode-doc-buffer :after 'narf*anaconda-mode-doc-buffer))
|
||||
(advice-add 'anaconda-mode-doc-buffer :after 'doom*anaconda-mode-doc-buffer))
|
||||
|
||||
(use-package company-anaconda
|
||||
:after anaconda-mode
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
(use-package racer
|
||||
:after rust-mode
|
||||
:preface
|
||||
(setq racer-cmd (concat narf-ext-dir "/racer")
|
||||
racer-rust-src-path (concat narf-ext-dir "/rust/src/"))
|
||||
(setq racer-cmd (concat doom-ext-dir "/racer")
|
||||
racer-rust-src-path (concat doom-ext-dir "/rust/src/"))
|
||||
:when (f-exists? racer-cmd)
|
||||
:init (add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
|
||||
:config
|
||||
|
|
|
@ -6,22 +6,22 @@
|
|||
("/\\.?bash\\(/.*\\|rc\\|_profile\\)$" . sh-mode))
|
||||
:init
|
||||
(add-hook! sh-mode
|
||||
'(flycheck-mode narf|sh-extra-font-lock-activate))
|
||||
'(flycheck-mode doom|sh-extra-font-lock-activate))
|
||||
:config
|
||||
(def-company-backend! sh-mode (shell))
|
||||
(def-electric! sh-mode :words ("else" "elif" "fi" "done"))
|
||||
(def-repl! sh-mode narf/inf-shell)
|
||||
(def-repl! sh-mode doom/inf-shell)
|
||||
(setq sh-indent-after-continuation 'always)
|
||||
|
||||
;; [pedantry intensifies]
|
||||
(add-hook! sh-mode (setq mode-name "sh"))
|
||||
|
||||
(sp-with-modes '(sh-mode)
|
||||
(sp-local-pair "case" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "if" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "for" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "elif" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "while" "" :when '(("SPC")) :post-handlers '((:add narf/sp-insert-yasnippet)) :actions '(insert))))
|
||||
(sp-local-pair "case" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "if" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "for" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "elif" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))
|
||||
(sp-local-pair "while" "" :when '(("SPC")) :post-handlers '((:add doom/sp-insert-yasnippet)) :actions '(insert))))
|
||||
|
||||
(use-package company-shell
|
||||
:after sh-script
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
"<M-right>" nil
|
||||
|
||||
;; Assumes you have a markdown renderer plugin in chrome
|
||||
:nv "M-r" (λ! (narf-open-with "Google Chrome"))
|
||||
:nv "M-r" (λ! (doom-open-with "Google Chrome"))
|
||||
|
||||
"M-*" 'markdown-insert-list-item
|
||||
"M-b" 'markdown-insert-bold
|
||||
"M-i" 'markdown-insert-italic
|
||||
"M-`" 'narf/markdown-insert-del
|
||||
"M-`" 'doom/markdown-insert-del
|
||||
|
||||
(:localleader
|
||||
:nv "i" 'markdown-insert-image
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
(push '("jade" "html") projectile-other-file-alist)
|
||||
(push '("pug" "html") projectile-other-file-alist)
|
||||
(map! :map pug-mode-map
|
||||
:i [tab] 'narf/dumb-indent
|
||||
:i [backtab] 'narf/dumb-dedent))
|
||||
:i [tab] 'doom/dumb-indent
|
||||
:i [backtab] 'doom/dumb-dedent))
|
||||
|
||||
(use-package web-mode
|
||||
:mode ("\\.p?html?$"
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
(map! :map web-mode-map
|
||||
"M-/" 'web-mode-comment-or-uncomment
|
||||
:n "M-r" 'narf/web-refresh-browser
|
||||
:n "M-r" 'doom/web-refresh-browser
|
||||
|
||||
:n "za" 'web-mode-fold-or-unfold
|
||||
(:localleader :n "t" 'web-mode-element-rename)
|
||||
|
@ -77,7 +77,7 @@
|
|||
:files ("bower.json")
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project-path (narf/project-root))
|
||||
(let* ((project-path (doom/project-root))
|
||||
(hash (gethash project-path bower-conf))
|
||||
(package-file (f-expand "bower.json" project-path))
|
||||
deps)
|
||||
|
@ -90,7 +90,7 @@
|
|||
:modes (nodejs-project-mode bower-project-mode)
|
||||
:when
|
||||
(lambda (&rest _)
|
||||
(let* ((project (narf/project-root))
|
||||
(let* ((project (doom/project-root))
|
||||
(bower (gethash project bower-conf))
|
||||
(npm (gethash project npm-conf))
|
||||
(deps (append (cdr-safe (assq 'dependencies bower))
|
||||
|
|
|
@ -15,17 +15,17 @@
|
|||
;; debug
|
||||
"<f9>" 'what-face
|
||||
|
||||
"M-b" 'narf:build
|
||||
"M-t" 'narf:tab-create
|
||||
"M-T" 'narf/tab-display
|
||||
"M-b" 'doom:build
|
||||
"M-t" 'doom:tab-create
|
||||
"M-T" 'doom/tab-display
|
||||
"A-`" 'os-switch-to-term
|
||||
"C-`" 'narf/popup-toggle
|
||||
"C-~" 'narf:repl
|
||||
"C-`" 'doom/popup-toggle
|
||||
"C-~" 'doom:repl
|
||||
|
||||
"M-w" 'narf/close-window-or-tab
|
||||
"M-w" 'doom/close-window-or-tab
|
||||
"M-W" 'delete-frame
|
||||
"M-n" 'narf/new-buffer
|
||||
"M-N" 'narf/new-frame
|
||||
"M-n" 'doom/new-buffer
|
||||
"M-N" 'doom/new-frame
|
||||
|
||||
;; Simpler window navigation
|
||||
"C-j" 'evil-window-down
|
||||
|
@ -33,28 +33,28 @@
|
|||
"C-h" 'evil-window-left
|
||||
"C-l" 'evil-window-right
|
||||
|
||||
"A-j" 'narf/evil-window-resize-d
|
||||
"A-k" 'narf/evil-window-resize-u
|
||||
"A-h" 'narf/evil-window-resize-l
|
||||
"A-l" 'narf/evil-window-resize-r
|
||||
"A-j" 'doom/evil-window-resize-d
|
||||
"A-k" 'doom/evil-window-resize-u
|
||||
"A-h" 'doom/evil-window-resize-l
|
||||
"A-l" 'doom/evil-window-resize-r
|
||||
|
||||
"C-<escape>" 'evil-emacs-state
|
||||
:e "C-<escape>" 'evil-normal-state
|
||||
|
||||
:m "M-1" (λ! (narf:switch-to-tab 0))
|
||||
:m "M-2" (λ! (narf:switch-to-tab 1))
|
||||
:m "M-3" (λ! (narf:switch-to-tab 2))
|
||||
:m "M-4" (λ! (narf:switch-to-tab 3))
|
||||
:m "M-5" (λ! (narf:switch-to-tab 4))
|
||||
:m "M-6" (λ! (narf:switch-to-tab 5))
|
||||
:m "M-7" (λ! (narf:switch-to-tab 6))
|
||||
:m "M-8" (λ! (narf:switch-to-tab 7))
|
||||
:m "M-9" (λ! (narf:switch-to-tab 8))
|
||||
:m "M-1" (λ! (doom:switch-to-tab 0))
|
||||
:m "M-2" (λ! (doom:switch-to-tab 1))
|
||||
:m "M-3" (λ! (doom:switch-to-tab 2))
|
||||
:m "M-4" (λ! (doom:switch-to-tab 3))
|
||||
:m "M-5" (λ! (doom:switch-to-tab 4))
|
||||
:m "M-6" (λ! (doom:switch-to-tab 5))
|
||||
:m "M-7" (λ! (doom:switch-to-tab 6))
|
||||
:m "M-8" (λ! (doom:switch-to-tab 7))
|
||||
:m "M-9" (λ! (doom:switch-to-tab 8))
|
||||
|
||||
(:when IS-MAC
|
||||
"<A-left>" 'backward-word
|
||||
"<A-right>" 'forward-word
|
||||
"<M-backspace>" 'narf/backward-kill-to-bol-and-indent
|
||||
"<M-backspace>" 'doom/backward-kill-to-bol-and-indent
|
||||
"A-SPC" 'just-one-space
|
||||
"M-a" 'mark-whole-buffer
|
||||
"M-c" 'evil-yank
|
||||
|
@ -64,19 +64,19 @@
|
|||
"M-v" 'clipboard-yank
|
||||
"M-z" 'undo
|
||||
"M-Z" 'redo
|
||||
"C-M-f" 'narf:toggle-fullscreen
|
||||
"C-M-f" 'doom:toggle-fullscreen
|
||||
|
||||
:m "M-j" 'narf/multi-next-line
|
||||
:m "M-k" 'narf/multi-previous-line
|
||||
:m "M-j" 'doom/multi-next-line
|
||||
:m "M-k" 'doom/multi-previous-line
|
||||
|
||||
:n "M-r" 'narf:eval-buffer
|
||||
:v "M-r" 'narf:eval-region
|
||||
:n "M-r" 'doom:eval-buffer
|
||||
:v "M-r" 'doom:eval-region
|
||||
|
||||
:ni "<M-f1>" 'narf/dash-at-pt
|
||||
:ni "<M-f1>" 'doom/dash-at-pt
|
||||
|
||||
;; Textmate-esque indent shift left/right
|
||||
:i "M-]" 'narf/smart-indent
|
||||
:i "M-[" 'narf/dumb-dedent
|
||||
:i "M-]" 'doom/smart-indent
|
||||
:i "M-[" 'doom/dumb-dedent
|
||||
|
||||
;; Restore osx text objects
|
||||
:i "<A-backspace>" 'evil-delete-backward-word
|
||||
|
@ -84,7 +84,7 @@
|
|||
|
||||
:m ";" 'evil-ex
|
||||
(:leader
|
||||
:nv "," 'narf/helm-buffers-dwim
|
||||
:nv "," 'doom/helm-buffers-dwim
|
||||
:nv "<" 'helm-buffers-list
|
||||
:nv "." 'helm-find-files
|
||||
:nv ">" 'helm-projectile-find-file-in-known-projects
|
||||
|
@ -100,32 +100,32 @@
|
|||
|
||||
:n "h" 'help-command
|
||||
:nv "p" 'helm-show-kill-ring
|
||||
:n "R" 'narf/reset-theme
|
||||
:n "e" 'narf/flycheck-errors
|
||||
:n "R" 'doom/reset-theme
|
||||
:n "e" 'doom/flycheck-errors
|
||||
:n "s" 'yas-visit-snippet-file
|
||||
:n "S" 'narf/yas-find-file
|
||||
:n "S" 'doom/yas-find-file
|
||||
:n "D" 'vc-annotate
|
||||
(:prefix "d"
|
||||
:n "." 'narf/vcs-show-hunk
|
||||
:n "." 'doom/vcs-show-hunk
|
||||
:n "/" 'vc-diff
|
||||
:n "s" 'narf/vcs-stage-hunk
|
||||
:n "r" 'narf/vcs-revert-hunk)
|
||||
:n "s" 'doom/vcs-stage-hunk
|
||||
:n "r" 'doom/vcs-revert-hunk)
|
||||
|
||||
:n "b" 'helm-bookmarks
|
||||
:nv "l" 'narf/nlinum-toggle
|
||||
:nv "l" 'doom/nlinum-toggle
|
||||
|
||||
:nv "qq" 'evil-save-and-quit
|
||||
:nv "QQ" 'narf/kill-all-buffers-do-not-remember
|
||||
:nv "QQ" 'doom/kill-all-buffers-do-not-remember
|
||||
|
||||
;; Quick access to my dotfiles and emacs.d
|
||||
:nv "E" 'narf/helm-find-in-emacsd
|
||||
:nv "\\" 'narf/helm-find-in-dotfiles
|
||||
:nv "E" 'doom/helm-find-in-emacsd
|
||||
:nv "\\" 'doom/helm-find-in-dotfiles
|
||||
|
||||
;; Tmux
|
||||
(:prefix "t"
|
||||
:n "." 'narf/tmux-cd-to-here
|
||||
:n "/" 'narf/tmux-cd-to-project
|
||||
:v "r" 'narf:tmux)
|
||||
:n "." 'doom/tmux-cd-to-here
|
||||
:n "/" 'doom/tmux-cd-to-project
|
||||
:v "r" 'doom:tmux)
|
||||
|
||||
;; Open with O/S
|
||||
:n "O" 'os-reveal
|
||||
|
@ -141,22 +141,22 @@
|
|||
:n "T" 'os-switch-to-term-and-cd)
|
||||
|
||||
;; Org notes
|
||||
:n "X" 'narf/org
|
||||
:n "X" 'doom/org
|
||||
(:prefix "x"
|
||||
:n "." 'narf/org-find-file
|
||||
:n "/" 'narf/org-find-file-in-notes
|
||||
:n "e" 'narf/org-find-exported-file))
|
||||
:n "." 'doom/org-find-file
|
||||
:n "/" 'doom/org-find-file-in-notes
|
||||
:n "e" 'doom/org-find-exported-file))
|
||||
|
||||
(:localleader
|
||||
:n "\\" 'narf/neotree
|
||||
:n "\\" 'doom/neotree
|
||||
:n "]" 'imenu-list-minor-mode
|
||||
:n "b" 'narf:build
|
||||
:n "R" 'narf:repl
|
||||
:v "R" 'narf:repl-eval
|
||||
:v "r" 'narf:eval-region
|
||||
:n "b" 'doom:build
|
||||
:n "R" 'doom:repl
|
||||
:v "R" 'doom:repl-eval
|
||||
:v "r" 'doom:eval-region
|
||||
(:prefix "r"
|
||||
:n "e" 'emr-show-refactor-menu
|
||||
:n "r" 'narf:eval-buffer))
|
||||
:n "r" 'doom:eval-buffer))
|
||||
|
||||
:nv "K" 'smart-up
|
||||
|
||||
|
@ -164,24 +164,24 @@
|
|||
:n "=" (λ! (save-excursion (call-interactively 'evil-indent)))
|
||||
:v "=" 'evil-indent
|
||||
|
||||
:n "zr" 'narf/evil-open-folds
|
||||
:n "zm" 'narf/evil-close-folds
|
||||
:n "zx" 'narf/kill-real-buffer
|
||||
:n "zr" 'doom/evil-open-folds
|
||||
:n "zm" 'doom/evil-close-folds
|
||||
:n "zx" 'doom/kill-real-buffer
|
||||
:n "ZX" 'bury-buffer
|
||||
|
||||
;; These are intentionally reversed
|
||||
:n "]b" 'narf/next-real-buffer
|
||||
:n "[b" 'narf/previous-real-buffer
|
||||
:n "]b" 'doom/next-real-buffer
|
||||
:n "[b" 'doom/previous-real-buffer
|
||||
|
||||
:m "]d" 'narf/vcs-next-hunk
|
||||
:m "[d" 'narf/vcs-prev-hunk
|
||||
:m "]e" 'narf/flycheck-next-error
|
||||
:m "[e" 'narf/flycheck-previous-error
|
||||
:m "]d" 'doom/vcs-next-hunk
|
||||
:m "[d" 'doom/vcs-prev-hunk
|
||||
:m "]e" 'doom/flycheck-next-error
|
||||
:m "[e" 'doom/flycheck-previous-error
|
||||
;; Switch tabs
|
||||
:n "]w" 'narf:switch-to-tab-right
|
||||
:n "[w" 'narf:switch-to-tab-left
|
||||
:m "gt" 'narf:switch-to-tab-right
|
||||
:m "gT" 'narf:switch-to-tab-left
|
||||
:n "]w" 'doom:switch-to-tab-right
|
||||
:n "[w" 'doom:switch-to-tab-left
|
||||
:m "gt" 'doom:switch-to-tab-right
|
||||
:m "gT" 'doom:switch-to-tab-left
|
||||
|
||||
;; Increment/decrement number under cursor
|
||||
:n "g=" 'evil-numbers/inc-at-pt
|
||||
|
@ -192,17 +192,17 @@
|
|||
(call-interactively 'find-file-at-point)
|
||||
(helm-mode 1))
|
||||
|
||||
:m "gD" 'narf/find-def
|
||||
:n "gp" 'narf/reselect-paste
|
||||
:m "gD" 'doom/find-def
|
||||
:n "gp" 'doom/reselect-paste
|
||||
:n "gc" 'evil-commentary
|
||||
:n "gx" 'evil-exchange
|
||||
:n "gr" 'narf:eval-region
|
||||
:n "gR" 'narf:eval-buffer
|
||||
:v "gR" 'narf:eval-region-and-replace
|
||||
:n "gr" 'doom:eval-region
|
||||
:n "gR" 'doom:eval-buffer
|
||||
:v "gR" 'doom:eval-region-and-replace
|
||||
:m "g]" 'smart-right
|
||||
:m "g[" 'smart-left
|
||||
:v "@" 'narf/evil-macro-on-all-lines
|
||||
:n "g@" 'narf/evil-macro-on-all-lines
|
||||
:v "@" 'doom/evil-macro-on-all-lines
|
||||
:n "g@" 'doom/evil-macro-on-all-lines
|
||||
|
||||
:v "." 'evil-repeat
|
||||
|
||||
|
@ -240,7 +240,7 @@
|
|||
|
||||
;; Textmate-esque newlines
|
||||
:i "<backspace>" 'backward-delete-char-untabify
|
||||
:i "<M-backspace>" 'narf/backward-kill-to-bol-and-indent
|
||||
:i "<M-backspace>" 'doom/backward-kill-to-bol-and-indent
|
||||
:i "<C-return>" 'evil-ret-and-indent
|
||||
|
||||
;; Emacsien motions for insert mode
|
||||
|
@ -256,20 +256,20 @@
|
|||
:n "!" 'rotate-text
|
||||
|
||||
(:map evil-window-map ; prefix "C-w"
|
||||
"u" 'narf/undo-window-change
|
||||
"u" 'doom/undo-window-change
|
||||
|
||||
;; Jump to new splits
|
||||
"s" 'narf/evil-window-split
|
||||
"v" 'narf/evil-window-vsplit
|
||||
"s" 'doom/evil-window-split
|
||||
"v" 'doom/evil-window-vsplit
|
||||
|
||||
;; Move window in one step
|
||||
"H" (λ! (narf/evil-window-move 'left))
|
||||
"J" (λ! (narf/evil-window-move 'down))
|
||||
"K" (λ! (narf/evil-window-move 'up))
|
||||
"L" (λ! (narf/evil-window-move 'right))
|
||||
"H" (λ! (doom/evil-window-move 'left))
|
||||
"J" (λ! (doom/evil-window-move 'down))
|
||||
"K" (λ! (doom/evil-window-move 'up))
|
||||
"L" (λ! (doom/evil-window-move 'right))
|
||||
|
||||
"C-u" 'narf/undo-window-change
|
||||
"C-r" 'narf/redo-window-change
|
||||
"C-u" 'doom/undo-window-change
|
||||
"C-r" 'doom/redo-window-change
|
||||
"C-h" 'evil-window-left
|
||||
"C-j" 'evil-window-down
|
||||
"C-k" 'evil-window-up
|
||||
|
@ -289,17 +289,17 @@
|
|||
|
||||
;; `yasnippet'
|
||||
:i [(tab)] 'yas-expand
|
||||
:v "<backtab>" 'narf/yas-insert-snippet
|
||||
:v "<backtab>" 'doom/yas-insert-snippet
|
||||
|
||||
;; `auto-yasnippet'
|
||||
:i "<C-tab>" 'aya-expand
|
||||
:nv "<C-tab>" 'aya-create
|
||||
|
||||
;; Vim omni-complete emulation
|
||||
:i "C-SPC" 'narf/company-complete
|
||||
:i "C-SPC" 'doom/company-complete
|
||||
(:prefix "C-x"
|
||||
:i "C-l" 'narf/company-whole-lines
|
||||
:i "C-k" 'narf/company-dict-or-keywords
|
||||
:i "C-l" 'doom/company-whole-lines
|
||||
:i "C-k" 'doom/company-dict-or-keywords
|
||||
:i "C-f" 'company-files
|
||||
:i "C-]" 'company-tags
|
||||
:i "s" 'company-ispell
|
||||
|
@ -320,7 +320,7 @@
|
|||
"C-S-s" 'company-search-candidates
|
||||
"C-s" 'company-filter-candidates
|
||||
"C-SPC" 'company-complete-common-or-cycle
|
||||
[tab] 'narf/company-complete-common-or-complete-full
|
||||
[tab] 'doom/company-complete-common-or-complete-full
|
||||
"<backtab>" 'company-select-previous
|
||||
[escape] (λ! (company-abort) (evil-normal-state 1))
|
||||
"<C-return>" 'helm-company)
|
||||
|
@ -331,7 +331,7 @@
|
|||
|
||||
(:after help-mode
|
||||
(:map help-map
|
||||
"e" 'narf/popup-messages)
|
||||
"e" 'doom/popup-messages)
|
||||
(:map help-mode-map
|
||||
:n "]]" 'help-go-forward
|
||||
:n "[[" 'help-go-back)))
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
;;; my-commands.el
|
||||
|
||||
(evil-define-operator narf:evil-ex-global (beg end pattern command &optional invert)
|
||||
(evil-define-operator doom:evil-ex-global (beg end pattern command &optional invert)
|
||||
"Rewritten :g[lobal] that will highlight buffer matches. Takes the same arguments."
|
||||
:motion mark-whole-buffer :move-point nil
|
||||
(interactive "<r><g//><!>")
|
||||
(evil-ex-global beg end pattern command invert))
|
||||
|
||||
(evil-define-operator narf:align (&optional beg end bang pattern)
|
||||
(evil-define-operator doom:align (&optional beg end bang pattern)
|
||||
"Ex interface to `align-regexp'. Accepts vim-style regexps."
|
||||
(interactive "<r><!><//>")
|
||||
(align-regexp
|
||||
|
@ -18,87 +18,87 @@
|
|||
1 1))
|
||||
|
||||
;;; Rewritten commands
|
||||
(ex! "g[lobal]" 'narf:evil-ex-global)
|
||||
(ex! "g[lobal]" 'doom:evil-ex-global)
|
||||
|
||||
;;; Custom commands
|
||||
;; Emacs utilities
|
||||
(ex! "echo" 'narf:echo)
|
||||
(ex! "echo" 'doom:echo)
|
||||
(ex! "minor" 'helm-describe-modes) ; list minor modes
|
||||
;; Quick mapping keys to commands, allows :nmap \m !make
|
||||
(ex! "imap" 'narf:imap)
|
||||
(ex! "mmap" 'narf:mmap)
|
||||
(ex! "nmap" 'narf:nmap)
|
||||
(ex! "omap" 'narf:omap)
|
||||
(ex! "vmap" 'narf:vmap)
|
||||
(ex! "imap" 'doom:imap)
|
||||
(ex! "mmap" 'doom:mmap)
|
||||
(ex! "nmap" 'doom:nmap)
|
||||
(ex! "omap" 'doom:omap)
|
||||
(ex! "vmap" 'doom:vmap)
|
||||
;; Editing
|
||||
(ex! "@" 'narf/evil-macro-on-all-lines)
|
||||
(ex! "al[ign]" 'narf:align)
|
||||
(ex! "htmle[nt]" 'narf/html-entities) ; encode/decode html entities
|
||||
(ex! "@" 'doom/evil-macro-on-all-lines)
|
||||
(ex! "al[ign]" 'doom:align)
|
||||
(ex! "htmle[nt]" 'doom/html-entities) ; encode/decode html entities
|
||||
(ex! "ie[dit]" 'evil-multiedit-ex-match)
|
||||
(ex! "na[rrow]" 'narf:narrow)
|
||||
(ex! "rec[ent]" 'narf:helm-recentf) ; show recent files
|
||||
(ex! "na[rrow]" 'doom:narrow)
|
||||
(ex! "rec[ent]" 'doom:helm-recentf) ; show recent files
|
||||
(ex! "ref[actor]" 'emr-show-refactor-menu)
|
||||
(ex! "reo[rient]" 'narf/window-reorient) ; scroll all windows to left
|
||||
(ex! "retab" 'narf:whitespace-retab)
|
||||
(ex! "settr[im]" 'narf:toggle-delete-trailing-whitespace)
|
||||
(ex! "snip[pets]" 'narf:yas-snippets) ; open snippet
|
||||
(ex! "tsnip[pets]" 'narf:yas-file-templates) ; open file template
|
||||
(ex! "wal[ign]" 'narf:whitespace-align) ; align by spaces
|
||||
(ex! "reo[rient]" 'doom/window-reorient) ; scroll all windows to left
|
||||
(ex! "retab" 'doom:whitespace-retab)
|
||||
(ex! "settr[im]" 'doom:toggle-delete-trailing-whitespace)
|
||||
(ex! "snip[pets]" 'doom:yas-snippets) ; open snippet
|
||||
(ex! "tsnip[pets]" 'doom:yas-file-templates) ; open file template
|
||||
(ex! "wal[ign]" 'doom:whitespace-align) ; align by spaces
|
||||
;; External resources
|
||||
(ex! "dash" 'narf:dash) ; look up in Dash.app
|
||||
(ex! "dash" 'doom:dash) ; look up in Dash.app
|
||||
(ex! "http" 'httpd-start) ; start http server
|
||||
(ex! "re[gex]" 'narf:regex) ; open re-builder
|
||||
(ex! "repl" 'narf:repl) ; invoke or send to repl
|
||||
(ex! "t[mux]" 'narf:tmux) ; send to tmux
|
||||
(ex! "tcd" 'narf:tmux-cd) ; cd to default-directory in tmux
|
||||
(ex! "x" 'narf:send-to-scratch-or-org)
|
||||
(ex! "re[gex]" 'doom:regex) ; open re-builder
|
||||
(ex! "repl" 'doom:repl) ; invoke or send to repl
|
||||
(ex! "t[mux]" 'doom:tmux) ; send to tmux
|
||||
(ex! "tcd" 'doom:tmux-cd) ; cd to default-directory in tmux
|
||||
(ex! "x" 'doom:send-to-scratch-or-org)
|
||||
;; GIT
|
||||
(ex! "ga[dd]" 'narf/vcs-stage-hunk)
|
||||
(ex! "gbr[owse]" 'narf:git-remote-browse) ; show file in github/gitlab
|
||||
(ex! "gre[vert]" 'narf/vcs-revert-hunk)
|
||||
(ex! "ga[dd]" 'doom/vcs-stage-hunk)
|
||||
(ex! "gbr[owse]" 'doom:git-remote-browse) ; show file in github/gitlab
|
||||
(ex! "gre[vert]" 'doom/vcs-revert-hunk)
|
||||
;; Dealing with buffers
|
||||
(ex! "k[ill]" 'narf/kill-real-buffer) ; Kill current buffer
|
||||
(ex! "k[ill]all" 'narf:kill-all-buffers) ; Kill buffers (bang = in project)
|
||||
(ex! "k[ill]b" 'narf:kill-buried-buffers) ; Kill buried buffers
|
||||
(ex! "k[ill]m" 'narf:kill-matching-buffers) ; kill buffers by regexp
|
||||
(ex! "k[ill]o" 'narf:kill-other-buffers) ; kill other buffers
|
||||
(ex! "k[ill]u" 'narf/kill-unreal-buffers) ; kill unreal buffers
|
||||
(ex! "l[ast]" 'narf/popup-last-buffer) ; pop up last popup
|
||||
(ex! "m[sg]" 'narf/popup-messages) ; open *messages* in popup
|
||||
(ex! "k[ill]" 'doom/kill-real-buffer) ; Kill current buffer
|
||||
(ex! "k[ill]all" 'doom:kill-all-buffers) ; Kill buffers (bang = in project)
|
||||
(ex! "k[ill]b" 'doom:kill-buried-buffers) ; Kill buried buffers
|
||||
(ex! "k[ill]m" 'doom:kill-matching-buffers) ; kill buffers by regexp
|
||||
(ex! "k[ill]o" 'doom:kill-other-buffers) ; kill other buffers
|
||||
(ex! "k[ill]u" 'doom/kill-unreal-buffers) ; kill unreal buffers
|
||||
(ex! "l[ast]" 'doom/popup-last-buffer) ; pop up last popup
|
||||
(ex! "m[sg]" 'doom/popup-messages) ; open *messages* in popup
|
||||
;; Project navigation
|
||||
(ex! "a" 'helm-projectile-find-other-file)
|
||||
(ex! "ag" 'narf:helm-ag-search)
|
||||
(ex! "ag[cw]d" 'narf:helm-ag-search-cwd)
|
||||
(ex! "cd" 'narf:cd)
|
||||
(ex! "se[arch]" 'narf:helm-swoop) ; in-file search
|
||||
(ex! "ag" 'doom:helm-ag-search)
|
||||
(ex! "ag[cw]d" 'doom:helm-ag-search-cwd)
|
||||
(ex! "cd" 'doom:cd)
|
||||
(ex! "se[arch]" 'doom:helm-swoop) ; in-file search
|
||||
;; Project tools
|
||||
(ex! "build" 'narf:build)
|
||||
(ex! "ma[ke]" 'narf:build)
|
||||
(ex! "build" 'doom:build)
|
||||
(ex! "ma[ke]" 'doom:build)
|
||||
;; File operations
|
||||
(ex! "mv" 'narf:file-move)
|
||||
(ex! "rm" 'narf:file-delete)
|
||||
(ex! "mv" 'doom:file-move)
|
||||
(ex! "rm" 'doom:file-delete)
|
||||
;; Presentation/demo
|
||||
(ex! "big" 'big-mode)
|
||||
(ex! "full[scr]" 'narf:toggle-fullscreen)
|
||||
(ex! "full[scr]" 'doom:toggle-fullscreen)
|
||||
;; Sessions/tabs
|
||||
(ex! "sl[oad]" 'narf:load-session)
|
||||
(ex! "ss[ave]" 'narf:save-session)
|
||||
(ex! "tabc[lose]" 'narf:kill-tab)
|
||||
(ex! "tabc[lose]o" 'narf:kill-other-tabs)
|
||||
(ex! "tabl[ast]" 'narf:switch-to-tab-last)
|
||||
(ex! "tabn[ew]" 'narf:tab-create)
|
||||
(ex! "tabn[ext]" 'narf:switch-to-tab-right)
|
||||
(ex! "tabp[rev]" 'narf:switch-to-tab-left)
|
||||
(ex! "tabr[ename]" 'narf:tab-rename)
|
||||
(ex! "tabs" 'narf/tab-display)
|
||||
(ex! "sl[oad]" 'doom:load-session)
|
||||
(ex! "ss[ave]" 'doom:save-session)
|
||||
(ex! "tabc[lose]" 'doom:kill-tab)
|
||||
(ex! "tabc[lose]o" 'doom:kill-other-tabs)
|
||||
(ex! "tabl[ast]" 'doom:switch-to-tab-last)
|
||||
(ex! "tabn[ew]" 'doom:tab-create)
|
||||
(ex! "tabn[ext]" 'doom:switch-to-tab-right)
|
||||
(ex! "tabp[rev]" 'doom:switch-to-tab-left)
|
||||
(ex! "tabr[ename]" 'doom:tab-rename)
|
||||
(ex! "tabs" 'doom/tab-display)
|
||||
;; Org-mode
|
||||
(ex! "att[ach]" 'narf:org-attach) ; attach file to org file
|
||||
(ex! "link" 'narf:org-link)
|
||||
(ex! "org" 'narf:org-helm-search) ; search org notes
|
||||
(ex! "att[ach]" 'doom:org-attach) ; attach file to org file
|
||||
(ex! "link" 'doom:org-link)
|
||||
(ex! "org" 'doom:org-helm-search) ; search org notes
|
||||
;; Plugins
|
||||
(ex! "er[rors]" 'narf/flycheck-errors)
|
||||
(ex! "er[rors]" 'doom/flycheck-errors)
|
||||
;; Debuggers
|
||||
(ex! "debug" 'narf:debug)
|
||||
(ex! "debug" 'doom:debug)
|
||||
|
||||
(provide 'my-commands)
|
||||
;;; my-commands.el ends here
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue