General cleanup; core-file-templates -> core-autoinsert
This commit is contained in:
parent
5999c1d5a2
commit
70b4f0d188
10 changed files with 216 additions and 188 deletions
|
@ -73,6 +73,11 @@
|
|||
(setq narf-current-theme narf-default-theme
|
||||
narf-current-font narf-default-font)
|
||||
;; Here we a'go!
|
||||
(mapc 'require packages)))
|
||||
(mapc 'require packages)
|
||||
|
||||
(when (display-graphic-p)
|
||||
(require 'server)
|
||||
(unless (server-running-p)
|
||||
(server-start)))))
|
||||
|
||||
;;; bootstrap.el ends here
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; core-file-templates.el
|
||||
;;; core-autoinsert.el
|
||||
|
||||
(use-package autoinsert
|
||||
:after yasnippet
|
||||
|
@ -99,5 +99,5 @@
|
|||
("\\.z?sh$" "__" sh-mode)
|
||||
)))
|
||||
|
||||
(provide 'core-file-templates)
|
||||
;;; core-file-templates.el ends here
|
||||
(provide 'core-autoinsert)
|
||||
;;; core-autoinsert.el ends here
|
|
@ -59,11 +59,13 @@ Examples:
|
|||
(list func-or-forms)))
|
||||
(forms '()))
|
||||
(mapc
|
||||
(lambda (f) (let ((func (cond ((symbolp f) `(quote ,f))
|
||||
(lambda (f)
|
||||
(let ((func (cond ((symbolp f) `(quote ,f))
|
||||
(t `(lambda (&rest _) ,@func-or-forms)))))
|
||||
(mapc
|
||||
(lambda (h) (push `(add-hook ',(if quoted h (intern (format "%s-hook" h))) ,func) forms))
|
||||
(if (listp hook) hook (list hook))))) funcs)
|
||||
(lambda (h)
|
||||
(push `(add-hook ',(if quoted h (intern (format "%s-hook" h))) ,func) forms))
|
||||
(-list hook)))) funcs)
|
||||
`(progn ,@forms)))
|
||||
|
||||
(defmacro associate! (mode &rest rest)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
require-final-newline t
|
||||
delete-trailing-lines nil
|
||||
fill-column 90
|
||||
fill-column 80
|
||||
line-spacing 0
|
||||
word-wrap t
|
||||
truncate-lines t
|
||||
|
@ -55,8 +55,9 @@
|
|||
(with-demoted-errors
|
||||
(when (boundp list)
|
||||
(set list (mapcar #'substring-no-properties (eval list))))))
|
||||
'(kill-ring minibuffer-history helm-grep-history helm-ff-history file-name-history
|
||||
read-expression-history extended-command-history evil-ex-history)))
|
||||
'(kill-ring minibuffer-history helm-grep-history helm-ff-history
|
||||
file-name-history read-expression-history extended-command-history
|
||||
evil-ex-history)))
|
||||
(add-hook 'kill-emacs-hook #'unpropertize-savehist)
|
||||
(add-hook 'savehist-save-hook #'unpropertize-savehist)
|
||||
|
||||
|
@ -64,8 +65,8 @@
|
|||
(require 'recentf)
|
||||
(setq recentf-save-file (concat narf-temp-dir "/recentf")
|
||||
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
||||
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$" "wg-default"
|
||||
"/company-statistics-cache.el$")
|
||||
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$"
|
||||
"wg-default" "/company-statistics-cache.el$")
|
||||
recentf-max-menu-items 0
|
||||
recentf-max-saved-items 250
|
||||
recentf-auto-cleanup 600)
|
||||
|
@ -75,9 +76,10 @@
|
|||
(use-package editorconfig
|
||||
:config
|
||||
(editorconfig-mode +1)
|
||||
(associate! editorconfig-conf-mode :match "/\\.?editorconfig$")
|
||||
;; So whitespace in tabs indentation mode
|
||||
(add-hook! 'editorconfig-custom-hooks (if indent-tabs-mode (whitespace-mode +1)))
|
||||
(associate! editorconfig-conf-mode :match "/\\.?editorconfig$"))
|
||||
(add-hook! 'editorconfig-custom-hooks
|
||||
(if indent-tabs-mode (whitespace-mode +1))))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -145,7 +147,8 @@ enable multiple minor modes for the same regexp.")
|
|||
(when (and (eolp) narf-electric-indent-words)
|
||||
(save-excursion
|
||||
(backward-word)
|
||||
(looking-at-p (concat "\\<" (regexp-opt narf-electric-indent-words))))))
|
||||
(looking-at-p
|
||||
(concat "\\<" (regexp-opt narf-electric-indent-words))))))
|
||||
electric-indent-functions)
|
||||
|
||||
;;
|
||||
|
@ -219,8 +222,10 @@ enable multiple minor modes for the same regexp.")
|
|||
(display-string (format " ... " (count-lines (overlay-start ov)
|
||||
(overlay-end ov)))))
|
||||
(put-text-property 0 1 'display
|
||||
(list 'right-fringe 'hs-marker 'hs-fringe-face) marker-string)
|
||||
(put-text-property 0 (length display-string) 'face 'hs-face display-string)
|
||||
(list 'right-fringe 'hs-marker 'hs-fringe-face)
|
||||
marker-string)
|
||||
(put-text-property 0 (length display-string)
|
||||
'face 'hs-face display-string)
|
||||
(overlay-put ov 'before-string marker-string)
|
||||
(overlay-put ov 'display display-string))))))
|
||||
|
||||
|
@ -255,7 +260,8 @@ enable multiple minor modes for the same regexp.")
|
|||
:commands (rotate-text rotate-text-backward)
|
||||
:config (push '("true" "false") rotate-text-words))
|
||||
|
||||
(use-package smart-forward :commands (smart-up smart-down smart-left smart-right))
|
||||
(use-package smart-forward
|
||||
:commands (smart-up smart-down smart-left smart-right))
|
||||
|
||||
(use-package smartparens
|
||||
:config
|
||||
|
@ -281,8 +287,11 @@ enable multiple minor modes for the same regexp.")
|
|||
(sp-pair "[" nil :post-handlers '(("| " " "))
|
||||
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
|
||||
(sp-local-pair 'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
|
||||
(sp-local-pair '(sh-mode markdown-mode) "`" "`" :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
(sp-local-pair
|
||||
'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
|
||||
(sp-local-pair
|
||||
'(sh-mode markdown-mode) "`" "`"
|
||||
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
(sp-with-modes '(xml-mode nxml-mode php-mode)
|
||||
(sp-local-pair "<!--" "-->" :post-handlers '(("| " "SPC")))))
|
||||
|
||||
|
|
|
@ -92,7 +92,8 @@
|
|||
;; Fix harmless (yet disruptive) error reporting w/ hidden buffers caused by
|
||||
;; workgroups killing windows
|
||||
;; TODO Delete timer on dead windows
|
||||
(defadvice evil-ex-hl-do-update-highlight (around evil-ex-hidden-buffer-ignore-errors activate)
|
||||
(defadvice evil-ex-hl-do-update-highlight
|
||||
(around evil-ex-hidden-buffer-ignore-errors activate)
|
||||
(ignore-errors ad-do-it))
|
||||
|
||||
;; Hide keystroke display while isearch is active
|
||||
|
@ -110,8 +111,10 @@
|
|||
(def-repeat! evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
|
||||
|
||||
(after! evil-visualstar
|
||||
(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))
|
||||
(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))
|
||||
|
||||
(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)
|
||||
|
|
|
@ -81,9 +81,12 @@
|
|||
(global-eldoc-mode -1))
|
||||
|
||||
;; Highlight TODO/FIXME/NOTE tags
|
||||
(defface narf-todo-face '((t (:inherit font-lock-warning-face))) "Face for TODOs")
|
||||
(defface narf-fixme-face '((t (:inherit font-lock-warning-face))) "Face for FIXMEs")
|
||||
(defface narf-note-face '((t (:inherit font-lock-warning-face))) "Face for NOTEs")
|
||||
(defface narf-todo-face '((t (:inherit font-lock-warning-face)))
|
||||
"Face for TODOs")
|
||||
(defface narf-fixme-face '((t (:inherit font-lock-warning-face)))
|
||||
"Face for FIXMEs")
|
||||
(defface narf-note-face '((t (:inherit font-lock-warning-face)))
|
||||
"Face for NOTEs")
|
||||
(add-hook! (prog-mode emacs-lisp-mode)
|
||||
(font-lock-add-keywords
|
||||
nil '(("\\<\\(TODO\\((.+)\\)?:?\\)" 1 'narf-todo-face prepend)
|
||||
|
@ -125,16 +128,16 @@
|
|||
visual-fill-column-width fill-column))
|
||||
|
||||
(use-package highlight-indentation
|
||||
:commands (highlight-indentation-mode highlight-indentation-current-column-mode)
|
||||
:commands (highlight-indentation-mode
|
||||
highlight-indentation-current-column-mode)
|
||||
:init
|
||||
(add-hook! (nxml-mode yaml-mode json-mode scss-mode
|
||||
c-mode-common ruby-mode python-mode lua-mode)
|
||||
'highlight-indentation-mode)
|
||||
|
||||
(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))
|
||||
(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)
|
||||
|
@ -160,17 +163,19 @@
|
|||
(use-package rainbow-mode
|
||||
:commands (rainbow-mode)
|
||||
:init
|
||||
;; NOTE: hl-line-mode and rainbow-mode don't play well together
|
||||
(add-hook! (sass-mode scss-mode less-css-mode) '(rainbow-mode narf|hl-line-off)))
|
||||
;; hl-line-mode and rainbow-mode don't play well together
|
||||
(add-hook! (sass-mode scss-mode less-css-mode)
|
||||
'(rainbow-mode narf|hl-line-off)))
|
||||
|
||||
(use-package nlinum
|
||||
:commands nlinum-mode
|
||||
:preface
|
||||
(defface linum-highlight-face '((t (:inherit linum))) "Face for line highlights")
|
||||
(setq linum-format "%3d ")
|
||||
(defvar nlinum-format "%4d ")
|
||||
(defvar narf--hl-nlinum-overlay nil)
|
||||
(defvar narf--hl-nlinum-line nil)
|
||||
(defvar nlinum-format "%4d ")
|
||||
(setq linum-format "%3d ")
|
||||
(defface linum-highlight-face '((t (:inherit linum)))
|
||||
"Face for line highlights")
|
||||
:init
|
||||
(add-hook!
|
||||
(markdown-mode prog-mode scss-mode web-mode conf-mode)
|
||||
|
@ -202,10 +207,11 @@
|
|||
|
||||
;; Custom modeline segments
|
||||
(spaceline-define-segment *buffer-path
|
||||
(concat (when buffer-file-name
|
||||
(concat
|
||||
(when buffer-file-name
|
||||
(powerline-raw
|
||||
(f-dirname
|
||||
(let ((buffer-path (file-relative-name buffer-file-name (narf/project-root)))
|
||||
(let ((buffer-path (f-relative buffer-file-name (narf/project-root)))
|
||||
(max-length (truncate (/ (window-body-width) 1.75))))
|
||||
(concat (projectile-project-name) "/"
|
||||
(if (> (length buffer-path) max-length)
|
||||
|
@ -257,7 +263,8 @@
|
|||
"Version control info"
|
||||
(when (and active vc-mode)
|
||||
(powerline-raw
|
||||
(substring vc-mode (+ 1 (length (symbol-name (vc-backend buffer-file-name)))))
|
||||
(substring
|
||||
vc-mode (1+ (length (symbol-name (vc-backend buffer-file-name)))))
|
||||
other-face))
|
||||
:tight-right t)
|
||||
|
||||
|
@ -278,12 +285,14 @@ anzu to be enabled."
|
|||
:tight t)
|
||||
|
||||
(spaceline-define-segment *iedit
|
||||
"Show the number of matches and what match you're on (or after). Requires iedit."
|
||||
"Show the number of matches and what match you're on (or after). Requires
|
||||
iedit."
|
||||
(when (bound-and-true-p iedit-mode)
|
||||
(propertize
|
||||
(let ((this-oc (iedit-find-current-occurrence-overlay))
|
||||
(length (or (ignore-errors (length iedit-occurrences-overlays)) 0)))
|
||||
(format " %s/%s "
|
||||
(format
|
||||
" %s/%s "
|
||||
(save-excursion
|
||||
(unless this-oc
|
||||
(iedit-prev-occurrence)
|
||||
|
@ -390,18 +399,21 @@ anzu to be enabled."
|
|||
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))
|
||||
;; (fi (narf--flycheck-count 'info))
|
||||
)
|
||||
(let ((fe (narf/-flycheck-count 'error))
|
||||
(fw (narf/-flycheck-count 'warning)))
|
||||
(concat
|
||||
(if fe (propertize (format " ⚠%s " fe) 'face (if active 'spaceline-flycheck-error 'mode-line)))
|
||||
(if fw (propertize (format " ⚠%s " fw) 'face (if active 'spaceline-flycheck-warning 'mode-line)))
|
||||
;; (if fi (propertize (format " ⚠%s " fi) 'face 'spaceline-flycheck-info))
|
||||
))))))
|
||||
(if fe (propertize (format " ⚠%s " fe)
|
||||
'face (if active
|
||||
'spaceline-flycheck-error
|
||||
'mode-line)))
|
||||
(if fw (propertize (format " ⚠%s " fw)
|
||||
'face (if active
|
||||
'spaceline-flycheck-warning
|
||||
'mode-line)))))))))
|
||||
:tight t)
|
||||
|
||||
(defvar narf--mode-line-padding (pl/percent-xpm powerline-height 100 0 100 0 1 nil nil))
|
||||
(defvar narf--mode-line-padding
|
||||
(pl/percent-xpm powerline-height 100 0 100 0 1 nil nil))
|
||||
(spaceline-define-segment *pad
|
||||
"Padding, to ensure the mode-line is `powerline-height' pixels tall"
|
||||
narf--mode-line-padding
|
||||
|
|
50
core/core.el
50
core/core.el
|
@ -2,16 +2,16 @@
|
|||
;;
|
||||
;;; 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
|
||||
;; 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
|
||||
;;
|
||||
;; You will find all autoloaded function in {core,modules}/defuns/defuns-*.el
|
||||
;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el
|
||||
;;
|
||||
;;;
|
||||
|
||||
|
@ -95,22 +95,25 @@
|
|||
ignored when using `narf:next-real-buffer' and `narf:previous-real-buffer', and
|
||||
killed by `narf/kill-unreal-buffers'.
|
||||
|
||||
`narf:kill-this-buffer' will also gloss over these buffers when finding a new
|
||||
`narf/kill-real-buffer' will also gloss over these buffers when finding a new
|
||||
buffer to display.")
|
||||
|
||||
(defvar narf-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
|
||||
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
|
||||
"*Buffer List*" "*Ibuffer*" "*esh command on file*"
|
||||
"*WoMan-Log*" "*compilation*" "*use-package*"
|
||||
"*quickrun*" "*eclim: problems*" "*Flycheck errors*"
|
||||
"*popwin-dummy*" "*NeoTree*" " *NeoTree*"
|
||||
"*Buffer List*" "*Ibuffer*" "*NeoTree*" "
|
||||
*NeoTree*" "*esh command on file*" "*WoMan-Log*"
|
||||
"*compilation*" "*use-package*" "*quickrun*"
|
||||
"*eclim: problems*" "*Flycheck errors*"
|
||||
"*popwin-dummy*"
|
||||
;; Helm
|
||||
"*helm*" "*helm recentf*" "*helm projectile*" "*helm imenu*"
|
||||
"*helm company*" "*helm buffers*" "*Helm Css SCSS*"
|
||||
"*helm-ag*" "*helm-ag-edit*" "*Helm Swoop*"
|
||||
"*helm M-x*" "*helm mini*" "*Helm Completions*"
|
||||
"*Helm Find Files*" "*helm mu*" "*helm mu contacts*"
|
||||
"*helm-mode-describe-variable*" "*helm-mode-describe-function*"
|
||||
"*helm*" "*helm recentf*" "*helm projectile*"
|
||||
"*helm imenu*" "*helm company*" "*helm buffers*"
|
||||
"*Helm Css SCSS*" "*helm-ag*" "*helm-ag-edit*"
|
||||
"*Helm Swoop*" "*helm M-x*" "*helm mini*"
|
||||
"*Helm Completions*" "*Helm Find Files*"
|
||||
"*helm mu*" "*helm mu contacts*"
|
||||
"*helm-mode-describe-variable*"
|
||||
"*helm-mode-describe-function*"
|
||||
;; Org
|
||||
"*Org todo*" "*Org Links*" "*Agenda Commands*")
|
||||
"List of buffer names to ignore when using `winner-undo', or `winner-redo'")
|
||||
|
@ -129,7 +132,7 @@ gets killed.")
|
|||
"gulpfile.js" "Gruntfile.js" "bower.json" "composer.json" "Cargo.toml"
|
||||
"mix.exs")
|
||||
"A list of files that count as 'project files', which determine whether a
|
||||
folder is the root of a project or not.")
|
||||
folder is the root of a project or not.")
|
||||
|
||||
;; Fringe/margins
|
||||
(defvar narf-fringe-size 6 "Default width to use for the fringes.")
|
||||
|
@ -181,11 +184,6 @@ gets killed.")
|
|||
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
||||
(cl-flet ((process-list ())) ad-do-it)))
|
||||
|
||||
(when (display-graphic-p)
|
||||
(require 'server)
|
||||
(unless (server-running-p)
|
||||
(server-start)))
|
||||
|
||||
(defun display-startup-echo-area-message ()
|
||||
(message ":: Loaded in %s" (emacs-init-time)))
|
||||
|
||||
|
|
4
init.el
4
init.el
|
@ -63,7 +63,7 @@
|
|||
core-editor ; filling the editor-shaped hole in the emacs OS
|
||||
core-company ; for the lazy typist
|
||||
core-yasnippet ; for the lazier typist
|
||||
core-file-templates ; for the laziest typist
|
||||
core-autoinsert ; for the laziest typist
|
||||
core-flycheck ; get tazed for every semicolon you forget
|
||||
core-project ; whose project am I in?
|
||||
core-vcs ; remember remember, that commit in November
|
||||
|
@ -72,7 +72,7 @@
|
|||
core-eval ; run code, run; debug too
|
||||
|
||||
;; Environments
|
||||
module-apple ; Applescript, Swift, Launchbar, iOS, wallet syphons, etc.
|
||||
module-apple ; Applescript, Swift, Launchbar & other wallet syphons
|
||||
module-cc ; C/C++/Obj-C madness
|
||||
module-crystal ; ruby at the speed of c
|
||||
module-csharp ; unity, .NET, and mono shenanigans
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
|
||||
(use-package cc-mode
|
||||
:commands (c-mode c++-mode objc-mode java-mode)
|
||||
:mode ("\\.mm" . objc-mode)
|
||||
:init
|
||||
(associate! objc-mode :match "\\.mm$")
|
||||
(add-hook! c++-mode '(highlight-numbers-mode narf|init-c++-C11-highlights))
|
||||
(add-hook 'c-initialization-hook 'narf|init-c/c++-settings)
|
||||
|
||||
;; C++ header files
|
||||
(push `(,(lambda () (and (f-ext? buffer-file-name "h")
|
||||
(push (cons (lambda () (and (f-ext? buffer-file-name "h")
|
||||
(or (f-exists? (f-swap-ext buffer-file-name "cpp"))
|
||||
(awhen (car-safe (projectile-get-other-files (buffer-file-name) (projectile-current-project-files)))
|
||||
(f-ext? it "cpp")))))
|
||||
. c++-mode)
|
||||
'c++-mode)
|
||||
magic-mode-alist)
|
||||
|
||||
;; Obj-C
|
||||
(push `(,(lambda () (and (f-ext? buffer-file-name "h")
|
||||
(push (cons (lambda () (and (f-ext? buffer-file-name "h")
|
||||
(re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t)))
|
||||
. objc-mode)
|
||||
'objc-mode)
|
||||
magic-mode-alist)
|
||||
|
||||
:config
|
||||
|
@ -55,7 +55,7 @@
|
|||
(flycheck-irony-setup)
|
||||
|
||||
;; some c-mode dervied modes wrongfully trigger these hooks (like php-mode)
|
||||
(add-hook! (c-mode c++-mode ojbc-mode)
|
||||
(add-hook! (c-mode c++-mode objc-mode)
|
||||
(when (memq major-mode '(c-mode c++-mode objc-mode))
|
||||
(flycheck-mode +1)
|
||||
(irony-mode +1)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
:init
|
||||
(add-hook! go-mode '(emr-initialize flycheck-mode go-eldoc-setup))
|
||||
(add-hook! go-mode (add-hook 'before-save-hook 'gofmt-before-save))
|
||||
|
||||
:config
|
||||
(def-builder! go-mode "go build")
|
||||
(def-company-backend! go-mode (go yasnippet))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue