Clean up + refactor
This commit is contained in:
parent
2e702b260e
commit
844039b99b
10 changed files with 215 additions and 271 deletions
|
@ -13,7 +13,7 @@
|
|||
|
||||
;; Sane scroll settings
|
||||
scroll-margin 0
|
||||
scroll-conservatively 9999
|
||||
scroll-conservatively 101
|
||||
scroll-preserve-screen-position t
|
||||
shift-select-mode nil
|
||||
tabify-regexp "^\t* [ \t]+"
|
||||
|
@ -22,11 +22,17 @@
|
|||
'((tab-mark ?\t [?> ?\t])
|
||||
(newline-mark 10 [36 10]))
|
||||
truncate-lines t ; do not soft-wrap lines
|
||||
truncate-partial-width-windows nil)
|
||||
truncate-partial-width-windows nil
|
||||
jit-lock-stealth-time 1)
|
||||
|
||||
|
||||
;; Automatic minor modes ;;;;;;;;;;;
|
||||
|
||||
(defvar narf-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'."
|
||||
(when buffer-file-name
|
||||
|
@ -62,6 +68,9 @@
|
|||
(add-hook! makefile-mode 'narf|enable-tabs) ; Use normal tabs in makefiles
|
||||
(add-hook! before-save 'delete-trailing-whitespace)
|
||||
(add-hook! eldoc-mode (diminish 'eldoc-mode " ?"))
|
||||
;; Line wrapping
|
||||
(add-hook! prog-mode 'narf|enable-comment-hard-wrap)
|
||||
(add-hook! auto-fill-mode (diminish 'auto-fill-function))
|
||||
|
||||
(defadvice delete-trailing-whitespace (around delete-trailing-whitespace-ignore-line activate)
|
||||
"Don't delete trailing whitespace on current line, if in insert mode."
|
||||
|
@ -71,10 +80,6 @@
|
|||
(when (string-match-p "^[\s\t]*$" linestr)
|
||||
(insert linestr))))
|
||||
|
||||
;; Line wrapping
|
||||
(add-hook! text-mode 'narf|enable-hard-wrap)
|
||||
(add-hook! prog-mode 'narf|enable-comment-hard-wrap)
|
||||
(add-hook! auto-fill-mode (diminish 'auto-fill-function))
|
||||
;; If file is oversized...
|
||||
(add-hook! find-file
|
||||
(when (> (buffer-size) (* 1024 1024))
|
||||
|
@ -87,7 +92,7 @@
|
|||
|
||||
;; (global-whitespace-mode 1) ; Show whitespace
|
||||
(global-font-lock-mode t) ; Enable syntax highlighting for older emacs
|
||||
(global-auto-revert-mode 1) ; revert buffers for changed files
|
||||
(global-auto-revert-mode -1) ; revert buffers for changed files
|
||||
(electric-indent-mode -1)
|
||||
|
||||
;; window config undo/redo
|
||||
|
|
|
@ -84,14 +84,14 @@
|
|||
:functions (iedit-current-occurrence-string iedit-restrict-region)
|
||||
:commands (evil-iedit-state evil-iedit-state/iedit-mode)
|
||||
:config
|
||||
(bind!
|
||||
:v "SPC" 'narf:iedit-restrict-to-region
|
||||
(:map evil-iedit-state-map ; Don't interfere with evil-snipe
|
||||
"s" nil
|
||||
"S" nil
|
||||
"V" 'evil-visual-line
|
||||
"C" 'evil-iedit-state/substitute ; instead of s/S
|
||||
"za" 'iedit-toggle-unmatched-lines-visible)))
|
||||
(bind! :v "SPC" 'narf:iedit-restrict-to-region
|
||||
(:map evil-iedit-state-map
|
||||
;; Don't interfere with evil-snipe
|
||||
"s" nil
|
||||
"S" nil
|
||||
"V" 'evil-visual-line
|
||||
"C" 'evil-iedit-state/substitute ; instead of s/S
|
||||
"za" 'iedit-toggle-unmatched-lines-visible)))
|
||||
|
||||
(use-package evil-indent-textobject
|
||||
:commands (evil-indent-i-indent
|
||||
|
@ -135,8 +135,7 @@
|
|||
(evil-snipe-enable-incremental-highlight))))
|
||||
|
||||
(use-package evil-numbers
|
||||
:commands (evil-numbers/inc-at-pt
|
||||
evil-numbers/dec-at-pt))
|
||||
:commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt))
|
||||
|
||||
(use-package evil-search-highlight-persist
|
||||
:config
|
||||
|
@ -168,8 +167,12 @@
|
|||
(evil-space-setup "?" "N" "n")
|
||||
|
||||
(after! evil-snipe
|
||||
(mapc (lambda (x) (evil-space-setup x 'evil-snipe-repeat 'evil-snipe-repeat-reverse))
|
||||
'(evil-snipe-f evil-snipe-F evil-snipe-t evil-snipe-T evil-snipe-s evil-snipe-S)))
|
||||
(evil-space-setup 'evil-snipe-f 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||
(evil-space-setup 'evil-snipe-F 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||
(evil-space-setup 'evil-snipe-t 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||
(evil-space-setup 'evil-snipe-T 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||
(evil-space-setup 'evil-snipe-s 'evil-snipe-repeat 'evil-snipe-repeat-reverse)
|
||||
(evil-space-setup 'evil-snipe-S 'evil-snipe-repeat 'evil-snipe-repeat-reverse))
|
||||
|
||||
(after! evil-visualstar
|
||||
(evil-space-setup 'evil-visualstar/begin-search-forward "n" "N")
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
(fringe-mode '(1 . 8))
|
||||
(setq frame-title-format '(buffer-file-name "%f" ("%b"))))
|
||||
|
||||
(setq show-paren-delay 0)
|
||||
;; Highlight matching parens
|
||||
(setq show-paren-delay 0.05)
|
||||
(show-paren-mode 1)
|
||||
|
||||
(global-hl-line-mode 1) ; do highlight line
|
||||
(blink-cursor-mode 1) ; do blink cursor
|
||||
(line-number-mode 1) ; do show line no in modeline
|
||||
(column-number-mode 1) ; do show col no in modeline
|
||||
(tooltip-mode -1) ; don't show tooltips
|
||||
;; (size-indication-mode 1) ; do show file size
|
||||
(global-hl-line-mode 1) ; do highlight line
|
||||
(blink-cursor-mode 1) ; do blink cursor
|
||||
(line-number-mode 1) ; do show line no in modeline
|
||||
(column-number-mode 1) ; do show col no in modeline
|
||||
(tooltip-mode -1) ; don't show tooltips
|
||||
(size-indication-mode -1)
|
||||
|
||||
(setq-default
|
||||
;; Multiple cursors across buffers cause a strange redraw delay for
|
||||
|
@ -36,7 +38,6 @@
|
|||
(add-hook! text-mode 'fci-mode))
|
||||
|
||||
(use-package nlinum ; line numbers
|
||||
:disabled t
|
||||
:defer t
|
||||
:defines nlinum--width
|
||||
:preface
|
||||
|
@ -48,8 +49,8 @@
|
|||
(defvar narf--hl-nlinum-line nil)
|
||||
(defvar nlinum-format " %3d ")
|
||||
:init
|
||||
;; Highlight line number
|
||||
(defun narf|nlinum-unhl-line ()
|
||||
"Highlight line number"
|
||||
(when narf--hl-nlinum-overlay
|
||||
(let* ((ov narf--hl-nlinum-overlay)
|
||||
(disp (get-text-property 0 'display (overlay-get ov 'before-string)))
|
||||
|
@ -59,6 +60,7 @@
|
|||
narf--hl-nlinum-line nil))))
|
||||
|
||||
(defun narf|nlinum-hl-line (&optional line)
|
||||
"Unhighlight line number"
|
||||
(let ((line-no (or line (line-number-at-pos (point)))))
|
||||
(when (and nlinum-mode (not (eq line-no narf--hl-nlinum-line)))
|
||||
(let* ((pbol (if line (save-excursion (goto-char (point-min))
|
||||
|
@ -83,8 +85,7 @@
|
|||
|
||||
(defun narf|nlinum-enable ()
|
||||
(nlinum-mode +1)
|
||||
(add-hook 'post-command-hook 'narf|nlinum-hl-line))
|
||||
|
||||
(add-hook! post-command 'narf|nlinum-hl-line))
|
||||
(defun narf|nlinum-disable ()
|
||||
(nlinum-mode -1)
|
||||
(remove-hook 'post-command-hook 'narf|nlinum-hl-line)
|
||||
|
@ -99,27 +100,40 @@
|
|||
;; Mode-line ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(use-package spaceline-segments
|
||||
:init
|
||||
:config
|
||||
(setq-default
|
||||
powerline-default-separator 'wave
|
||||
powerline-height 18)
|
||||
:config
|
||||
(require 'spaceline-segments)
|
||||
|
||||
;; Modeline caches
|
||||
(defvar narf--spaceline-file-path nil)
|
||||
(make-variable-buffer-local 'narf--spaceline-file-path)
|
||||
|
||||
(defvar narf--spaceline-vc nil)
|
||||
(make-variable-buffer-local 'narf--spaceline-vc)
|
||||
(add-hook! before-save (setq narf--spaceline-vc nil))
|
||||
|
||||
;; Custom modeline segments
|
||||
(spaceline-define-segment narf-buffer-path
|
||||
"Name of buffer."
|
||||
(concat (let ((buffer-path (buffer-file-name)))
|
||||
(if (and buffer-path (file-exists-p buffer-path))
|
||||
(progn
|
||||
(setq buffer-path (abbreviate-file-name buffer-path))
|
||||
(let ((path (file-relative-name buffer-path (file-name-directory (narf/project-root))))
|
||||
(max-length (/ (window-width) 2)))
|
||||
(if (> (length path) max-length)
|
||||
(concat "…" (replace-regexp-in-string
|
||||
"^.*?/" "/"
|
||||
(let ((l (length path))) (substring path (- l max-length) l))))
|
||||
path)))
|
||||
(powerline-buffer-id)))
|
||||
(concat (or narf--spaceline-file-path
|
||||
(setq narf--spaceline-file-path
|
||||
(let ((buffer-path (buffer-file-name)))
|
||||
(if (and buffer-path (file-exists-p buffer-path))
|
||||
(progn
|
||||
(let* ((max-length (/ (window-width) 2))
|
||||
(project-path (narf/project-root))
|
||||
(path (file-relative-name
|
||||
buffer-path (file-name-directory (if (string-match "/+\\'" project-path)
|
||||
(replace-match "" t t project-path)
|
||||
project-path)))))
|
||||
(if (> (length path) max-length)
|
||||
(concat "…" (replace-regexp-in-string
|
||||
"^.*?/" "/"
|
||||
(let ((l (length path))) (substring path (- l max-length) l))))
|
||||
path)))
|
||||
(powerline-buffer-id)))))
|
||||
(if (buffer-modified-p)
|
||||
(propertize "*" 'font-lock-face `(:inherit ,other-face :foreground "orange")))
|
||||
" ")
|
||||
|
@ -127,15 +141,11 @@
|
|||
|
||||
(spaceline-define-segment narf-buffer-encoding-abbrev
|
||||
"The line ending convention used in the buffer."
|
||||
(let ((buf-coding (format "%s" buffer-file-coding-system)))
|
||||
(let ((buf-coding (symbol-name buffer-file-coding-system)))
|
||||
(if (string-match "\\(dos\\|unix\\|mac\\)" buf-coding)
|
||||
(match-string 1 buf-coding)
|
||||
buf-coding))
|
||||
:when (not (string-match "unix" (symbol-name buffer-file-coding-system))))
|
||||
|
||||
(spaceline-define-segment narf-line-column
|
||||
"The current line and column numbers."
|
||||
"%l/%c")
|
||||
:when (not (string-match-p "unix" (symbol-name buffer-file-coding-system))))
|
||||
|
||||
(spaceline-define-segment narf-buffer-position
|
||||
"A more vim-like buffer position."
|
||||
|
@ -146,7 +156,9 @@
|
|||
|
||||
(spaceline-define-segment narf-vc
|
||||
"Version control info"
|
||||
(replace-regexp-in-string (regexp-quote (symbol-name (vc-deduce-backend))) "" (s-trim (powerline-vc)) t t)
|
||||
(or narf--spaceline-vc
|
||||
(replace-regexp-in-string (regexp-quote (symbol-name (vc-deduce-backend)))
|
||||
"" (s-trim (powerline-vc)) t t))
|
||||
:when (powerline-vc))
|
||||
|
||||
(spaceline-define-segment narf-hud
|
||||
|
@ -154,20 +166,18 @@
|
|||
(powerline-hud highlight-face default-face)
|
||||
:tight t)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Initialize modeline
|
||||
(spaceline-install
|
||||
;; Left side
|
||||
'(((narf-buffer-path :face other-face) remote-host)
|
||||
((flycheck-error flycheck-warning flycheck-info)
|
||||
:when active)
|
||||
((flycheck-error flycheck-warning flycheck-info) :when active)
|
||||
(narf-vc :face other-face :when active))
|
||||
;; Right side
|
||||
'(selection-info
|
||||
narf-buffer-encoding-abbrev
|
||||
(major-mode (minor-modes process :when active))
|
||||
(major-mode (minor-modes :separator " ") process :when active)
|
||||
(global :when active)
|
||||
(narf-line-column narf-buffer-position :face powerline-border)
|
||||
narf-buffer-position
|
||||
narf-hud)))
|
||||
|
||||
(provide 'core-ui)
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
|
||||
(defconst narf--splash-buffer-name "*narf*")
|
||||
|
||||
(defvar narf-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.")
|
||||
|
||||
(defvar narf-unreal-buffers '("^ ?\\*.+\\*"
|
||||
image-mode
|
||||
dired-mode
|
||||
|
@ -50,6 +45,5 @@ gets killed.")
|
|||
"A list of files that count as 'project files', which determine whether a
|
||||
folder is the root of a project or not.")
|
||||
|
||||
|
||||
(provide 'core-vars)
|
||||
;;; core-vars.el ends here
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
;; see lib/yasnippet-macros.el
|
||||
|
||||
(use-package yasnippet
|
||||
:mode (("emacs\\.d/snippets/.+$" . snippet-mode))
|
||||
:mode ("emacs\\.d/private/\\(snippets\\|templates\\)/.+$" . snippet-mode)
|
||||
:diminish (yas-minor-mode . "Y")
|
||||
:commands (yas-minor-mode
|
||||
yas-minor-mode-on
|
||||
|
|
190
core/core.el
190
core/core.el
|
@ -5,133 +5,46 @@
|
|||
;; 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:... An ex command OR keybind function
|
||||
;; narf|... A hook
|
||||
;; narf*... An advising function
|
||||
;; ...! Macro
|
||||
;;
|
||||
;;; Bootstrap:
|
||||
|
||||
(unless (require 'autoloads nil t)
|
||||
(load (concat narf-emacs-dir "scripts/generate-autoloads.el"))
|
||||
(require 'autoloads))
|
||||
|
||||
(require 'core-vars)
|
||||
(require 'core-defuns)
|
||||
(require 'diminish)
|
||||
|
||||
;; NARF!
|
||||
(define-minor-mode narf-mode "Narf, yoink, poit."
|
||||
:global t
|
||||
:init-value t
|
||||
:keymap (make-sparse-keymap))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(eval-when-compile
|
||||
(require 's)
|
||||
(require 'dash)
|
||||
(require 'f)
|
||||
|
||||
(defvar use-package-verbose narf-debug-mode)
|
||||
;; (setq use-package-expand-minimally (not narf-debug-mode))
|
||||
(require 'use-package)
|
||||
|
||||
(defun use-package--add-keyword (keyword after)
|
||||
(setq use-package-keywords
|
||||
(-insert-at (-find-index (lambda (key) (eq key after)) use-package-keywords)
|
||||
keyword use-package-keywords)))
|
||||
|
||||
(progn ; remap :bind to bind! macro instead of bind-keys
|
||||
;; (defun use-package-handler/:bind
|
||||
;; (name-symbol keyword arg rest state &optional override)
|
||||
;; (let ((commands (mapcar #'cdr arg)))
|
||||
;; (use-package-concat
|
||||
;; (use-package-process-keywords name-symbol
|
||||
;; (use-package-sort-keywords
|
||||
;; (use-package-plist-maybe-put rest :defer t))
|
||||
;; (use-package-plist-append state :commands commands))
|
||||
;; `((ignore (,bind! ,@arg))))))
|
||||
)
|
||||
|
||||
(progn ; add :after to use-package
|
||||
(use-package--add-keyword :after :load-path)
|
||||
|
||||
(defalias 'use-package-normalize/:after 'use-package-normalize-symlist)
|
||||
|
||||
(defun use-package-handler/:after (name-symbol keyword arg rest state)
|
||||
(let ((body (use-package-process-keywords name-symbol rest state)))
|
||||
(if (null arg)
|
||||
body
|
||||
(use-package-concat
|
||||
(use-package-process-keywords name-symbol
|
||||
(use-package-sort-keywords (use-package-plist-maybe-put rest :defer t)) state)
|
||||
(apply #'nconc
|
||||
(mapcar (lambda (feature)
|
||||
`((after! ,feature (require ',name-symbol))))
|
||||
(delete-dups arg))))))))
|
||||
|
||||
;; Make any folders needed
|
||||
(dolist (file '("" "undo" "backup"))
|
||||
(let ((path (concat narf-temp-dir file)))
|
||||
(unless (file-exists-p path)
|
||||
(make-directory path t)))))
|
||||
|
||||
;; Emacs configuration ;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;; UTF-8 please
|
||||
(setq locale-coding-system 'utf-8) ; pretty
|
||||
(set-terminal-coding-system 'utf-8) ; pretty
|
||||
(set-keyboard-coding-system 'utf-8) ; pretty
|
||||
(set-selection-coding-system 'utf-8) ; please
|
||||
(prefer-coding-system 'utf-8) ; with sugar on top
|
||||
|
||||
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||
;;;
|
||||
|
||||
(setq-default
|
||||
confirm-kill-emacs (lambda (prompt) (y-or-n-p ">> Gee, I dunno Brain... Are you sure?"))
|
||||
|
||||
gc-cons-threshold 20000000 ; avoid garbage collection
|
||||
enable-recursive-minibuffers t ; minibufferception
|
||||
echo-keystrokes 0.02 ; show me those keystrokes
|
||||
ring-bell-function 'ignore ; silence of the bells!
|
||||
|
||||
inhibit-startup-screen t ; don't show emacs start screen
|
||||
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
|
||||
initial-major-mode 'text-mode ; initial scratch buffer mode
|
||||
initial-scratch-message nil
|
||||
major-mode 'text-mode
|
||||
|
||||
compilation-always-kill t
|
||||
compilation-ask-about-save nil
|
||||
compilation-scroll-output t
|
||||
|
||||
sentence-end-double-space nil ; sentences end with periods. period.
|
||||
|
||||
confirm-kill-emacs (lambda (prompt) (y-or-n-p ">> Gee, I dunno Brain... Are you sure?"))
|
||||
echo-keystrokes 0.02 ; show me those keystrokes
|
||||
ediff-diff-options "-w"
|
||||
ediff-split-window-function 'split-window-horizontally ; side-by-side diffs
|
||||
ediff-window-setup-function 'ediff-setup-windows-plain ; no extra frames
|
||||
|
||||
;; Don't save clipboard contents into kill-ring before replacing them
|
||||
enable-recursive-minibuffers t ; minibufferception
|
||||
history-length 1000
|
||||
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
|
||||
|
||||
;; Don't let the cursor go into minibuffer prompt
|
||||
;; from Xah Lee: http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
||||
minibuffer-prompt-properties
|
||||
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
||||
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
||||
minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
||||
|
||||
;; remove annoying ellipsis when printing sexp in message buffer
|
||||
eval-expression-print-length nil
|
||||
eval-expression-print-level nil
|
||||
|
||||
history-length 1000
|
||||
|
||||
;; Backups ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Disable all backups (that's what git/dropbox are for)
|
||||
bookmark-save-flag t
|
||||
bookmark-default-file (! (concat narf-temp-dir "bookmarks"))
|
||||
auto-save-default nil
|
||||
auto-save-list-file-name (! (concat narf-temp-dir "autosave"))
|
||||
|
||||
;; In case I want to reactivate backup files
|
||||
make-backup-files nil
|
||||
create-lockfiles nil
|
||||
|
@ -141,25 +54,60 @@
|
|||
undo-tree-auto-save-history t
|
||||
undo-tree-history-directory-alist `(("." . ,(! (concat narf-temp-dir "undo/")))))
|
||||
|
||||
;;; UTF-8 please
|
||||
(setq locale-coding-system 'utf-8) ; pretty
|
||||
(set-terminal-coding-system 'utf-8) ; pretty
|
||||
(set-keyboard-coding-system 'utf-8) ; pretty
|
||||
(set-selection-coding-system 'utf-8) ; please
|
||||
(prefer-coding-system 'utf-8) ; with sugar on top
|
||||
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
||||
|
||||
|
||||
;; Bootstrap ;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(unless (require 'autoloads nil t)
|
||||
(load (concat narf-emacs-dir "scripts/generate-autoloads.el"))
|
||||
(require 'autoloads))
|
||||
(require 'core-vars)
|
||||
(require 'core-defuns)
|
||||
(require 'diminish)
|
||||
|
||||
;; NARF!
|
||||
(define-minor-mode narf-mode "Narf, yoink, poit."
|
||||
:global t :init-value t :keymap (make-sparse-keymap))
|
||||
|
||||
(eval-when-compile
|
||||
(defvar use-package-verbose narf-debug-mode)
|
||||
(require 'dash)
|
||||
(require 'use-package)
|
||||
(require 'defuns-use-package)
|
||||
|
||||
;; Make any folders needed
|
||||
(dolist (file '("" "undo" "backup"))
|
||||
(let ((path (concat narf-temp-dir file)))
|
||||
(unless (file-exists-p path)
|
||||
(make-directory path t)))))
|
||||
|
||||
;; Save history across sessions
|
||||
(require 'savehist)
|
||||
(setq savehist-file (! (concat narf-temp-dir "savehist"))
|
||||
savehist-additional-variables
|
||||
'(kill-ring global-mark-ring search-ring regexp-search-ring extended-command-history))
|
||||
(savehist-mode 1)
|
||||
(use-package savehist
|
||||
:config
|
||||
(setq savehist-file (! (concat narf-temp-dir "savehist"))
|
||||
savehist-additional-variables
|
||||
'(kill-ring global-mark-ring search-ring regexp-search-ring extended-command-history))
|
||||
(savehist-mode 1))
|
||||
|
||||
(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$")
|
||||
recentf-max-menu-items 0
|
||||
recentf-max-saved-items 250
|
||||
recentf-auto-cleanup 600)
|
||||
(recentf-mode 1)
|
||||
(use-package recentf
|
||||
:config
|
||||
(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$")
|
||||
recentf-max-menu-items 0
|
||||
recentf-max-saved-items 250
|
||||
recentf-auto-cleanup 600)
|
||||
(recentf-mode 1))
|
||||
|
||||
(require 'popwin)
|
||||
(popwin-mode 1)
|
||||
(use-package popwin :config (popwin-mode 1))
|
||||
|
||||
;; Save cursor location across sessions. Only save for files that exist.
|
||||
(use-package saveplace
|
||||
|
@ -175,10 +123,6 @@
|
|||
:commands (describe-buffer describe-command describe-file
|
||||
describe-keymap describe-option describe-option-of-type))
|
||||
|
||||
(require 'server)
|
||||
(unless (server-running-p)
|
||||
(server-start))
|
||||
|
||||
(add-hook! after-init
|
||||
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
|
||||
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
||||
|
|
|
@ -14,7 +14,7 @@ determine if a directory is a project."
|
|||
(dolist (file narf-project-root-files)
|
||||
(when (file-exists-p (expand-file-name file path))
|
||||
(throw 'found path)))))) default-directory)
|
||||
default-directory)))
|
||||
default-directory)))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/project-has-files (files &optional root)
|
||||
|
|
111
init.el
111
init.el
|
@ -41,68 +41,69 @@
|
|||
;;; License: GPLv3
|
||||
|
||||
(defconst narf-debug-mode nil)
|
||||
(setq gc-cons-threshold 84857600) ; avoid garbage collection
|
||||
|
||||
(scroll-bar-mode -1) ; no scrollbar
|
||||
(tool-bar-mode -1) ; no toolbar
|
||||
(menu-bar-mode -1) ; no menubar
|
||||
(when window-system
|
||||
(set-frame-font (if (> (display-pixel-width) 1280)
|
||||
(font-spec :family "Ubuntu Mono" :size 14 :antialias t)
|
||||
(font-spec :family "terminus (ttf)" :size 12 :antialias nil)))
|
||||
(set-frame-parameter nil 'fullscreen 'fullboth))
|
||||
(let (file-name-handler-alist) ; premature optimization weee!
|
||||
(scroll-bar-mode -1) ; no scrollbar
|
||||
(tool-bar-mode -1) ; no toolbar
|
||||
(menu-bar-mode -1) ; no menubar
|
||||
|
||||
(load (concat user-emacs-directory "init-load-path.el"))
|
||||
(load-theme (if window-system 'narf-dark 'wombat) t)
|
||||
(mapc 'require
|
||||
`(;; benchmark ; records load times in `require-times'; see `list-times'
|
||||
core ; core/core.el
|
||||
(set-frame-font (font-spec :family "terminus (ttf)" :size 12 :antialias nil))
|
||||
(load (concat user-emacs-directory "init-load-path.el"))
|
||||
(load-theme (if window-system 'narf-dark 'brin) t)
|
||||
(set-frame-parameter nil 'fullscreen 'fullboth)
|
||||
(mapc 'require
|
||||
`(core ; core/core.el
|
||||
,(cond (IS-MAC 'core-os-osx)
|
||||
(IS-LINUX 'core-os-linux)
|
||||
(IS-WINDOWS 'core-os-win32))
|
||||
|
||||
,(cond (IS-MAC 'core-os-osx)
|
||||
(IS-LINUX 'core-os-linux)
|
||||
(IS-WINDOWS 'core-os-win32))
|
||||
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
|
||||
core-company ; for the lazy typist
|
||||
core-yasnippet ; for the lazier typist
|
||||
core-auto-insert ; for the laziest typist
|
||||
core-flycheck ; remember that semicolon you forgot?
|
||||
core-project ; whose project am I in?
|
||||
core-vcs ; version control is a programmer's best friend
|
||||
core-helm ; a search engine for life and love
|
||||
core-quickrun ; run code, run.
|
||||
core-workgroups ; cure Emacs alzheimers
|
||||
|
||||
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
|
||||
core-company ; for the lazy typist
|
||||
core-yasnippet ; for the lazier typist
|
||||
core-auto-insert ; for the laziest typist
|
||||
core-flycheck ; remember that semicolon you forgot?
|
||||
core-project ; whose project am I in?
|
||||
core-vcs ; version control is a programmer's best friend
|
||||
core-helm ; a search engine for life and love
|
||||
core-quickrun ; run code, run.
|
||||
core-workgroups ; cure Emacs alzheimers
|
||||
module-cc ; c/c++/obj-c madness
|
||||
;; module-crystal ; ruby at the speed of c
|
||||
;; module-csharp ; unity, mono and xamarin
|
||||
module-data ; dbs 'n data formats
|
||||
module-elisp ; drowning in parentheses
|
||||
module-eshell ; eshell (on windows)
|
||||
module-go ; a hipster dialect
|
||||
module-java ; the poster child for carpal tunnel syndome
|
||||
module-js ; alert("not java, javascript!")
|
||||
module-lb6 ; LaunchBar 6 development
|
||||
module-lua ; one-based indices? one-based indices.
|
||||
module-markdown ; markdown
|
||||
;; module-org ; for fearless [organized] leader
|
||||
module-php ; making php less painful to work with
|
||||
module-python ; beautiful is better than ugly
|
||||
module-regex ; /^[^\s](meaning)[^\n]*/
|
||||
module-ruby ; <3
|
||||
module-rust
|
||||
module-sass ; @include magic;
|
||||
module-sh ; she sells Z-shells by the C shore
|
||||
module-swift ; yay, emoji variables!
|
||||
module-vim ; the confessional
|
||||
module-web ; for the 2.0'er
|
||||
|
||||
module-cc ; c/c++/obj-c madness
|
||||
module-crystal ; ruby at the speed of c
|
||||
module-csharp ; unity, mono and xamarin
|
||||
module-data ; dbs 'n data formats
|
||||
module-eshell ; eshell (on windows)
|
||||
module-go ; a hipster dialect
|
||||
module-java ; the poster child for carpal tunnel syndome
|
||||
module-js ; alert("not java, javascript!")
|
||||
module-elisp ;
|
||||
module-lua ; one-based indices? one-based indices.
|
||||
module-lb6 ; LaunchBar 6 development
|
||||
;; module-org ; for fearless [organized] leader
|
||||
module-php ; making php less painful to work with
|
||||
module-python ; beautiful is better than ugly
|
||||
module-regex ; /^[^\s](meaning)[^\n]*/
|
||||
module-ruby ; <3
|
||||
module-sass ; @include magic;
|
||||
module-sh ; she sells Z-shells by the C shore
|
||||
module-swift ; yay, emoji variables!
|
||||
module-markdown ; markdown
|
||||
;; module-rust
|
||||
module-vim ; the confessional
|
||||
module-web ; for the 2.0'er
|
||||
|
||||
my-bindings
|
||||
my-commands
|
||||
))
|
||||
my-bindings
|
||||
my-commands
|
||||
)))
|
||||
|
||||
(defun display-startup-echo-area-message ()
|
||||
(message ">>> Loaded in %s" (emacs-init-time)))
|
||||
|
||||
(require 'server)
|
||||
(unless (server-running-p)
|
||||
(server-start))
|
||||
|
||||
;;; I think so Brain...
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
markdown-unwrap-things-in-region
|
||||
markdown-wrap-or-insert
|
||||
markdown-unwrap-thing-at-point)
|
||||
:init
|
||||
(add-hook! markdown-mode 'narf|enable-hard-wrap)
|
||||
:config
|
||||
(bind! :map markdown-mode-map
|
||||
"<backspace>" nil
|
||||
|
|
|
@ -42,34 +42,19 @@
|
|||
(add-company-backend! python-mode (anaconda)))
|
||||
|
||||
(after! emr
|
||||
(emr-declare-command
|
||||
'anaconda-mode-view-doc
|
||||
:title "view documentation"
|
||||
:modes 'python-mode
|
||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
(emr-declare-command
|
||||
'anaconda-mode-goto-assignments
|
||||
:title "go to assignments"
|
||||
:modes 'python-mode
|
||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
(emr-declare-command
|
||||
'anaconda-mode-goto-definitions
|
||||
:title "go to definition"
|
||||
:modes 'python-mode
|
||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
(emr-declare-command
|
||||
'anaconda-mode-usages
|
||||
:title "show usages"
|
||||
:modes 'python-mode
|
||||
:predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))))
|
||||
(mapc (lambda (x)
|
||||
(let ((command-name (car x))
|
||||
(title (cadr x))
|
||||
(region-p (caddr x))
|
||||
predicate)
|
||||
(setq predicate (lambda () (and (anaconda-mode-running-p)
|
||||
(not (use-region-p))
|
||||
(not (sp-point-in-string-or-comment)))))
|
||||
(emr-declare-command (intern (format "anaconda-mode-%s" (symbol-name command-name)))
|
||||
:title title :modes 'python-mode :predicate predicate)))
|
||||
'((view-doc "view documentation" t)
|
||||
(goto-assignments "go to assignments" t)
|
||||
(usages "show usages" nil)))))
|
||||
|
||||
(provide 'module-python)
|
||||
;;; module-python.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue