Massive refactor. Refactor all the things
This commit is contained in:
parent
03514fc09d
commit
f234be68a4
56 changed files with 792 additions and 831 deletions
53
core/core-company.el
Normal file
53
core/core-company.el
Normal file
|
@ -0,0 +1,53 @@
|
|||
;;; core-company.el
|
||||
|
||||
(use-package company
|
||||
:init
|
||||
(setq company-idle-delay nil
|
||||
company-minimum-prefix-length 2
|
||||
company-tooltip-limit 10
|
||||
company-dabbrev-downcase nil
|
||||
company-dabbrev-ignore-case nil
|
||||
company-dabbrev-code-other-buffers t
|
||||
company-tooltip-align-annotations t
|
||||
company-require-match 'never
|
||||
company-global-modes '(not eshell-mode comint-mode erc-mode message-mode help-mode)
|
||||
company-frontends '(company-pseudo-tooltip-frontend company-echo-metadata-frontend)
|
||||
company-backends '((company-capf company-dabbrev-code) company-dabbrev)
|
||||
|
||||
company-quickhelp-delay nil
|
||||
company-statistics-file (concat narf-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)
|
||||
|
||||
(push 'company-sort-by-occurrence company-transformers)
|
||||
(setq-default company-backends (append '(company-keywords) company-backends))
|
||||
|
||||
(def-company-backend! nxml-mode (nxml yasnippet))
|
||||
|
||||
(define-key company-active-map "\C-w" nil)
|
||||
|
||||
(global-company-mode +1))
|
||||
|
||||
(use-package company-quickhelp
|
||||
:after company
|
||||
:config (company-quickhelp-mode +1))
|
||||
|
||||
(use-package company-statistics
|
||||
:after company
|
||||
:config (company-statistics-mode +1))
|
||||
|
||||
(use-package company-files
|
||||
:commands company-files)
|
||||
|
||||
(use-package company-dict
|
||||
:commands company-dict
|
||||
:config (setq company-dict-dir (concat narf-private-dir "/dict")))
|
||||
|
||||
(use-package company-template
|
||||
:after ac-php-company)
|
||||
|
||||
(provide 'core-company)
|
||||
;;; core-company.el ends here
|
|
@ -1,52 +0,0 @@
|
|||
;;; core-completion.el --- auto completion backend (Company-mode)
|
||||
|
||||
(use-package company
|
||||
:init
|
||||
(setq company-idle-delay nil
|
||||
company-minimum-prefix-length 2
|
||||
company-tooltip-limit 10
|
||||
company-dabbrev-downcase nil
|
||||
company-dabbrev-ignore-case nil
|
||||
company-dabbrev-code-other-buffers t
|
||||
company-tooltip-align-annotations t
|
||||
company-require-match 'never
|
||||
company-global-modes '(not eshell-mode comint-mode erc-mode message-mode help-mode)
|
||||
company-frontends '(company-pseudo-tooltip-frontend
|
||||
company-echo-metadata-frontend)
|
||||
company-backends '((company-capf company-dabbrev-code)
|
||||
company-dabbrev))
|
||||
|
||||
: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)
|
||||
|
||||
(push 'company-sort-by-occurrence company-transformers)
|
||||
(setq-default company-backends (append '(company-keywords) company-backends))
|
||||
|
||||
(define-company-backend! nxml-mode (nxml yasnippet))
|
||||
(define-company-backend! emacs-lisp-mode (elisp yasnippet))
|
||||
|
||||
(define-key company-active-map "\C-w" nil)
|
||||
|
||||
(global-company-mode +1)
|
||||
|
||||
(use-package company-files :commands (company-files))
|
||||
|
||||
;; NOTE: pos-tip.el in Emacs 25+ does not work
|
||||
(use-package company-quickhelp
|
||||
:config
|
||||
(company-quickhelp-mode +1)
|
||||
(setq company-quickhelp-delay nil))
|
||||
|
||||
(use-package company-statistics
|
||||
:config
|
||||
(company-statistics-mode +1)
|
||||
(setq company-statistics-file (concat narf-temp-dir "/company-stats-cache.el"))))
|
||||
|
||||
(use-package company-dict
|
||||
:commands (company-dict)
|
||||
:config (setq company-dict-dir (concat narf-private-dir "/dict")))
|
||||
|
||||
(provide 'core-completion)
|
||||
;;; core-completion.el ends here
|
|
@ -1,35 +0,0 @@
|
|||
;;; core-debug.el
|
||||
|
||||
(after! debug
|
||||
;; For elisp debugging
|
||||
(map! :map debugger-mode-map
|
||||
:n "RET" 'debug-help-follow
|
||||
:n "n" 'debugger-step-through
|
||||
:n "c" 'debugger-continue))
|
||||
|
||||
(use-package realgud
|
||||
:commands (realgud:gdb realgud:trepanjs realgud:bashdb realgud:zshdb)
|
||||
:config
|
||||
(map! :map realgud:shortkey-mode-map
|
||||
:n "j" 'evil-next-line
|
||||
:n "k" 'evil-previous-line
|
||||
:n "h" 'evil-backward-char
|
||||
:n "l" 'evil-forward-char
|
||||
;; FIXME Greedy command buffer always grabs focus
|
||||
:m "n" 'realgud:cmd-next
|
||||
:m "b" 'realgud:cmd-break
|
||||
:m "B" 'realgud:cmd-clear
|
||||
:n "c" 'realgud:cmd-continue)
|
||||
|
||||
;; Temporary Ex commands for the debugger
|
||||
(define-temp-ex-cmd! narf:def-debug-on narf:def-debug-off
|
||||
("n[ext]" . realgud:cmd-next)
|
||||
("s[tep]" . realgud:cmd-step)
|
||||
("b[reak]" . narf: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))
|
||||
|
||||
(provide 'core-debug)
|
||||
;;; core-debug.el ends here
|
|
@ -112,10 +112,10 @@ Examples:
|
|||
(t (user-error "associate! invalid rules for mode [%s] (in %s) (match %s) (files %s)"
|
||||
mode in match files))))))
|
||||
|
||||
(defmacro define-project-type! (name lighter &rest body)
|
||||
(defmacro def-project-type! (name lighter &rest body)
|
||||
"Define a minor mode for a specific framework, library or project type. e.g.
|
||||
|
||||
(define-project-type! angularjs \"angjs\"
|
||||
(def-project-type! angularjs \"angjs\"
|
||||
:modes (js2-mode)
|
||||
:files (\"package.json\"))"
|
||||
(declare (indent 2))
|
||||
|
@ -133,7 +133,7 @@ Examples:
|
|||
(pop body))
|
||||
`(progn
|
||||
(define-minor-mode ,mode
|
||||
"Auto-generated by `define-project-type!'"
|
||||
"Auto-generated by `def-project-type!'"
|
||||
:init-value nil
|
||||
:lighter ,(concat " " lighter)
|
||||
:keymap (make-sparse-keymap)
|
||||
|
@ -146,14 +146,14 @@ Examples:
|
|||
(yas-deactivate-extra-mode ',mode)))))))
|
||||
|
||||
(after! company-dict
|
||||
(add-to-list 'company-dict-minor-mode-list ',mode))
|
||||
(push ',mode company-dict-minor-mode-list))
|
||||
|
||||
,(when build
|
||||
(when (listp build)
|
||||
(setq build (car-safe (cdr-safe build))))
|
||||
(let ((cmd (or (car-safe build) build))
|
||||
(file (car-safe (cdr-safe build))))
|
||||
`(define-builder! ,mode ,cmd ,file)))
|
||||
`(def-builder! ,mode ,cmd ,file)))
|
||||
,(when bind
|
||||
`(map! :map ,mode-map ,bind))
|
||||
|
||||
|
@ -255,7 +255,9 @@ Examples:
|
|||
(let ((dir (or dir (narf/project-root))))
|
||||
(with-current-buffer (get-buffer-create "*scratch*")
|
||||
(setq default-directory dir)
|
||||
(setq header-line-format '(:eval (concat " ∴ " (abbreviate-file-name default-directory)))))))
|
||||
(setq header-line-format
|
||||
'(:eval
|
||||
(concat " ∴ " (abbreviate-file-name default-directory)))))))
|
||||
|
||||
|
||||
;;;; Global Defuns ;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
@ -71,6 +71,10 @@
|
|||
recentf-auto-cleanup 600)
|
||||
(recentf-mode 1)
|
||||
|
||||
;; Let editorconfig handle global whitespace settings
|
||||
(require 'editorconfig)
|
||||
(editorconfig-mode +1)
|
||||
|
||||
|
||||
;;
|
||||
;; Automatic minor modes
|
||||
|
@ -105,12 +109,9 @@ enable multiple minor modes for the same regexp.")
|
|||
;; Modes 'n hooks
|
||||
;;
|
||||
|
||||
(associate! emacs-lisp-mode :match "\\(/Cask\\|\\.\\(el\\|gz\\)\\)$")
|
||||
(associate! makefile-gmake-mode :match "/Makefile$")
|
||||
(associate! nxml-mode :match "\\.plist$")
|
||||
(associate! conf-mode :match "/\\.?editorconfig$")
|
||||
|
||||
(add-hook! special-mode (setq truncate-lines nil))
|
||||
(add-hook! special-mode (setq truncate-lines nil))
|
||||
(add-hook! change-major-mode-hook
|
||||
(when indent-tabs-mode (whitespace-mode +1)))
|
||||
|
||||
|
@ -135,11 +136,11 @@ enable multiple minor modes for the same regexp.")
|
|||
(visual-line-mode)))
|
||||
|
||||
;; Smarter electric-indent
|
||||
(electric-indent-mode -1) ; on by default
|
||||
(electric-indent-mode -1) ; on by default
|
||||
(defvar narf-electric-indent-p nil)
|
||||
(defvar narf-electric-indent-words '())
|
||||
(make-variable-buffer-local 'narf-electric-indent-words)
|
||||
(setq electric-indent-chars '(?\n ?\^?))
|
||||
(defvar narf-electric-indent-p nil)
|
||||
(push (lambda (c)
|
||||
(when (eolp)
|
||||
(save-excursion
|
||||
|
@ -162,43 +163,10 @@ enable multiple minor modes for the same regexp.")
|
|||
(setq winner-boring-buffers narf-ignore-buffers))
|
||||
|
||||
|
||||
;;
|
||||
;; Extra modes
|
||||
;;
|
||||
|
||||
(use-package vimrc-mode :mode ("/\\.?g?vimrc$" "\\.vim$" "/\\.vim/rc/.+$"))
|
||||
;; Data formats
|
||||
(use-package toml-mode :mode "\\.toml$")
|
||||
|
||||
(use-package yaml-mode :mode "\\.ya?ml$"
|
||||
:config
|
||||
(add-hook! yaml-mode (setq electric-indent-chars '(?\n ?: ?-))))
|
||||
|
||||
(use-package json-mode :mode "\\.js\\(on\\|hintrc\\)$"
|
||||
:config
|
||||
(add-hook! json-mode (setq electric-indent-chars '(?\n ?: ?}))))
|
||||
|
||||
(add-hook! (yaml-mode json-mode) 'electric-indent-local-mode)
|
||||
|
||||
;; Configuration formats
|
||||
(use-package dockerfile-mode :mode "/Dockerfile$"
|
||||
:config
|
||||
(define-docset! dockerfile-mode "docker")
|
||||
(define-builder! dockerfile-mode dockerfile-build-buffer "Dockerfile"))
|
||||
|
||||
|
||||
;;
|
||||
;; Plugins
|
||||
;;
|
||||
|
||||
(use-package editorconfig
|
||||
:config
|
||||
;; Don't affect lisp indentation (only `tab-width')
|
||||
(setq editorconfig-indentation-alist
|
||||
(delq (assq 'emacs-lisp-mode editorconfig-indentation-alist)
|
||||
editorconfig-indentation-alist))
|
||||
(editorconfig-mode +1))
|
||||
|
||||
(use-package ace-window
|
||||
:commands ace-window
|
||||
:config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
||||
|
@ -217,8 +185,18 @@ enable multiple minor modes for the same regexp.")
|
|||
(use-package expand-region
|
||||
:commands (er/expand-region er/contract-region er/mark-symbol er/mark-word))
|
||||
|
||||
(use-package dumb-jump
|
||||
:commands (dumb-jump-go dumb-jump-quick-look dumb-jump-back)
|
||||
:config
|
||||
(setq dumb-jump-default-project narf-emacs-dir)
|
||||
(dumb-jump-mode +1))
|
||||
|
||||
(use-package goto-last-change :commands goto-last-change)
|
||||
|
||||
(use-package help-fns+ ; Improved help commands
|
||||
:commands (describe-buffer describe-command describe-file
|
||||
describe-keymap describe-option describe-option-of-type))
|
||||
|
||||
(use-package hideshow
|
||||
:commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p)
|
||||
:config (setq hs-isearch-open t)
|
||||
|
@ -247,6 +225,33 @@ enable multiple minor modes for the same regexp.")
|
|||
(overlay-put ov 'before-string marker-string)
|
||||
(overlay-put ov 'display display-string))))))
|
||||
|
||||
(use-package imenu-list
|
||||
:commands imenu-list-minor-mode
|
||||
:config
|
||||
(setq imenu-list-mode-line-format nil
|
||||
imenu-list-position 'right
|
||||
imenu-list-size 32)
|
||||
|
||||
(map! :map imenu-list-major-mode-map
|
||||
:n [escape] 'narf/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)
|
||||
(evil-set-initial-state 'reb-mode 'insert)
|
||||
:config
|
||||
(setq reb-re-syntax 'string)
|
||||
(map! :map rxt-help-mode-map
|
||||
:n [escape] 'kill-buffer-and-window
|
||||
:map reb-mode-map
|
||||
:n "C-g" 'reb-quit
|
||||
:n [escape] 'reb-quit
|
||||
:n [backtab] 'reb-change-syntax))
|
||||
|
||||
(use-package rotate-text
|
||||
:commands (rotate-text rotate-text-backward)
|
||||
:init
|
||||
|
@ -259,7 +264,7 @@ enable multiple minor modes for the same regexp.")
|
|||
("advice-add" "advice-remove")
|
||||
("add-hook" "add-hook!" "remove-hook"))))
|
||||
:config
|
||||
(add-to-list 'rotate-text-words '("true" "false")))
|
||||
(push '("true" "false") rotate-text-words))
|
||||
|
||||
(use-package smart-forward :commands (smart-up smart-down smart-left smart-right))
|
||||
|
||||
|
@ -295,23 +300,5 @@ enable multiple minor modes for the same regexp.")
|
|||
(sp-with-modes '(xml-mode nxml-mode php-mode)
|
||||
(sp-local-pair "<!--" "-->" :post-handlers '(("| " "SPC")))))
|
||||
|
||||
(use-package help-fns+ ; Improved help commands
|
||||
:commands (describe-buffer describe-command describe-file
|
||||
describe-keymap describe-option describe-option-of-type))
|
||||
|
||||
(use-package re-builder
|
||||
:commands (re-builder reb-mode-buffer-p)
|
||||
:init
|
||||
(add-hook 'reb-mode-hook 'narf|reb-cleanup)
|
||||
(evil-set-initial-state 'reb-mode 'insert)
|
||||
:config
|
||||
(setq reb-re-syntax 'string)
|
||||
(map! :map rxt-help-mode-map
|
||||
:n [escape] 'kill-buffer-and-window
|
||||
:map reb-mode-map
|
||||
:n "C-g" 'reb-quit
|
||||
:n [escape] 'reb-quit
|
||||
:n [backtab] 'reb-change-syntax))
|
||||
|
||||
(provide 'core-editor)
|
||||
;;; core-editor.el ends here
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
;;; core-eval.el
|
||||
|
||||
;; + Running inline code + REPLs (using `quickrun' + `repl-toggle')
|
||||
;; + Almost-universal debugging (with `realgud')
|
||||
;; + Simple code navigation (using `dump-jump' and `imenu-list')
|
||||
;; + A universal tags config (WIP)
|
||||
|
||||
(use-package quickrun
|
||||
:commands (quickrun
|
||||
quickrun-region
|
||||
|
@ -34,5 +39,37 @@
|
|||
:ei "<down>" 'comint-next-input
|
||||
:ei "<up>" 'comint-previous-input))
|
||||
|
||||
;;
|
||||
(after! debug
|
||||
;; For elisp debugging
|
||||
(map! :map debugger-mode-map
|
||||
:n "RET" 'debug-help-follow
|
||||
:n "n" 'debugger-step-through
|
||||
:n "c" 'debugger-continue))
|
||||
|
||||
(use-package realgud
|
||||
:commands (realgud:gdb realgud:trepanjs realgud:bashdb realgud:zshdb)
|
||||
:config
|
||||
(map! :map realgud:shortkey-mode-map
|
||||
:n "j" 'evil-next-line
|
||||
:n "k" 'evil-previous-line
|
||||
:n "h" 'evil-backward-char
|
||||
:n "l" 'evil-forward-char
|
||||
;; FIXME Greedy command buffer always grabs focus
|
||||
:m "n" 'realgud:cmd-next
|
||||
:m "b" 'realgud:cmd-break
|
||||
:m "B" 'realgud:cmd-clear
|
||||
:n "c" 'realgud:cmd-continue)
|
||||
|
||||
;; Temporary Ex commands for the debugger
|
||||
(def-tmp-excmd! narf:def-debug-on narf:def-debug-off
|
||||
("n[ext]" . realgud:cmd-next)
|
||||
("s[tep]" . realgud:cmd-step)
|
||||
("b[reak]" . narf: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))
|
||||
|
||||
(provide 'core-eval)
|
||||
;;; core-eval.el ends here
|
||||
|
|
|
@ -13,39 +13,38 @@
|
|||
|
||||
;; Disable highlights on insert-mode
|
||||
(add-hook 'evil-insert-state-entry-hook 'evil-ex-nohighlight)
|
||||
(setq evil-magic t
|
||||
evil-want-C-u-scroll t
|
||||
evil-ex-visual-char-range t ; column range for ex commands
|
||||
evil-want-visual-char-semi-exclusive t
|
||||
evil-ex-search-vim-style-regexp t
|
||||
evil-ex-interactive-search-highlight 'selected-window
|
||||
evil-echo-state nil
|
||||
evil-ex-substitute-global t
|
||||
evil-insert-skip-empty-lines t
|
||||
|
||||
evil-normal-state-tag "N"
|
||||
evil-insert-state-tag "I"
|
||||
evil-visual-state-tag "V"
|
||||
evil-emacs-state-tag "E"
|
||||
evil-operator-state-tag "O"
|
||||
evil-motion-state-tag "M"
|
||||
evil-replace-state-tag "R"
|
||||
|
||||
;; Color-coded state cursors
|
||||
evil-default-cursor "orange"
|
||||
evil-normal-state-cursor 'box
|
||||
evil-emacs-state-cursor '("cyan" box)
|
||||
evil-insert-state-cursor 'bar
|
||||
evil-visual-state-cursor 'hollow
|
||||
|
||||
;; NOTE: a bug in emacs 25 breaks undoing in evil. See
|
||||
;; https://bitbucket.org/lyro/evil/issues/594/undo-doesnt-behave-like-vim
|
||||
evil-want-fine-undo (if (> emacs-major-version 24) 'fine))
|
||||
|
||||
:config
|
||||
(setq
|
||||
evil-magic t
|
||||
evil-want-C-u-scroll t ; enable C-u for scrolling
|
||||
evil-ex-visual-char-range t ; column range for ex commands
|
||||
evil-want-visual-char-semi-exclusive t
|
||||
evil-ex-search-vim-style-regexp t
|
||||
evil-ex-interactive-search-highlight 'selected-window
|
||||
evil-echo-state nil
|
||||
evil-ex-substitute-global t
|
||||
evil-insert-skip-empty-lines t
|
||||
evil-search-module 'evil-search
|
||||
|
||||
evil-normal-state-tag "N"
|
||||
evil-insert-state-tag "I"
|
||||
evil-visual-state-tag "V"
|
||||
evil-emacs-state-tag "E"
|
||||
evil-operator-state-tag "O"
|
||||
evil-motion-state-tag "M"
|
||||
evil-replace-state-tag "R"
|
||||
|
||||
;; Color-coded state cursors
|
||||
evil-default-cursor "orange"
|
||||
evil-normal-state-cursor 'box
|
||||
evil-emacs-state-cursor '("cyan" box)
|
||||
evil-insert-state-cursor 'bar
|
||||
evil-visual-state-cursor 'hollow)
|
||||
|
||||
;; NOTE: a bug in emacs 25 breaks undoing in evil. See
|
||||
;; https://bitbucket.org/lyro/evil/issues/594/undo-doesnt-behave-like-vim
|
||||
(setq-default evil-want-fine-undo (if (> emacs-major-version 24) 'fine 'no))
|
||||
|
||||
(evil-mode 1)
|
||||
(evil-select-search-module 'evil-search-module 'evil-search)
|
||||
|
||||
(map! :map evil-command-window-mode-map :n [escape] 'kill-buffer-and-window)
|
||||
|
||||
|
@ -56,6 +55,7 @@
|
|||
(debugger-mode . normal)
|
||||
(image-mode . normal)
|
||||
(doc-view-mode . normal)
|
||||
(tabulated-list-mode . emacs)
|
||||
(profile-report-mode . emacs)
|
||||
(Info-mode . emacs)
|
||||
(view-mode . emacs)
|
||||
|
@ -82,7 +82,7 @@
|
|||
(with-selected-window w
|
||||
(unless (derived-mode-p 'comint-mode)
|
||||
(narf/popup-close w)))
|
||||
(narf--popup-remove w)))
|
||||
(narf/popup-remove w)))
|
||||
narf-popup-windows)))
|
||||
|
||||
;; Fix harmless (yet disruptive) error reporting w/ hidden buffers caused by
|
||||
|
@ -96,30 +96,30 @@
|
|||
(add-hook! isearch-mode-end (setq echo-keystrokes 0.02))
|
||||
|
||||
;; Repeat motions with SPC/S-SPC
|
||||
(defmacro define-repeat! (command next-func prev-func)
|
||||
(defmacro def-repeat! (command next-func prev-func)
|
||||
`(defadvice ,command
|
||||
(before ,(intern (format "narf-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)))
|
||||
|
||||
(after! evil-snipe
|
||||
(define-repeat! evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(define-repeat! evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(define-repeat! evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(define-repeat! evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(define-repeat! evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(define-repeat! evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(define-repeat! evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(define-repeat! evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
|
||||
(def-repeat! evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(def-repeat! evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(def-repeat! evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(def-repeat! evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(def-repeat! evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(def-repeat! evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(def-repeat! evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(def-repeat! evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
|
||||
|
||||
(after! evil-visualstar
|
||||
(define-repeat! evil-visualstar/begin-search-forward evil-ex-search-next evil-ex-search-previous)
|
||||
(define-repeat! evil-visualstar/begin-search-backward evil-ex-search-previous evil-ex-search-next))
|
||||
(def-repeat! evil-visualstar/begin-search-forward evil-ex-search-next evil-ex-search-previous)
|
||||
(def-repeat! evil-visualstar/begin-search-backward evil-ex-search-previous evil-ex-search-next))
|
||||
|
||||
(define-repeat! evil-ex-search-next evil-ex-search-next evil-ex-search-previous)
|
||||
(define-repeat! evil-ex-search-previous evil-ex-search-next evil-ex-search-previous)
|
||||
(define-repeat! evil-ex-search-forward evil-ex-search-next evil-ex-search-previous)
|
||||
(define-repeat! evil-ex-search-backward evil-ex-search-next evil-ex-search-previous)
|
||||
(def-repeat! evil-ex-search-next evil-ex-search-next evil-ex-search-previous)
|
||||
(def-repeat! evil-ex-search-previous evil-ex-search-next evil-ex-search-previous)
|
||||
(def-repeat! evil-ex-search-forward evil-ex-search-next evil-ex-search-previous)
|
||||
(def-repeat! evil-ex-search-backward evil-ex-search-next evil-ex-search-previous)
|
||||
|
||||
;; A monkey patch to add all of vim's file ex substitution flags to evil-mode.
|
||||
(defun evil-ex-replace-special-filenames (file-name)
|
||||
|
@ -347,18 +347,17 @@
|
|||
:config
|
||||
(global-evil-surround-mode 1)
|
||||
|
||||
;; Escaped surround characters
|
||||
(setq-default evil-surround-pairs-alist
|
||||
(cons '(?\\ . narf/evil-surround-escaped)
|
||||
evil-surround-pairs-alist))
|
||||
|
||||
(add-hook! org-mode
|
||||
(push '(?l . narf/evil-surround-latex) evil-surround-pairs-alist))
|
||||
(add-hook! emacs-lisp-mode
|
||||
(push '(?\` . ("`" . "'")) evil-surround-pairs-alist))
|
||||
(add-hook! python-mode
|
||||
(push '((?d . ("\"\"\"" . "\"\"\"")))
|
||||
evil-surround-pairs-alist))
|
||||
|
||||
;; Escaped surround characters
|
||||
(setq-default evil-surround-pairs-alist
|
||||
(cons '(?\\ . narf/evil-surround-escaped)
|
||||
evil-surround-pairs-alist)))
|
||||
(push '((?d . ("\"\"\"" . "\"\"\""))) evil-surround-pairs-alist)))
|
||||
|
||||
(use-package evil-visualstar
|
||||
:commands (global-evil-visualstar-mode
|
||||
|
@ -372,12 +371,13 @@
|
|||
:config
|
||||
(setq evil-escape-key-sequence "jk"
|
||||
evil-escape-delay 0.25)
|
||||
(evil-escape-mode +1)
|
||||
|
||||
;; evil-escape causes noticable lag in linewise motions in visual mode, so only enable
|
||||
;; it in insert mode. (I only need jk for insert mode anyway)
|
||||
;; 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))
|
||||
(add-hook 'evil-insert-state-entry-hook 'evil-escape-mode)
|
||||
(add-hook 'evil-insert-state-exit-hook 'narf|evil-escape-disable))
|
||||
(add-hook 'evil-visual-state-entry-hook 'narf|evil-escape-disable)
|
||||
(add-hook 'evil-visual-state-exit-hook 'evil-escape-mode))
|
||||
|
||||
(provide 'core-evil)
|
||||
;;; core-evil.el ends here
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; core-file-templates.el
|
||||
|
||||
(use-package autoinsert
|
||||
:defer t
|
||||
:after yasnippet
|
||||
:init
|
||||
(setq auto-insert-query nil ; Don't prompt before insertion
|
||||
auto-insert-alist '()) ; Tabula rasa
|
||||
|
|
|
@ -9,15 +9,11 @@
|
|||
flycheck-disabled-checkers '(emacs-lisp emacs-lisp-checkdoc make))
|
||||
|
||||
:config
|
||||
(require 'flycheck-package)
|
||||
(flycheck-package-setup)
|
||||
;; fixes Unknown defun property `interactive-only' error by compiling flycheck
|
||||
(let ((path (locate-library "flycheck")))
|
||||
(unless (f-ext? path "elc")
|
||||
(byte-compile-file path)))
|
||||
|
||||
(require 'flycheck-pos-tip)
|
||||
(setq flycheck-pos-tip-timeout 10
|
||||
flycheck-display-errors-delay 0.5)
|
||||
(flycheck-pos-tip-mode +1)
|
||||
|
||||
(evil-initial-state 'flycheck-error-list-mode 'emacs)
|
||||
(map! :map flycheck-error-list-mode-map
|
||||
:n "C-n" 'flycheck-error-list-next-error
|
||||
:n "C-p" 'flycheck-error-list-previous-error
|
||||
|
@ -48,6 +44,17 @@
|
|||
;; "........")
|
||||
))
|
||||
|
||||
(use-package flycheck-package
|
||||
:after flycheck
|
||||
:config (flycheck-package-setup))
|
||||
|
||||
(use-package flycheck-pos-tip
|
||||
:after flycheck
|
||||
:config
|
||||
(setq flycheck-pos-tip-timeout 10
|
||||
flycheck-display-errors-delay 0.5)
|
||||
(flycheck-pos-tip-mode +1))
|
||||
|
||||
(use-package flyspell :commands flyspell-mode)
|
||||
|
||||
(provide 'core-flycheck)
|
||||
|
|
|
@ -77,10 +77,14 @@
|
|||
;; Hide mode-line in helm windows
|
||||
(advice-add 'helm-display-mode-line :override 'narf*helm-hide-header)
|
||||
|
||||
(after! yasnippet (push 'helm-alive-p yas-dont-activate))
|
||||
(after! yasnippet (push 'helm-alive-p yas-dont-activate)))
|
||||
|
||||
(require 'helm-mode)
|
||||
(helm-mode 1))
|
||||
(use-package helm-mode
|
||||
:after helm
|
||||
:config (helm-mode 1))
|
||||
|
||||
(use-package helm-tags
|
||||
:commands (helm-tags-get-tag-file helm-etags-select))
|
||||
|
||||
(use-package helm-bookmark
|
||||
:commands (helm-bookmarks helm-filtered-bookmarks)
|
||||
|
@ -88,6 +92,7 @@
|
|||
|
||||
(use-package helm-projectile
|
||||
:commands (helm-projectile-find-other-file
|
||||
helm-projectile-switch-project
|
||||
helm-projectile-find-file
|
||||
helm-projectile-find-dir))
|
||||
|
||||
|
@ -131,10 +136,10 @@
|
|||
helm-swoop-pre-input-function (lambda () "")))
|
||||
|
||||
(use-package helm-describe-modes :commands helm-describe-modes)
|
||||
(use-package helm-ring :commands helm-show-kill-ring)
|
||||
(use-package helm-semantic :commands helm-semantic-or-imenu)
|
||||
(use-package helm-elisp :commands helm-apropos)
|
||||
(use-package helm-command :commands helm-M-x)
|
||||
(use-package helm-ring :commands helm-show-kill-ring)
|
||||
(use-package helm-semantic :commands helm-semantic-or-imenu)
|
||||
(use-package helm-elisp :commands helm-apropos)
|
||||
(use-package helm-command :commands helm-M-x)
|
||||
|
||||
(provide 'core-helm)
|
||||
;;; core-helm.el ends here
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(interactive)
|
||||
(error "Not yet implemented"))
|
||||
|
||||
(defun define-docset! (&rest _)
|
||||
(defun def-docset! (&rest _)
|
||||
(message "No docset function defined!"))
|
||||
|
||||
(provide 'core-os-linux)
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
(use-package dash-at-point
|
||||
:commands (dash-at-point dash-at-point-with-docset dash-at-point-run-search dash-at-point-guess-docset)
|
||||
:init
|
||||
(defmacro define-docset! (mode docset)
|
||||
(defmacro def-docset! (mode docset)
|
||||
`(add-hook! ,mode (setq-local dash-at-point-docset ,docset))))
|
||||
|
||||
(after! evil
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
(local-set-key [escape escape] 'narf/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)))
|
||||
(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))))
|
||||
|
@ -90,11 +90,6 @@
|
|||
;; Hacks
|
||||
;;
|
||||
|
||||
(after! ert
|
||||
(map! :map ert-results-mode-map
|
||||
[escape] 'quit-window
|
||||
"<escape>" 'quit-window))
|
||||
|
||||
(after! help-mode
|
||||
;; So that help buffer links do not open in the help popup, we need to redefine these
|
||||
;; three button types to use `switch-to-buffer-other-window' rather than
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
;;
|
||||
(use-package ido
|
||||
:defines (flx-ido-mode ido-ubiquitous-debug-mode ido-context-switch-command ido-temp-list)
|
||||
:functions (ido-to-end)
|
||||
:init
|
||||
(setq ido-ignore-buffers
|
||||
|
@ -57,8 +56,8 @@
|
|||
(add-hook 'ido-setup-hook 'narf|ido-setup-home-keybind)
|
||||
:config
|
||||
(add-hook! ido-setup
|
||||
(add-to-list 'ido-ignore-files "\\`.DS_Store$")
|
||||
(add-to-list 'ido-ignore-files "Icon\\?$")
|
||||
(push "\\`.DS_Store$" ido-ignore-files)
|
||||
(push "Icon\\?$" ido-ignore-files)
|
||||
(advice-add 'ido-sort-mtime :override 'narf*ido-sort-mtime)
|
||||
|
||||
(require 'ido-vertical-mode)
|
||||
|
@ -83,7 +82,6 @@
|
|||
neotree-dir
|
||||
neotree-find
|
||||
neo-global--window-exists-p)
|
||||
:functions (neo-buffer--unlock-width neo-buffer--lock-width)
|
||||
:init
|
||||
(setq neo-create-file-auto-open t
|
||||
neo-auto-indent-point t
|
||||
|
@ -115,9 +113,6 @@
|
|||
"r" 'neotree-rename-node
|
||||
"R" 'neotree-change-root))
|
||||
|
||||
(after! projectile
|
||||
(setq projectile-switch-project-action 'neotree-projectile-action))
|
||||
|
||||
;; Shorter pwd in neotree
|
||||
(defun narf*neotree-shorten-pwd (node)
|
||||
(list (abbreviate-file-name (car node))))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; I use workgroups to accomplish two things:
|
||||
;; 1. Vim-like tab emulation (type :tabs to see a list of tabs -- maybe I'll add some
|
||||
;; code to make a permanent frame header to display these some day)
|
||||
;; 2. Session persistence
|
||||
;; 2. Session persistence (with :ss and :sl)
|
||||
|
||||
(defvar narf-wg-frames '()
|
||||
"A list of all the frames opened as separate workgroups. See
|
||||
|
@ -17,19 +17,19 @@ automatically renamed to the project name.")
|
|||
:when (display-graphic-p)
|
||||
:init
|
||||
(setq-default
|
||||
wg-session-file (expand-file-name "workgroups/last" narf-temp-dir)
|
||||
wg-workgroup-directory (expand-file-name "workgroups/" narf-temp-dir)
|
||||
wg-first-wg-name "*untitled*"
|
||||
wg-session-file (concat narf-temp-dir "/workgroups/last")
|
||||
wg-workgroup-directory (concat narf-temp-dir "/workgroups/")
|
||||
wg-first-wg-name "*untitled*"
|
||||
wg-session-load-on-start nil
|
||||
wg-mode-line-display-on nil
|
||||
wg-mode-line-display-on nil
|
||||
wg-mess-with-buffer-list nil
|
||||
wg-emacs-exit-save-behavior 'save ; Options: 'save 'ask nil
|
||||
wg-emacs-exit-save-behavior 'save ; Options: 'save 'ask nil
|
||||
wg-workgroups-mode-exit-save-behavior 'save
|
||||
wg-log-level 0
|
||||
|
||||
;; NOTE: Some of these make workgroup-restoration unstable
|
||||
wg-restore-mark t
|
||||
wg-restore-frame-position nil
|
||||
wg-restore-frame-position t
|
||||
wg-restore-remote-buffers nil
|
||||
wg-restore-scroll-bars nil
|
||||
wg-restore-fringes nil
|
||||
|
@ -46,15 +46,8 @@ automatically renamed to the project name.")
|
|||
|
||||
(add-hook 'emacs-startup-hook 'workgroups-mode)
|
||||
:config
|
||||
(unless (file-exists-p wg-workgroup-directory)
|
||||
(mkdir wg-workgroup-directory))
|
||||
|
||||
;; Remember the set names in between sessions
|
||||
(add-to-list 'savehist-additional-variables 'narf-wg-names)
|
||||
|
||||
(after! projectile
|
||||
;; Create a new workgroup on switch-project
|
||||
(setq projectile-switch-project-action 'narf/wg-projectile-switch-project))
|
||||
(push 'narf-wg-names savehist-additional-variables)
|
||||
|
||||
;; `wg-mode-line-display-on' wasn't enough
|
||||
(advice-add 'wg-change-modeline :override 'ignore)
|
||||
|
@ -62,6 +55,10 @@ automatically renamed to the project name.")
|
|||
;; Don't remember popup and neotree windows
|
||||
(add-hook 'kill-emacs-hook 'narf|wg-cleanup)
|
||||
|
||||
(after! projectile
|
||||
;; Create a new workgroup on switch-project
|
||||
(setq projectile-switch-project-action 'narf/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)
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
?∨ ?∧ ?¬))))
|
||||
|
||||
;; on by default in Emacs 25; I prefer to enable on a mode-by-mode basis, so disable it
|
||||
(when (and (featurep 'eldoc) (>= emacs-major-version 25))
|
||||
(when (and (> emacs-major-version 24) (featurep 'eldoc))
|
||||
(global-eldoc-mode -1))
|
||||
|
||||
;; line highlighting
|
||||
|
@ -118,8 +118,6 @@
|
|||
(add-hook 'evil-visual-state-exit-hook 'narf|hl-line-on)
|
||||
|
||||
;; Hide modeline in help windows
|
||||
(defun narf|hide-mode-line (&rest _)
|
||||
(setq mode-line-format nil))
|
||||
(add-hook 'help-mode-hook 'narf|hide-mode-line)
|
||||
|
||||
;; Highlight TODO/FIXME/NOTE tags
|
||||
|
@ -151,14 +149,14 @@
|
|||
(use-package highlight-indentation
|
||||
:commands (highlight-indentation-mode highlight-indentation-current-column-mode)
|
||||
:init
|
||||
(add-hook! (web-mode nxml-mode yaml-mode json-mode scss-mode
|
||||
(add-hook! (nxml-mode yaml-mode json-mode scss-mode
|
||||
c-mode-common ruby-mode python-mode lua-mode)
|
||||
'highlight-indentation-mode)
|
||||
|
||||
(defun narf/hl-indent-guess-offset ()
|
||||
(when (featurep 'editorconfig)
|
||||
(string-to-int (gethash 'indent_size (editorconfig-get-properties)))))
|
||||
(advice-add 'highlight-indentation-guess-offset :override 'narf/hl-indent-guess-offset)
|
||||
(after! editorconfig
|
||||
(defun narf/hl-indent-guess-offset ()
|
||||
(string-to-int (gethash 'indent_size (editorconfig-get-properties))))
|
||||
(advice-add 'highlight-indentation-guess-offset :override 'narf/hl-indent-guess-offset))
|
||||
|
||||
;; A long-winded method for ensuring whitespace is maintained (so that
|
||||
;; highlight-indentation-mode can display them consistently)
|
||||
|
@ -173,19 +171,6 @@
|
|||
|
||||
(use-package highlight-numbers :commands (highlight-numbers-mode))
|
||||
|
||||
(use-package imenu-list
|
||||
:commands (imenu-list-minor-mode)
|
||||
:config
|
||||
(setq imenu-list-mode-line-format nil
|
||||
imenu-list-position 'right
|
||||
imenu-list-size 35)
|
||||
|
||||
(map! :map imenu-list-major-mode-map
|
||||
:n [escape] 'narf/imenu-list-quit
|
||||
:n "RET" 'imenu-list-goto-entry
|
||||
:n "SPC" 'imenu-list-display-entry
|
||||
:n [tab] 'hs-toggle-hiding))
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:commands rainbow-delimiters-mode
|
||||
:init
|
||||
|
@ -335,7 +320,7 @@
|
|||
|
||||
(spaceline-define-segment *env-version
|
||||
"Shows the environment version of a mode (e.g. pyenv for python or rbenv for ruby).
|
||||
See `define-env-command!' to define one for a mode."
|
||||
See `def-env-command!' to define one for a mode."
|
||||
narf--env-version
|
||||
:when narf--env-version
|
||||
:face other-face
|
||||
|
@ -358,7 +343,6 @@ anzu to be enabled."
|
|||
:skip-alternate t
|
||||
:tight t)
|
||||
|
||||
;; TODO mode-line-iedit-face default face
|
||||
(spaceline-define-segment *iedit
|
||||
"Show the number of matches and what match you're on (or after). Requires iedit."
|
||||
(let ((this-oc (iedit-find-current-occurrence-overlay))
|
||||
|
|
|
@ -17,12 +17,6 @@
|
|||
:config
|
||||
(require 'git-gutter-fringe)
|
||||
|
||||
(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)
|
||||
|
||||
(define-fringe-bitmap 'git-gutter-fr:added
|
||||
[240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240]
|
||||
nil nil 'center)
|
||||
|
@ -33,8 +27,16 @@
|
|||
[0 0 0 0 0 0 0 128 192 224 240 248]
|
||||
nil nil 'center)
|
||||
|
||||
;; Refresh git-gutter on ESC in normal mode
|
||||
(advice-add 'evil-force-normal-state :after 'git-gutter)
|
||||
(add-hook 'focus-in-hook 'git-gutter:update-all-windows))
|
||||
|
||||
(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))
|
||||
|
||||
(after! vc-annotate
|
||||
(evil-set-initial-state 'vc-annotate-mode 'normal)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; core-yasnippet.el --- For the lazy typist
|
||||
;;; core-yasnippet.el
|
||||
|
||||
(use-package yasnippet
|
||||
:mode ("emacs\\.d/private/\\(snippets\\|templates\\)/.+$" . snippet-mode)
|
||||
|
|
|
@ -172,11 +172,6 @@ gets killed.")
|
|||
async-wait
|
||||
async-inject-variables))
|
||||
|
||||
(require (cond (IS-MAC 'core-os-osx)
|
||||
(IS-LINUX 'core-os-linux)
|
||||
(IS-WINDOWS 'core-os-win32)))
|
||||
|
||||
|
||||
;;
|
||||
;; We add this to `after-init-hook' to allow errors to stop this advice
|
||||
(add-hook! after-init
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
;;; defuns-popups.el
|
||||
|
||||
(defun narf--popup-remove (window)
|
||||
;;;###autoload
|
||||
(defun narf/popup-remove (window)
|
||||
(setq narf-popup-windows (delete window narf-popup-windows)))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -8,7 +9,7 @@
|
|||
"Whether WINDOW is a shackle popup window or not."
|
||||
(and narf-popup-windows
|
||||
(-any? (lambda (w)
|
||||
(if (window-live-p w) t (narf--popup-remove w) nil))
|
||||
(if (window-live-p w) t (narf/popup-remove w) nil))
|
||||
narf-popup-windows)
|
||||
(if window
|
||||
(-any? (lambda (w) (eq window w)) narf-popup-windows)
|
||||
|
@ -39,7 +40,7 @@
|
|||
((eq major-mode 'messages-buffer-mode)
|
||||
(bury-buffer)
|
||||
(setq dont-kill t)))
|
||||
(narf--popup-remove window)
|
||||
(narf/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))))
|
||||
|
|
|
@ -20,10 +20,6 @@ determine if a directory is a project."
|
|||
(file-exists-p file)))))
|
||||
found-p))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/project-name (&optional root)
|
||||
(file-name-nondirectory (directory-file-name (or root (narf/project-root)))))
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'narf/project-p 'projectile-project-p)
|
||||
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
|
||||
;;;###autoload (autoload 'narf:build "defuns-quickrun" nil t)
|
||||
(evil-define-command narf: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."
|
||||
"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)
|
||||
(user-error "No build command was set"))
|
||||
|
@ -34,6 +33,7 @@ If ARG is nil this function calls `recompile', otherwise it calls
|
|||
;;;; Code running ;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;###autoload (autoload 'narf:eval-buffer "defuns-quickrun" nil t)
|
||||
(evil-define-command narf:eval-buffer ()
|
||||
"Evaluate the whole buffer."
|
||||
:move-point nil :repeat nil
|
||||
(interactive)
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
|
@ -42,26 +42,27 @@ If ARG is nil this function calls `recompile', otherwise it calls
|
|||
|
||||
;;;###autoload (autoload 'narf:eval-region "defuns-quickrun" nil t)
|
||||
(evil-define-operator narf: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
|
||||
(interactive "<r>")
|
||||
(cond ((eq major-mode 'emacs-lisp-mode)
|
||||
(require 'pp)
|
||||
(let* ((pp-escape-newlines nil)
|
||||
(out (s-trim (pp-to-string (eval (read (buffer-substring-no-properties beg end))))))
|
||||
(out (pp-to-string (eval (read (buffer-substring-no-properties beg end)))))
|
||||
(lines (length (s-lines out))))
|
||||
(if (< lines 5)
|
||||
(princ out t)
|
||||
(let ((buf (get-buffer-create "*eval*")))
|
||||
(with-current-buffer buf
|
||||
(read-only-mode -1)
|
||||
(emacs-lisp-mode)
|
||||
(setq-local scroll-margin 0)
|
||||
(erase-buffer)
|
||||
(insert out)
|
||||
(goto-char (point-min))
|
||||
(read-only-mode 1)
|
||||
(narf|hide-mode-line)
|
||||
(narf/popup-buffer buf))))))
|
||||
(with-current-buffer (get-buffer-create "*eval*")
|
||||
;; (rename-buffer (buffer-name old-buf))
|
||||
(read-only-mode -1)
|
||||
(setq-local scroll-margin 0)
|
||||
(emacs-lisp-mode)
|
||||
(erase-buffer)
|
||||
(insert out)
|
||||
(read-only-mode 1)
|
||||
(goto-char (point-min))
|
||||
(narf/popup-buffer (current-buffer))))))
|
||||
(t (quickrun-region beg end))))
|
||||
|
||||
;;;###autoload (autoload 'narf:eval-region-and-replace "defuns-quickrun" nil t)
|
||||
|
|
|
@ -62,8 +62,7 @@ end file."
|
|||
(start (or start (point-min))))
|
||||
(goto-char start)
|
||||
(while (and (re-search-forward "^$" end-marker t) (not (>= (point) end-marker)))
|
||||
(let (line-start line-end
|
||||
next-start next-end)
|
||||
(let (line-start line-end next-start next-end)
|
||||
(save-excursion
|
||||
;; Check previous line indent
|
||||
(forward-line -1)
|
||||
|
@ -79,7 +78,7 @@ end file."
|
|||
(let* ((line-indent (- line-end line-start))
|
||||
(next-indent (- next-end next-start))
|
||||
(indent (min line-indent next-indent)))
|
||||
(insert (make-string indent ? )))))
|
||||
(insert (make-string (if (zerop indent) 0 (1+ indent)) ? )))))
|
||||
(forward-line 1)))))
|
||||
(set-buffer-modified-p nil))
|
||||
nil)
|
||||
|
@ -93,5 +92,9 @@ end file."
|
|||
(imenu-list-minor-mode -1))))
|
||||
(narf/get-visible-buffers (narf/get-real-buffers))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf|hide-mode-line (&rest _)
|
||||
(setq mode-line-format nil))
|
||||
|
||||
(provide 'defuns-ui)
|
||||
;;; defuns-ui.el ends here
|
||||
|
|
|
@ -8,7 +8,11 @@
|
|||
|
||||
;;;###autoload
|
||||
(defun narf/wg-projectile-switch-project ()
|
||||
(narf:workgroup-new nil (file-name-nondirectory (directory-file-name (narf/project-root))) t))
|
||||
(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)
|
||||
(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)
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
;; for ../core-company.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro define-company-backend! (hook backends)
|
||||
(defmacro def-company-backend! (hooks backends)
|
||||
"Register a company backend for a mode."
|
||||
(let ((def-name (intern (format "narf--init-company-%s" hook)))
|
||||
(quoted (eq (car-safe backends) 'quote)))
|
||||
(let* ((hooks (if (listp hooks) hooks (list hooks)))
|
||||
(def-name (intern (format "narf--init-company-%s"
|
||||
(s-join "-" (mapcar 'symbol-name hooks)))))
|
||||
(quoted (eq (car-safe backends) 'quote)))
|
||||
`(progn
|
||||
(defun ,def-name ()
|
||||
(set (make-local-variable 'company-backends)
|
||||
|
@ -15,7 +17,7 @@
|
|||
(intern (format "company-%s" backend))))
|
||||
(if quoted (cadr backends) backends))))
|
||||
company-backends)))
|
||||
(add-hook ',(intern (format "%s-hook" hook)) ',def-name))))
|
||||
(add-hook! ,hooks ',def-name))))
|
||||
|
||||
(provide 'macros-company)
|
||||
;;; macros-company.el ends here
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; macros-evil.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro define-text-object! (key start-regex end-regex)
|
||||
(defmacro def-textobj! (key start-regex end-regex)
|
||||
(let ((inner-name (make-symbol "narf--inner-name"))
|
||||
(outer-name (make-symbol "narf--outer-name")))
|
||||
`(progn
|
||||
|
@ -13,7 +13,7 @@
|
|||
(define-key evil-outer-text-objects-map ,key (quote ,outer-name)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro define-temp-ex-cmd! (cmd-on cmd-off &rest commands)
|
||||
(defmacro def-tmp-excmd! (cmd-on cmd-off &rest commands)
|
||||
"Creates on-off defuns for a set of ex commands, named CMD-ON and CMD-OFF."
|
||||
(declare (indent 2))
|
||||
`(progn
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; macros-quickrun.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro define-builder! (mode command &optional build-file)
|
||||
(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."
|
||||
`(add-hook! ,mode
|
||||
|
@ -10,7 +10,7 @@ additional check to make sure they exist in the project root."
|
|||
(setq narf--build-command '(,command . ,build-file)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro define-repl! (mode command)
|
||||
(defmacro def-repl! (mode command)
|
||||
`(push '(,mode . ,command) rtog/mode-repl-alist))
|
||||
|
||||
(provide 'macros-quickrun)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
;;; defuns-spaceline.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro define-env-command! (mode command)
|
||||
(defmacro def-env-command! (mode command)
|
||||
"Define a COMMAND for MODE that will set `narf--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:
|
||||
|
||||
(define-env-command! ruby-mode \"ruby --version | cut -d' ' -f2\")
|
||||
(def-env-command! 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."
|
||||
|
|
|
@ -2,15 +2,14 @@
|
|||
;; for ../core-yasnippet.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro add-yas-minor-mode! (mode)
|
||||
(defmacro def-yas-mode! (mode)
|
||||
"Register minor MODES in yasnippet."
|
||||
`(after! yasnippet
|
||||
(when (boundp 'yas--extra-modes)
|
||||
(add-hook ',(intern (concat (symbol-name (cadr mode)) "-hook"))
|
||||
(lambda ()
|
||||
(if (symbol-value ,mode)
|
||||
(yas-activate-extra-mode ,mode)
|
||||
(yas-deactivate-extra-mode ,mode)))))))
|
||||
(add-hook! ,mode
|
||||
(if (symbol-value ,mode)
|
||||
(yas-activate-extra-mode ,mode)
|
||||
(yas-deactivate-extra-mode ,mode))))))
|
||||
|
||||
(provide 'macros-yasnippet)
|
||||
;;; macros-yasnippet.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue