diff --git a/core/core-editor.el b/core/core-editor.el index 3d60b567b..e1c1c64a4 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -30,7 +30,7 @@ whitespace-style '(face tabs tab-mark newline newline-mark trailing indentation lines-tail) whitespace-display-mappings - '((tab-mark ?\t [?> ?\t]) + '((tab-mark ?\t [?> ?\t]) (newline-mark 10 [36 10]))) ;; Save point across sessions @@ -182,17 +182,17 @@ enable multiple minor modes for the same regexp.") ;; Plugins ;; -(use-package avy - :commands (avy-goto-char-2 avy-goto-line) - :config (setq avy-all-windows nil - avy-background t)) - (use-package ace-window :commands ace-window :config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) aw-scope 'frame aw-background t)) +(use-package avy + :commands (avy-goto-char-2 avy-goto-line) + :config (setq avy-all-windows nil + avy-background t)) + (use-package editorconfig :config ;; Don't affect lisp indentation (just `tab-width') diff --git a/core/core-evil.el b/core/core-evil.el index 297b3f459..b567b7b95 100644 --- a/core/core-evil.el +++ b/core/core-evil.el @@ -256,9 +256,7 @@ (define-key evil-outer-text-objects-map "a" #'evil-outer-arg)) (use-package evil-commentary - :commands (evil-commentary - evil-commentary-yank - evil-commentary-line) + :commands (evil-commentary evil-commentary-yank evil-commentary-line) :config (evil-commentary-mode 1)) (use-package evil-exchange diff --git a/core/core-helm.el b/core/core-helm.el index 6d38bd5e5..8baa02cac 100644 --- a/core/core-helm.el +++ b/core/core-helm.el @@ -3,7 +3,7 @@ (use-package helm :commands (helm helm-other-buffer helm-mode) :init - (defvar helm-global-prompt ":: ") + (defvar helm-global-prompt "›") (setq-default helm-quick-update t helm-reuse-last-window-split-state t @@ -98,7 +98,7 @@ "TAB" 'helm-execute-persistent-action) (mapc (lambda (r) (add-to-list 'helm-boring-file-regexp-list r)) - (list "\\.projects$" "\\.DS_Store$" "\\.cask"))) + (list "\\.projects$" "\\.DS_Store$"))) (use-package helm-ag :commands (helm-ag diff --git a/core/core-project.el b/core/core-project.el index 4717d96f0..e9a51794e 100644 --- a/core/core-project.el +++ b/core/core-project.el @@ -89,13 +89,13 @@ neo-auto-indent-point t neo-mode-line-type 'none neo-persist-show nil - neo-window-width 27 + neo-window-width 26 neo-show-updir-line nil neo-auto-indent-point t neo-banner-message nil) :config (evil-set-initial-state 'neotree-mode 'motion) - (add-hook! neotree-mode 'narf|neotree-init-keymap) + (add-hook 'neotree-mode-hook 'narf|neotree-init-keymap) (defun narf|neotree-init-keymap () (map! :map evil-motion-state-local-map "ESC" 'neotree-hide diff --git a/core/core-ui.el b/core/core-ui.el index 63e8e81a7..66d328952 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -206,7 +206,7 @@ :init (defun narf|nlinum-enable () (nlinum-mode +1) - (add-hook 'post-command-hook 'narf|nlinum-hl-line t)) + (add-hook 'post-command-hook 'narf|nlinum-hl-line)) (add-hook! (markdown-mode prog-mode scss-mode web-mode conf-mode) @@ -334,7 +334,6 @@ See `define-env-command!' to define one for a mode." :skip-alternate t :tight-right t) - ;; search indicators (defface mode-line-count-face nil "") (make-variable-buffer-local 'anzu--state) @@ -390,9 +389,10 @@ anzu to be enabled." (spaceline-define-segment *macro-recording "Show when recording macro" - (format "%s ▶" (char-to-string evil-this-macro)) + (format " %s ▶ " (char-to-string evil-this-macro)) :when (and active defining-kbd-macro) :face highlight-face + :tight t :skip-alternate t) (spaceline-define-segment *buffer-encoding-abbrev @@ -481,11 +481,16 @@ Supports both Emacs and Evil cursor conventions." (powerline-hud (if active 'spaceline-highlight-face 'region) line-face 1) :tight-right t) + (spaceline-define-segment *buffer-size + (powerline-buffer-size) + :tight-right t + :skip-alternate t) + (defun narf-spaceline-init () (spaceline-install ;; Left side - '(*macro-recording - (*anzu *iedit *evil-substitute *flycheck) + '(((*macro-recording *anzu *iedit *evil-substitute *flycheck) + :fallback *buffer-size) (*buffer-path *remote-host) *buffer-modified *vc diff --git a/core/core.el b/core/core.el index a86fec881..752a434d1 100644 --- a/core/core.el +++ b/core/core.el @@ -130,6 +130,8 @@ gets killed.") ;; Bootstrap ;; +(autoload 'awhen "anaphora" "" nil 'macro) +(autoload 'aif "anaphora" "" nil 'macro) (autoload 'use-package "use-package" "" nil 'macro) (unless (require 'autoloads nil t) (load (concat narf-emacs-dir "/scripts/generate-autoloads.el")) diff --git a/core/defuns/defuns-ui.el b/core/defuns/defuns-ui.el index c5918ab05..dd3ed7321 100644 --- a/core/defuns/defuns-ui.el +++ b/core/defuns/defuns-ui.el @@ -48,37 +48,40 @@ ;;;###autoload (defun narf/add-whitespace (&optional start end) + "Maintain indentation whitespace in buffer. Used so that highlight-indentation will +display consistent guides. Whitespace is stripped out on save, so this doesn't affect the +end file." (interactive (progn (barf-if-buffer-read-only) (if (use-region-p) (list (region-beginning) (region-end)) (list nil nil)))) - (save-match-data - (save-excursion - (let ((end-marker (copy-marker (or end (point-max)))) - (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) - (save-excursion - ;; Check previous line indent - (forward-line -1) - (setq line-start (point) - line-end (save-excursion (back-to-indentation) (point))) - ;; Check next line indent - (forward-line 2) - (setq next-start (point) - next-end (save-excursion (back-to-indentation) (point))) - ;; Back to origin - (forward-line -1) - ;; Adjust indent - (let ((line-indent (- line-end line-start)) - (next-indent (- next-end next-start)) - indent) - (setq indent (min line-indent next-indent)) - (insert (make-string indent 32))))) - (forward-line 1))))) - (set-buffer-modified-p nil) + (unless indent-tabs-mode + (save-match-data + (save-excursion + (let ((end-marker (copy-marker (or end (point-max)))) + (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) + (save-excursion + ;; Check previous line indent + (forward-line -1) + (setq line-start (point) + line-end (save-excursion (back-to-indentation) (point))) + ;; Check next line indent + (forward-line 2) + (setq next-start (point) + next-end (save-excursion (back-to-indentation) (point))) + ;; Back to origin + (forward-line -1) + ;; Adjust indent + (let* ((line-indent (- line-end line-start)) + (next-indent (- next-end next-start)) + (indent (min line-indent next-indent))) + (insert (make-string indent ? ))))) + (forward-line 1))))) + (set-buffer-modified-p nil)) nil) ;;;###autoload diff --git a/modules/module-ansible.el b/modules/module-ansible.el index b75a8914c..d7beb367e 100644 --- a/modules/module-ansible.el +++ b/modules/module-ansible.el @@ -8,9 +8,8 @@ (associate! ansible-mode :in (yaml-mode) :files ("roles/")) (use-package company-ansible - :defer t - :init - (define-company-backend! ansible-mode (ansible))) + :commands (company-ansible) + :init (define-company-backend! ansible-mode (ansible))) (provide 'module-ansible) ;;; module-ansible.el ends here diff --git a/modules/module-cc.el b/modules/module-cc.el index c2a5fcaed..4877d6acc 100644 --- a/modules/module-cc.el +++ b/modules/module-cc.el @@ -1,4 +1,4 @@ -;;; module-cc.el +;;; module-cc.el --- C, C++, and Objective-C (use-package cmake-mode :mode "CMakeLists\\.txt$" @@ -13,11 +13,11 @@ (use-package cc-mode :defines (c-syntactic-context) :functions (c-toggle-electric-state c-toggle-auto-newline - c-skip-comments-and-strings c-forward-sws c-end-of-macro - c-font-lock-invalid-string csharp-log c-font-lock-declarators - c-get-lang-constant c-forward-keyword-clause - c-fontify-recorded-types-and-refs c-forward-type imenu--split - c-backward-sws c-determine-limit c-beginning-of-decl-1) + c-skip-comments-and-strings c-forward-sws c-end-of-macro + c-font-lock-invalid-string csharp-log c-font-lock-declarators + c-get-lang-constant c-forward-keyword-clause + c-fontify-recorded-types-and-refs c-forward-type imenu--split + c-backward-sws c-determine-limit c-beginning-of-decl-1) :commands (c-mode c++-mode objc-mode java-mode) :init (associate! objc-mode :match "\\.mm$") @@ -81,8 +81,7 @@ (define-company-backend! c++-mode (irony)) (define-company-backend! objc-mode (irony)) - ;; This is necessary because c-mode dervied modes like php-mode may wrongfully trigger - ;; these hooks. + ;; some c-mode dervied modes wrongfully trigger these hooks (like php-mode) (add-hook! (c-mode c++-mode ojbc-mode) (when (memq major-mode '(c-mode c++-mode objc-mode)) (flycheck-mode +1) diff --git a/modules/module-php.el b/modules/module-php.el index a4b916707..606d19e3a 100644 --- a/modules/module-php.el +++ b/modules/module-php.el @@ -15,8 +15,9 @@ (defun php-extras-company-setup ()) ;; company will set up itself (map! :map php-mode-map - (:localleader - :nv ";" 'narf/append-semicolon)) + (:localleader :nv ";" 'narf/append-semicolon) + :n "gd" 'ac-php-find-symbol-at-point + :n "gD" 'ac-php-location-stack-back) ;; Generate php-extras documentation and completion asynchronously (unless (file-exists-p (concat php-extras-eldoc-functions-file ".el")) @@ -38,8 +39,7 @@ (sp-local-pair "" :when '(("RET")) :post-handlers '("||\n[i]"))) (use-package php-refactor-mode - :init - (add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode)) + :init (add-hook! php-mode '(turn-on-eldoc-mode emr-initialize php-refactor-mode)) :config (require 'emr) (mapc (lambda (x) @@ -60,10 +60,8 @@ ;; PHP Repl (use-package php-boris :defer t - :init - (define-repl! php-mode php-boris) - :config - (evil-set-initial-state 'php-boris-mode 'emacs)) + :init (define-repl! php-mode php-boris) + :config (evil-set-initial-state 'php-boris-mode 'emacs)) (define-minor-mode php-laravel-mode "" diff --git a/modules/module-python.el b/modules/module-python.el index f1131d46a..15c18b7ca 100644 --- a/modules/module-python.el +++ b/modules/module-python.el @@ -32,7 +32,7 @@ anaconda-mode-eldoc-as-single-line t) :config - (map! :map anaconda-mode-map :m "gd" 'anaconda-mode-goto-definitions) + (map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions) (map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit) (advice-add 'anaconda-mode-doc-buffer :after 'narf*anaconda-mode-doc-buffer)