diff --git a/core/core-completion.el b/core/core-completion.el deleted file mode 100644 index b33f0b4fa..000000000 --- a/core/core-completion.el +++ /dev/null @@ -1,124 +0,0 @@ -;;; core-completion.el --- auto-completion, for the lazy typist - -(package! company - :commands (company-mode company-complete company-complete-common company-manual-begin) - :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-yasnippet) - company-quickhelp-delay nil - company-statistics-file (concat doom-temp-dir "company-stats-cache.el")) - - ;; vim-like omni-complete - (map! :i "C-SPC" 'doom/company-complete - (:prefix "C-x" - :i "C-l" 'doom/company-whole-lines - :i "C-k" 'doom/company-dict-or-keywords - :i "C-f" 'company-files - :i "C-]" 'company-tags - :i "s" 'company-ispell - :i "C-s" 'company-yasnippet - :i "C-o" 'company-capf - :i "C-n" 'company-dabbrev-code - :i "C-p" (λ! (let ((company-selection-wrap-around t)) - (call-interactively 'company-dabbrev-code) - (company-select-previous-or-abort))))) - - :config - (require 'company-capf) - (require 'company-yasnippet) - (push 'company-sort-by-occurrence company-transformers) - ;; Don't interfere with insert mode binding for `evil-delete-backward-word' - (define-key company-active-map "\C-w" nil) - - (map! (:map company-active-map - "C-o" 'company-search-kill-others - "C-n" 'company-select-next - "C-p" 'company-select-previous - "C-h" 'company-quickhelp-manual-begin - "C-S-h" 'company-show-doc-buffer - "C-S-s" 'company-search-candidates - "C-s" 'company-filter-candidates - "C-SPC" 'company-complete-common - [tab] 'company-complete-common-or-cycle - [backtab] 'company-select-previous - [escape] (λ! (company-abort) (evil-normal-state 1)) - [C-return] 'counsel-company) - - (:map company-search-map - "C-n" 'company-search-repeat-forward - "C-p" 'company-search-repeat-backward - [escape] 'company-search-abort)) - - (global-company-mode +1)) - -(package! company-dict - :commands company-dict - :config (setq company-dict-dir (concat doom-private-dir "dict"))) - -;; NOTE: Doesn't look pretty on OSX without emacs-mac -(package! company-quickhelp - :after company - :config (company-quickhelp-mode +1)) - -(package! company-statistics - :after company - :config (company-statistics-mode +1)) - -;; -(autoload 'company-dabbrev "company-dabbrev" nil t) -(autoload 'company-dabbrev-code "company-dabbrev-code" nil t) -(autoload 'company-etags "company-etags" nil t) -(autoload 'company-elisp "company-elisp" nil t) -(autoload 'company-files "company-files" nil t) -(autoload 'company-gtags "company-gtags" nil t) -(autoload 'company-ispell "company-ispell" nil t) - - -;; -;; Defuns -;; - -(defun doom/company-complete () - "Bring up the completion popup. If only one result, complete it." - (interactive) - (require 'company) - (when (and (company-manual-begin) - (= company-candidates-length 1)) - (company-complete-common))) - -(defun doom/company-whole-lines (command &optional arg &rest ignored) - "`company-mode' completion backend that completes whole-lines, akin to vim's -C-x C-l." - (interactive (list 'interactive)) - (require 'company) - (unless (bound-and-true-p company-mode) (company-mode)) - (let ((lines (split-string - (replace-regexp-in-string - "^[\t\s]+" "" - (concat (buffer-substring-no-properties (point-min) (line-beginning-position)) - (buffer-substring-no-properties (line-end-position) (point-max)))) - "\\(\r\n\\|[\n\r]\\)" t))) - (cl-case command - (interactive (company-begin-backend 'doom/company-whole-lines)) - (prefix (company-grab-line "^[\t\s]*\\(.+\\)" 1)) - (candidates (all-completions arg lines))))) - -(defun doom/company-dict-or-keywords () - "`company-mode' completion combining `company-dict' and `company-keywords'." - (interactive) - (require 'company-dict) - (require 'company-keywords) - (let ((company-backends '((company-keywords company-dict)))) - (call-interactively 'company-complete))) - -(provide 'core-completion) -;;; core-completion.el ends here diff --git a/core/core-evil.el b/core/core-evil.el deleted file mode 100644 index 7e3d8604d..000000000 --- a/core/core-evil.el +++ /dev/null @@ -1,337 +0,0 @@ -;;; core-evil.el - -;; TODO Document - -(defvar doom-evil-leader "," - "The key, used by the `map!' macro for :leader bindings.") - -(defvar doom-evil-localleader "\\" - "The key, used by the `map!' macro for :localleader bindings.") - - -;; -;; Packages -;; - -(package! evil :demand t - :config - (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-want-fine-undo nil - - 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") - - (evil-mode +1) - (evil-select-search-module 'evil-search-module 'evil-search) - - (defpopup! ("*evil-registers*" :size 0.3) - ("*Command Line*" :size 8)) - - (mapc (lambda (r) (evil-set-initial-state (car r) (cdr r))) - '((compilation-mode . normal) - (help-mode . normal) - (message-mode . normal) - (debugger-mode . normal) - (image-mode . normal) - (doc-view-mode . normal) - (eww-mode . normal) - (tabulated-list-mode . emacs) - (profile-report-mode . emacs) - (Info-mode . emacs) - (view-mode . emacs) - (comint-mode . emacs) - (cider-repl-mode . emacs) - (term-mode . emacs) - (calendar-mode . emacs) - (Man-mode . emacs) - (grep-mode . emacs))) - - ;;; Macros - (defsubst doom--evil-textobj! (key inner-fn &optional outer-fn) - "Define a text object." - (define-key evil-inner-text-objects-map key inner-fn) - (define-key evil-outer-text-objects-map key (or outer-fn inner-fn))) - - ;; Shortcuts for the evil expression register - (defmacro $= (str &rest args) `(calc-eval (format ,str ,@args))) - (defmacro $r (char) `(evil-get-register ,char)) - (defmacro $expand (path) `(evil-ex-replace-special-filenames ,path)) - - ;;; Evil hacks - (defun doom*evil-esc () - "Disable search highlights and quit the minibuffer if open." - (when (minibuffer-window-active-p (minibuffer-window)) - (abort-recursive-edit)) - (when (evil-ex-hl-active-p 'evil-ex-search) - (evil-ex-nohighlight))) - (advice-add 'evil-force-normal-state :after 'doom*evil-esc) - - ;; Move to new split - (defun doom*evil-window-follow (&rest _) (evil-window-down 1)) - (defun doom*evil-window-vfollow (&rest _) (evil-window-right 1)) - (advice-add 'evil-window-split :after 'doom*evil-window-follow) - (advice-add 'evil-window-vsplit :after 'doom*evil-window-vfollow) - - ;; Fix harmless (yet disruptive) error reporting w/ hidden buffers caused by - ;; workgroups killing windows - ;; TODO Delete timer on dead windows? - ;; (defun doom*ignore-errors (orig-fn &rest args) - ;; (ignore-errors (apply orig-fn args))) - ;; (advice-add 'evil-ex-hl-do-update-highlight :around 'doom*ignore-errors) - - ;; Hide keystroke display while isearch is active - (add-hook! isearch-mode (setq echo-keystrokes 0)) - (add-hook! isearch-mode-end (setq echo-keystrokes 0.02)) - - ;; monkey patch `evil-ex-replace-special-filenames' to add more ex - ;; substitution flags to evil-mode - (advice-add 'evil-ex-replace-special-filenames - :override 'doom*evil-ex-replace-special-filenames) - - ;; Extra argument types for highlighting buffer (or global) regexp matches - (evil-ex-define-argument-type buffer-match :runner doom-evil-ex-buffer-match) - (evil-ex-define-argument-type global-match :runner doom-evil-ex-global-match) - - (evil-define-interactive-code "" - :ex-arg buffer-match - (list (when (evil-ex-p) evil-ex-argument))) - (evil-define-interactive-code "" - :ex-arg global-match - (when (evil-ex-p) (evil-ex-parse-global evil-ex-argument))) - - (evil-define-operator doom:evil-ex-global (beg end pattern command &optional invert) - "Rewritten :g[lobal] that will highlight buffer matches. Takes the same arguments." - :motion mark-whole-buffer :move-point nil - (interactive "") - (evil-ex-global beg end pattern command invert)) - - (evil-define-operator doom:align (&optional beg end bang pattern) - "Ex interface to `align-regexp'. Accepts vim-style regexps." - (interactive "") - (align-regexp - beg end - (concat "\\(\\s-*\\)" - (if bang - (regexp-quote pattern) - (evil-transform-vim-style-regexp pattern))) - 1 1))) - -(package! evil-anzu - :init - (setq anzu-cons-mode-line-p nil - anzu-minimum-input-length 1 - anzu-search-threshold 250) - - ;; evil-anzu is strangely slow on startup. Byte compiling doesn't help. We use - ;; this to lazy load it instead. - (defun doom*evil-search (&rest _) - (require 'evil-anzu) - (advice-remove 'evil-ex-start-search 'doom*evil-search)) - (advice-add 'evil-ex-start-search :before 'doom*evil-search)) - -(package! evil-args - :commands (evil-inner-arg evil-outer-arg evil-forward-arg evil-backward-arg - evil-jump-out-args) - :config (doom--evil-textobj! "a" 'evil-inner-arg 'evil-outer-arg)) - -(package! evil-commentary - :commands (evil-commentary evil-commentary-yank evil-commentary-line) - :config (evil-commentary-mode 1)) - -(package! evil-easymotion :defer 1 - :config - (defvar doom--evil-snipe-repeat-fn) - (evilem-default-keybindings "g SPC") - (evilem-define (kbd "g SPC n") 'evil-ex-search-next) - (evilem-define (kbd "g SPC N") 'evil-ex-search-previous) - (evilem-define "gs" 'evil-snipe-repeat - :pre-hook (save-excursion (call-interactively #'evil-snipe-s)) - :bind ((evil-snipe-scope 'buffer) - (evil-snipe-enable-highlight) - (evil-snipe-enable-incremental-highlight))) - (evilem-define "gS" 'evil-snipe-repeat-reverse - :pre-hook (save-excursion (call-interactively #'evil-snipe-s)) - :bind ((evil-snipe-scope 'buffer) - (evil-snipe-enable-highlight) - (evil-snipe-enable-incremental-highlight))) - - (setq doom--evil-snipe-repeat-fn - (evilem-create 'evil-snipe-repeat - :bind ((evil-snipe-scope 'whole-buffer) - (evil-snipe-enable-highlight) - (evil-snipe-enable-incremental-highlight))))) - -(package! evil-embrace - :after evil-surround - :config - (setq evil-embrace-show-help-p nil) - (evil-embrace-enable-evil-surround-integration) - - ;; Defuns - (defun doom--embrace-get-pair (char) - (acond ((cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist)) - `(,(car it) . ,(cdr it))) - ((assoc-default char embrace--pairs-list) - (if (functionp (embrace-pair-struct-read-function it)) - (let ((pair (funcall (embrace-pair-struct-read-function it)))) - `(,(car pair) . ,(cdr pair))) - `(,(embrace-pair-struct-left it) . ,(embrace-pair-struct-right it)))) - (t `(,char . ,char)))) - - (defun doom-embrace-escaped () - "Backslash-escaped surround character support for embrace." - (let ((char (read-char "\\"))) - (if (eq char 27) - (cons "" "") - (let ((pair (doom--embrace-get-pair (string char))) - (text (if (sp-point-in-string) "\\\\%s" "\\%s"))) - (cons (format text (car pair)) - (format text (cdr pair))))))) - - (defun doom-embrace-latex () - "LaTeX command support for embrace." - (cons (format "\\%s{" (read-string "\\")) "}")) - - (defun doom-embrace-elisp-fn () - "Elisp function support for embrace." - (cons (format "(%s " (or (read-string "(") "")) ")")) - - ;; Make embrace support escaped sequences - (push (cons ?\\ (make-embrace-pair-struct - :key ?\\ - :read-function 'doom-embrace-escaped - :left-regexp "\\[[{(]" - :right-regexp "\\[]})]")) - (default-value 'embrace--pairs-list)) - - ;; Add extra pairs - (add-hook 'LaTeX-mode-hook 'embrace-LaTeX-mode-hook) - (add-hook 'org-mode-hook 'embrace-org-mode-hook) - (add-hook! emacs-lisp-mode - (embrace-add-pair ?\` "`" "'")) - (add-hook! (emacs-lisp-mode lisp-mode) - (embrace-add-pair-regexp ?f "([^ ]+ " ")" 'doom-embrace-elisp-fn)) - (add-hook! (org-mode latex-mode) - (embrace-add-pair-regexp ?l "\\[a-z]+{" "}" 'doom-embrace-latex))) - -(package! evil-escape - :commands evil-escape-mode - :init - (setq evil-escape-key-sequence "jk" - evil-escape-delay 0.25) - - ;; evil-escape causes noticable lag in commands that start with j, so we - ;; enable it only where we need it. - (defun doom|evil-escape-disable () (evil-escape-mode -1)) - (defun doom|evil-escape-enable () (evil-escape-mode +1)) - (add-hook 'evil-insert-state-entry-hook 'doom|evil-escape-enable) - (add-hook 'evil-insert-state-exit-hook 'doom|evil-escape-disable) - (add-hook 'evil-replace-state-entry-hook 'doom|evil-escape-enable) - (add-hook 'evil-replace-state-exit-hook 'doom|evil-escape-disable)) - -(package! evil-exchange - :commands evil-exchange - :config - (defun doom*evil-exchange-off () - (when evil-exchange--overlays (evil-exchange-cancel))) - (advice-add 'evil-force-normal-state :after 'doom*evil-exchange-off)) - -(package! evil-indent-plus - :commands (evil-indent-plus-i-indent - evil-indent-plus-a-indent - evil-indent-plus-i-indent-up - evil-indent-plus-a-indent-up - evil-indent-plus-i-indent-up-down - evil-indent-plus-a-indent-up-down) - :config - (doom--evil-textobj! "i" 'evil-indent-plus-i-indent 'evil-indent-plus-a-indent) - (doom--evil-textobj! "I" 'evil-indent-plus-i-indent-up 'evil-indent-plus-a-indent-up) - (doom--evil-textobj! "J" 'evil-indent-plus-i-indent-up-down 'evil-indent-plus-a-indent-up-down)) - -(package! evil-matchit - :commands (evilmi-jump-items evilmi-text-object global-evil-matchit-mode) - :config - (global-evil-matchit-mode 1) - (doom--evil-textobj! "%" 'evilmi-text-object) - - (defun doom/evil-matchit-or-toggle-fold () - "If on a fold-able element, toggle the fold (`hs-toggle-hiding'). Otherwise, -if on a delimiter, jump to the matching one (`evilmi-jump-items')." - (interactive) - (if (ignore-errors (hs-already-hidden-p)) - (hs-toggle-hiding) - (call-interactively 'evilmi-jump-items)))) - -(package! evil-multiedit - :commands (evil-multiedit-match-all - evil-multiedit-match-and-next - evil-multiedit-match-and-prev - evil-multiedit-match-symbol-and-next - evil-multiedit-match-symbol-and-prev - evil-multiedit-toggle-or-restrict-region - evil-multiedit-next - evil-multiedit-prev - evil-multiedit-abort - evil-multiedit-ex-match) - :config (evil-multiedit-default-keybinds)) - -(package! evil-numbers - :commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt)) - -(package! evil-textobj-anyblock - :commands (evil-textobj-anyblock-inner-block evil-textobj-anyblock-a-block) - :init (doom--evil-textobj! "B" 'evil-textobj-anyblock-inner-block 'evil-textobj-anyblock-a-block)) - -(package! evil-search-highlight-persist :demand t - :config - (global-evil-search-highlight-persist t) - (advice-add 'evil-force-normal-state :after 'evil-search-highlight-persist-remove-all)) - -(package! evil-snipe :demand t - :config - (setq evil-snipe-smart-case t - evil-snipe-repeat-keys nil ; using space to repeat - evil-snipe-scope 'line - evil-snipe-repeat-scope 'visible - evil-snipe-override-evil-repeat-keys nil ; causes problems with remapped ; - evil-snipe-char-fold t - evil-snipe-aliases '((?\[ "[[{(]") - (?\] "[]})]") - (?\; "[;:]"))) - (evil-snipe-mode 1) - (evil-snipe-override-mode 1) - - ;; Switch to evil-easymotion/avy after first snipe - (map! :map evil-snipe-parent-transient-map - "C-;" (λ! (require 'evil-easymotion) - (call-interactively doom--evil-snipe-repeat-fn)))) - -(package! evil-surround - :commands (global-evil-surround-mode - evil-surround-edit - evil-Surround-edit - evil-surround-region) - :config (global-evil-surround-mode 1)) - -(package! evil-visualstar - :commands (global-evil-visualstar-mode - evil-visualstar/begin-search - evil-visualstar/begin-search-forward - evil-visualstar/begin-search-backward) - :config (global-evil-visualstar-mode 1)) - -(provide 'core-evil) -;;; core-evil.el ends here diff --git a/core/core-jump.el b/core/core-jump.el deleted file mode 100644 index 5dacb2e2b..000000000 --- a/core/core-jump.el +++ /dev/null @@ -1,51 +0,0 @@ -;;; custom-tags.el - -;; TODO Finish me! - -(defvar doom-ctags-alist - '((ruby-mode :exec "ripper-tags -R -f %t --emacs") - (c++-mode :ext "cpp") - (c-mode :ext "c") - (all :exec "find . -type f -iname \"*.%e\" | ctags -e -f %t -") - ;; TODO add c-mode/c++-mode ctags - )) - - -(add-hook 'find-file-hook 'doom|init-tags) -(defun doom|init-tags () - (awhen (doom/tags-p) - (setq tags-table-list (list it)))) - -;; TODO -;; (defun doom/tags-generate () -;; (interactive) -;; (let ((command (assoc major-mode doom-ctags-alist)) -;; (default-directory (doom/project-root))) -;; (unless command -;; (user-error "No tag generator for %s" major-mode)) -;; (async-shell-command command "*doom:generate-tags*"))) - -;;;###autoload -(defun doom/find-def () - "Find definition using tags, falling back to dumb-jump otherwise." - (interactive) - (let ((orig-pt (point)) - (orig-file (buffer-file-name))) - (cond ((and (doom/tags-p) - ;; TODO - ;; (progn (call-interactively 'helm-etags-select) - ;; (and (/= orig-pt (point)) - ;; (f-same? orig-file buffer-file-name))) - )) - ((progn (dumb-jump-go) - (and (/= orig-pt (point)) - (f-same? orig-file buffer-file-name)))) - (t (call-interactively 'evil-goto-definition))))) - -;;;###autoload -(defun doom/tags-p () - (let ((path (expand-file-name ".tags" (doom/project-root)))) - (and (f-exists? path) path))) - -(provide 'custom-tags) -;;; custom-tags.el ends here diff --git a/core/core-modeline.el b/core/core-modeline.el deleted file mode 100644 index de1fe34b3..000000000 --- a/core/core-modeline.el +++ /dev/null @@ -1,505 +0,0 @@ -;;; core-modeline.el --- make mode-lines sexy again - -;; This file tries to be a self-contained configuration of my mode-line. - -;;; These are the invisible dependencies -;; Required -;;(require 'f) -;;(require 's) -;;(require 'evil) -;;(require 'projectile) -;;(require 'all-the-icons) - -;; Optional -;;(require 'flycheck) -;;(require 'anzu) -;;(require 'evil-anzu) -;;(require 'iedit) -;;(require 'evil-multiedit) - -(package! powerline) - -(package! all-the-icons :demand t) - -(package! eldoc-eval :demand t - :config - (setq eldoc-in-minibuffer-show-fn 'doom-eldoc-show-in-mode-line) - (eldoc-in-minibuffer-mode +1)) - - - - -;; -;; Variables -;; - -(defvar doom-modeline-formats '() - "") - -(defvar doom-modeline-height 29 - "How tall the mode-line should be (only respected in GUI emacs).") - -(defvar doom-modeline-bar-width 3 - "How wide the mode-line bar should be (only respected in GUI emacs).") - - -;; -;; Custom faces -;; - -(defface doom-modeline-buffer-path - '((t (:inherit mode-line :bold t))) - "Face used for the dirname part of the buffer path.") - -(defface doom-modeline-buffer-project - '((t (:inherit doom-modeline-buffer-path :bold nil))) - "Face used for the filename part of the mode-line buffer path.") - -(defface doom-modeline-buffer-modified - '((t (:inherit highlight :background nil))) - "Face used for the 'unsaved' symbol in the mode-line.") - -(defface doom-modeline-buffer-major-mode - '((t (:inherit mode-line :bold t))) - "Face used for the major-mode segment in the mode-line.") - -(defface doom-modeline-highlight - '((t (:inherit mode-line))) - "Face for bright segments of the mode-line.") - -(defface doom-modeline-panel - '((t (:inherit mode-line))) - "Face for 'X out of Y' segments, such as `*anzu', `*evil-substitute' and -`iedit'") - -(defface doom-modeline-info - `((t (:inherit success))) - "Face for info-level messages in the modeline. Used by `*vc'.") - -(defface doom-modeline-warning - `((t (:inherit warning))) - "Face for warnings in the modeline. Used by `*flycheck'") - -(defface doom-modeline-urgent `((t (:inherit error))) - "Face for errors in the modeline. Used by `*flycheck'") - -;; Bar -(defface doom-modeline-bar '((t (:inherit highlight :foreground nil))) - "The face used for the left-most bar on the mode-line of an active window.") - -(defface doom-modeline-eldoc-bar '((t (:inherit shadow :foreground nil))) - "The face used for the left-most bar on the mode-line when eldoc-eval is -active.") - -(defface doom-modeline-inactive-bar '((t (:inherit mode-line-inactive))) - "The face used for the left-most bar on the mode-line of an inactive window.") - - -;; -;; Bootstrap -;; - -;; all-the-icons doesn't work in the terminal, so we "disable" it. -(unless window-system - (defun all-the-icons-octicon (&rest _) "" "") - (defun all-the-icons-faicon (&rest _) "" "") - (defun all-the-icons-fileicon (&rest _) "" "") - (defun all-the-icons-wicon (&rest _) "" "") - (defun all-the-icons-alltheicon (&rest _) "" "")) - -(defmacro modeline! (name &rest def) - (declare (indent defun))) ;; TODO - -(defvar-local doom-modeline-env-version nil) -(defvar-local doom-modeline-env-command nil) -(add-hook 'focus-in-hook 'doom-modeline|update-env) -(add-hook 'find-file-hook 'doom-modeline|update-env) -(defun doom-modeline|update-env () - (when doom-modeline-env-command - (let* ((default-directory (doom-project-root)) - (s (shell-command-to-string doom-ml--env-command))) - (setq doom-modeline-env-version (if (string-match "[ \t\n\r]+\\'" s) - (replace-match "" t t s) - s))))) - -(doom-define-setting 'env - "Command used to set the interpreter version in the current buffer." - :type '(stringp functionp) - :hook (lambda (command) (setq doom-modeline-env-command x))) - -;; (set! python-mode :env "python --version 2>&1 | cut -d' ' -f2") -;; (set! ruby-mode :env "ruby --version 2>&1 | cut -d' ' -f2") - -(defsubst active() (eq (selected-window) powerline-selected-window)) - -(defun doom-ml-flycheck-count (state) - "Return flycheck information for the given error type STATE." - (when (flycheck-has-current-errors-p state) - (if (eq 'running flycheck-last-status-change) - "?" - (cdr-safe (assq state (flycheck-count-errors flycheck-current-errors)))))) - -(defun doom-make-xpm (color height width) - "Create an XPM bitmap." - (unless (featurep 'powerline) - (require 'powerline) - (pl/memoize 'doom-make-xpm)) - (when window-system - (propertize - " " 'display - (let ((data nil) - (i 0)) - (setq data (make-list height (make-list width 1))) - (pl/make-xpm "percent" color color (reverse data)))))) - -(defun doom-buffer-path () - "Displays the buffer's full path relative to the project root (includes the -project root). Excludes the file basename. See `doom-buffer-name' for that." - (if buffer-file-name - (let* ((default-directory (f-dirname buffer-file-name)) - (buffer-path (f-relative buffer-file-name (doom-project-root))) - (max-length (truncate (* (window-body-width) 0.4)))) - (when (and buffer-path (not (equal buffer-path "."))) - (if (> (length buffer-path) max-length) - (let ((path (reverse (split-string buffer-path "/" t))) - (output "")) - (when (and path (equal "" (car path))) - (setq path (cdr path))) - (while (and path (<= (length output) (- max-length 4))) - (setq output (concat (car path) "/" output)) - (setq path (cdr path))) - (when path - (setq output (concat "../" output))) - (when (string-suffix-p "/" output) - (setq output (substring output 0 -1))) - output) - buffer-path))) - "%b")) - -(defun doom-eldoc-show-in-mode-line (input) - "Display string STR in the mode-line next to minibuffer." - (with-current-buffer (eldoc-current-buffer) - (let* ((max (window-width (selected-window))) - (str (and (stringp input) (concat " " input))) - (len (length str)) - (tmp-str str) - (mode-line-format (or (and str (doom-eldoc-modeline)) - mode-line-format)) - roll mode-line-in-non-selected-windows) - (catch 'break - (if (and (> len max) eldoc-mode-line-rolling-flag) - (progn - (while (setq roll (sit-for 0.3)) - (setq tmp-str (substring tmp-str 2) - mode-line-format (concat tmp-str " [<]" str)) - (force-mode-line-update) - (when (< (length tmp-str) 2) (setq tmp-str str))) - (unless roll - (when eldoc-mode-line-stop-rolling-on-input - (setq eldoc-mode-line-rolling-flag nil)) - (throw 'break nil))) - (force-mode-line-update) - (sit-for eldoc-show-in-mode-line-delay)))) - (force-mode-line-update))) - - -;; -;; Segments -;; - -(defun *buffer-project () - "Displays `default-directory', for special buffers like the scratch buffer." - (let ((face (if (active) 'doom-modeline-buffer-project))) - (concat (all-the-icons-octicon - "file-directory" - :face face - :v-adjust -0.05 - :height 1.25) - (propertize (concat " " (abbreviate-file-name (doom-project-root))) - 'face face)))) - -(defun *buffer-info () - "Combined information about the current buffer, including the current working -directory, the file name, and its state (modified, read-only or non-existent)." - (let ((all-the-icons-scale-factor 1.2) - (modified-p (buffer-modified-p)) - faces) - (if (active) (push 'doom-modeline-buffer-path faces)) - (if modified-p (push 'doom-modeline-buffer-modified faces)) - (concat (if buffer-read-only - (concat (all-the-icons-octicon - "lock" - :face 'doom-modeline-warning - :v-adjust -0.05) - " ") - (when modified-p - (concat - (all-the-icons-faicon "floppy-o" - :face 'doom-modeline-buffer-modified - :v-adjust -0.1) - " "))) - (when (and buffer-file-name (not (file-exists-p buffer-file-name))) - (concat (all-the-icons-octicon - "circle-slash" - :face 'doom-modeline-urgent - :v-adjust -0.05) - " ")) - (propertize (doom-buffer-path) - 'face (if faces `(:inherit ,faces)))))) - -(defun *buffer-encoding () - "The encoding and eol style of the buffer." - (concat (let ((eol-type (coding-system-eol-type buffer-file-coding-system))) - (cond ((eq eol-type 0) "LF ") - ((eq eol-type 1) "CRLF ") - ((eq eol-type 2) "CR "))) - (let* ((sys (coding-system-plist buffer-file-coding-system)) - (sys-name (plist-get sys :name)) - (sys-cat (plist-get sys :category))) - (cond ((memq sys-cat '(coding-category-undecided coding-category-utf-8)) - "UTF-8") - (t (upcase (symbol-name sys-name))))) - " ")) - -(defun *major-mode () - "The major mode, including process, environment and text-scale info." - (propertize - (concat (format-mode-line mode-name) - (if (stringp mode-line-process) mode-line-process) - (if doom-modeline-env-version (concat " " doom-modeline-env-version)) - (and (featurep 'face-remap) - (/= text-scale-mode-amount 0) - (format " (%+d)" text-scale-mode-amount))) - 'face (if (active) 'doom-modeline-buffer-major-mode))) - -(defun *vc () - "Displays the current branch, colored based on its state." - (when (and vc-mode buffer-file-name) - (let ((backend (vc-backend buffer-file-name)) - (state (vc-state buffer-file-name)) - (face 'mode-line-inactive) - (active (active)) - (all-the-icons-scale-factor 1.0) - (all-the-icons-default-adjust -0.1)) - (concat (propertize " " 'face 'variable-pitch) - (cond ((memq state '(edited added)) - (if active (setq face 'doom-modeline-info)) - (all-the-icons-octicon - "git-branch" - :face face - :height 1.2 - :v-adjust -0.05)) - ((eq state 'needs-merge) - (if active (setq face 'doom-modeline-info)) - (all-the-icons-octicon "git-merge" :face face)) - ((eq state 'needs-update) - (if active (setq face 'doom-modeline-warning)) - (all-the-icons-octicon "arrow-down" :face face)) - ((memq state '(removed conflict unregistered)) - (if active (setq face 'doom-modeline-urgent)) - (all-the-icons-octicon "alert" :face face)) - (t - (if active (setq face 'mode-line)) - (all-the-icons-octicon - "git-branch" - :face face - :height 1.2 - :v-adjust -0.05))) - " " - (propertize (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2)) - 'face (if active face)) - " " - (propertize " " 'face 'variable-pitch))))) - -(defvar-local doom--flycheck-err-cache nil "") -(defvar-local doom--flycheck-cache nil "") -(defun *flycheck () - "Persistent and cached flycheck indicators in the mode-line." - (when (and (featurep 'flycheck) flycheck-mode) - (if (or flycheck-current-errors - (eq 'running flycheck-last-status-change)) - (or (and (or (eq doom--flycheck-err-cache doom--flycheck-cache) - (memq flycheck-last-status-change '(running not-checked))) - (if (eq flycheck-last-status-change 'running) - (concat " " - (all-the-icons-octicon - "ellipsis" - :face 'font-lock-doc-face - :height 1.1 - :v-adjust 0) - " ") - doom--flycheck-cache)) - (and (setq doom--flycheck-err-cache flycheck-current-errors) - (setq doom--flycheck-cache - (let ((fw (doom-ml-flycheck-count 'warning)) - (fe (doom-ml-flycheck-count 'error))) - (concat (if (or fe fw) " ") - (if fe (concat - (all-the-icons-octicon "circle-slash" :face 'doom-modeline-urgent :height 1.0 :v-adjust 0) - (propertize " " 'face 'variable-pitch) - (propertize (format "%d" fe) 'face 'doom-modeline-urgent) - " " - )) - (if fw (concat - (all-the-icons-octicon "alert" :face 'doom-modeline-warning :height 0.9 :v-adjust 0) - (propertize " " 'face 'variable-pitch) - (propertize (format "%d" fw) 'face 'doom-modeline-warning) - " " - )) - (if (or fe fw) - " " - (when (active) - (all-the-icons-octicon "check" :height 1.2 :v-adjust -0.06)))))))) - (concat - " " - (all-the-icons-octicon "check" - :face (if (active) 'doom-modeline-info) - :height 1.2 - :v-adjust -0.06) - " ")))) - -(defun *selection-info () - "Information about the current selection, such as how many characters and -lines are selected, or the NxM dimensions of a block selection." - (when (and (active) (evil-visual-state-p)) - (concat - " " - (propertize - (let ((reg-beg (region-beginning)) - (reg-end (region-end)) - (evil (eq 'visual evil-state))) - (let ((lines (count-lines reg-beg (min (1+ reg-end) (point-max)))) - (chars (- (1+ reg-end) reg-beg)) - (cols (1+ (abs (- (evil-column reg-end) - (evil-column reg-beg)))))) - (cond - ;; rectangle selection - ((or (bound-and-true-p rectangle-mark-mode) - (and evil (eq 'block evil-visual-selection))) - (format " %dx%dB " lines (if evil cols (1- cols)))) - ;; line selection - ((or (> lines 1) (eq 'line evil-visual-selection)) - (if (and (eq evil-state 'visual) (eq evil-this-type 'line)) - (format " %dL " lines) - (format " %dC %dL " chars lines))) - (t (format " %dC " (if evil chars (1- chars))))))) - 'face 'doom-modeline-highlight)))) - -(defun *macro-recording () - "Display current macro being recorded." - (when (and (active) defining-kbd-macro) - (let ((sep (propertize " " 'face 'doom-modeline-panel))) - (concat sep - (propertize (char-to-string evil-this-macro) - 'face 'doom-modeline-panel) - sep - (all-the-icons-octicon "triangle-right" - :face 'doom-modeline-panel - :v-adjust -0.05) - sep)))) - -(make-variable-buffer-local 'anzu--state) -(defun *anzu () - "Show the match index and total number thereof. Requires `evil-anzu'." - (when (and (featurep 'evil-anzu) (evil-ex-hl-active-p 'evil-ex-search)) - (propertize - (format " %s/%d%s " - anzu--current-position anzu--total-matched - (if anzu--overflow-p "+" "")) - 'face (if (active) 'doom-modeline-panel)))) - -(defun *evil-substitute () - "Show number of :s matches in real time." - (when (and (evil-ex-p) (evil-ex-hl-active-p 'evil-ex-substitute)) - (propertize - (let ((range (if evil-ex-range - (cons (car evil-ex-range) (cadr evil-ex-range)) - (cons (line-beginning-position) (line-end-position)))) - (pattern (car-safe (evil-delimited-arguments evil-ex-argument 2)))) - (if pattern - (format " %s matches " - (count-matches pattern (car range) (cdr range)) - evil-ex-argument) - " ... ")) - 'face (if (active) 'doom-modeline-panel)))) - -(defun *iedit () - "Show the number of iedit regions matches + what match you're on." - (when (and (boundp 'iedit-mode) iedit-mode) - (propertize - (let ((this-oc (let (message-log-max) (iedit-find-current-occurrence-overlay))) - (length (or (ignore-errors (length iedit-occurrences-overlays)) 0))) - (format - " %s/%s " - (save-excursion - (unless this-oc - (iedit-prev-occurrence) - (setq this-oc (iedit-find-current-occurrence-overlay))) - (if this-oc - ;; NOTE: Not terribly reliable - (- length (-elem-index this-oc iedit-occurrences-overlays)) - "-")) - length)) - 'face (if (active) 'doom-modeline-panel)))) - -(defun *media-info () - (cond ((eq major-mode 'image-mode) - (let ((size (image-size (image-get-display-property) :pixels))) - (format " %dx%d " (car size) (cdr size)))))) - - -;; -;; Mode lines -;; - -(doom-modeline-define 'main - `(let* ((meta (concat (*macro-recording) - (*anzu) - (*evil-substitute) - (*iedit))) - (lhs (list (doom-make-xpm (face-background (if (active) - 'doom-modeline-bar - 'doom-modeline-inactive-bar)) - doom-modeline-height - doom-modeline-bar-width) - (if (= (length meta) 0) " %I " meta) - " " - (*buffer-info) - " %l:%c %p " - (*selection-info))) - (rhs (list (*buffer-encoding) - (*vc) - (*major-mode) - (*flycheck))) - (mid (propertize - " " 'display `((space :align-to (- (+ right right-fringe right-margin) - ,(+ 1 (string-width (format-mode-line rhs))))))))) - (list lhs mid rhs))) - -(doom-modeline-define 'eldoc - `(list (list ,(when window-system - `(doom-make-xpm (face-background 'doom-modeline-eldoc-bar) - doom-modeline-height - doom-modeline-bar-width)) - (and (bound-and-true-p str) str)) - (propertize " " 'display `((space :align-to (1- (+ right right-fringe right-margin))))))) - -(doom-modeline-define 'minimal - `(let* ((lhs (list (doom-make-xpm (face-background (if (active) - 'doom-modeline-bar - 'doom-modeline-inactive-bar)) - doom-modeline-height - doom-modeline-bar-width) - " " - (*buffer-project))) - (rhs (list (*major-mode))) - (mid (propertize - " " 'display `((space :align-to (- (+ right right-fringe right-margin) - ,(+ 1 (string-width (format-mode-line rhs))))))))) - (list lhs mid rhs))) - -;; -(setq-default mode-line-format (assq 'main doom-modeline-formats)) - -(provide 'core-modeline) -;;; core-modeline.el ends here diff --git a/core/core-os.el b/core/core-os.el deleted file mode 100644 index a9cdd497b..000000000 --- a/core/core-os.el +++ /dev/null @@ -1,59 +0,0 @@ -;;; core-os.el --- consistent behavior across OSes - -(defconst IS-MAC (eq system-type 'darwin)) -(defconst IS-LINUX (eq system-type 'gnu/linux)) -(defconst IS-WINDOWS (eq system-type 'windows-nt)) - -(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING) - ;; Use a shared clipboard - select-enable-clipboard t - select-enable-primary t) - - -;;; -;; OS-specific configs -(cond (IS-MAC - ;; Prefixes: Command = M, Alt = A - (setq mac-command-modifier 'meta - mac-option-modifier 'alt - ;; sane trackpad/mouse scroll settings - mac-redisplay-dont-reset-vscroll t - mac-mouse-wheel-smooth-scroll nil - mouse-wheel-scroll-amount '(5 ((shift) . 2)) ; one line at a time - mouse-wheel-progressive-speed nil ; don't accelerate scrolling - ;; Curse Lion and its sudden but inevitable fullscreen mode! - ;; NOTE Meaningless to railwaycat's emacs-mac build - ns-use-native-fullscreen nil - ;; Don't open files from the workspace in a new frame - ns-pop-up-frames nil) - - ;; On OSX, in GUI Emacs, `exec-path' isn't populated properly (it should - ;; match $PATH in my shell). `exe-path-from-shell' fixes this. - (package! exec-path-from-shell) - (when (display-graphic-p) - (setenv "SHELL" "/usr/local/bin/zsh") - ;; `exec-path-from-shell' is slow, so bring out the cache - (setq exec-path - (or (persistent-soft-fetch 'exec-path "emacs") - (persistent-soft-store - 'exec-path - (progn - (require 'exec-path-from-shell) - (exec-path-from-shell-initialize) - exec-path) - "emacs")))) - - (after! evil - ;; On OSX, stop copying each visual state move to the clipboard: - ;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on - ;; Most of this code grokked from: - ;; http://stackoverflow.com/questions/15873346/elisp-rename-macro - (when (or (featurep 'mac) (featurep 'ns)) - (advice-add 'evil-visual-update-x-selection :override 'ignore)))) - - (IS-LINUX - (setq x-super-keysym 'meta - x-meta-keysym 'alt))) - -(provide 'core-os) -;;; core-os.el ends here diff --git a/core/core-project.el b/core/core-project.el deleted file mode 100644 index 1c9a6daf4..000000000 --- a/core/core-project.el +++ /dev/null @@ -1,124 +0,0 @@ -;;; core-project.el --- tools for getting around your project - -;; I want Emacs to be nominally aware of the projects. `projectile' provides -;; tools for digging through project files and exposing an API I can use to make -;; other plugins/features project-aware. -(package! projectile :demand t - :init - (setq projectile-cache-file (concat doom-temp-dir "/projectile.cache") - projectile-completion-system 'ivy - projectile-enable-caching t - projectile-file-exists-remote-cache-expire nil - projectile-globally-ignored-directories `(,doom-temp-dir ".sync") - projectile-globally-ignored-file-suffixes '(".elc" ".pyc" ".o") - projectile-globally-ignored-files '(".DS_Store" "Icon ") - projectile-indexing-method 'alien - projectile-known-projects-file (concat doom-temp-dir "/projectile.projects") - projectile-project-root-files '(".git" ".hg" ".svn" ".project") - projectile-require-project-root nil) - - :config - (projectile-global-mode +1) - - (mapc (lambda (r) (push r projectile-other-file-alist)) - '(("less" "css") - ("styl" "css") - ("sass" "css") - ("scss" "css") - ("css" "scss" "sass" "less" "styl") - ("jade" "html") - ("pug" "html") - ("html" "jade" "pug" "jsx" "tsx"))) - - (defun doom-project-p (&optional strict-p) - "Whether or not this buffer is currently in a project or not." - (let ((projectile-require-project-root strict-p)) - (projectile-project-p))) - - (defun doom-project-root (&optional strict-p) - "Get the path to the root of your project." - (let ((projectile-require-project-root strict-p)) - (projectile-project-root))) - - (defun doom-project-has-files (files &optional root) - "Return non-nil if FILES exist in the project root." - (let ((root (or root (doom-project-root))) - (files (if (listp files) files (list files))) - (found-p (if files t))) - (while (and found-p files) - (let ((file (expand-file-name (pop files) root))) - (setq found-p (if (string-suffix-p "/" file) - (file-directory-p file) - (file-exists-p file))))) - found-p)) - - (defun doom*projectile-cache-current-file (orig-fun &rest args) - "Don't cache ignored files." - (unless (--any (f-descendant-of? buffer-file-name it) - (projectile-ignored-directories)) - (apply orig-fun args))) - (advice-add 'projectile-cache-current-file :around 'doom*projectile-cache-current-file)) - - -;; -;; Autoloaded Packages -;; - -;; A side-panel for browsing my project files. Inspired by vim's NERDTree. -(package! neotree - :commands (neotree-show - neotree-hide - neotree-toggle - neotree-dir - neotree-find - neo-global--with-buffer - neo-global--window-exists-p) - :init - (setq neo-create-file-auto-open t - neo-auto-indent-point nil - neo-mode-line-type 'none - neo-persist-show nil - neo-window-width 25 - neo-show-updir-line nil - neo-theme 'nerd ; fallback - neo-banner-message nil - neo-show-hidden-files nil - neo-hidden-regexp-list - '(;; vcs folders - "^\\.\\(git\\|hg\\|svn\\)$" - ;; compiled files - "\\.\\(pyc\\|o\\|elc\\|lock\\|css.map\\)$" - ;; generated files, caches or local pkgs - "^\\(node_modules\\|vendor\\|.\\(project\\|cask\\|yardoc\\|sass-cache\\)\\)$" - ;; org-mode folders - "^\\.\\(sync\\|export\\|attach\\)$" - "~$" - "^#.*#$")) - - :config - (evil-set-initial-state 'neotree-mode 'motion) - - ;; Adding keybindings to `neotree-mode-map' wouldn't work for me (they get - ;; overridden when the neotree buffer is spawned). So we bind them in a hook. - (add-hook 'neo-after-create-hook 'doom|neotree-init-keymap) - (defun doom|neotree-init-keymap (&rest _) - (map! :Lm "\\\\" 'evil-window-prev - :Lm "ESC ESC" 'neotree-hide - :Lm "q" 'neotree-hide - :Lm [return] 'neotree-enter - :Lm "RET" 'neotree-enter - :Lm "" 'neotree-enter - :Lm "J" 'neotree-select-next-sibling-node - :Lm "K" 'neotree-select-previous-sibling-node - :Lm "H" 'neotree-select-up-node - :Lm "L" 'neotree-select-down-node - :Lm "v" 'neotree-enter-vertical-split - :Lm "s" 'neotree-enter-horizontal-split - :Lm "c" 'neotree-create-node - :Lm "d" 'neotree-delete-node - :Lm "C-r" 'neotree-refresh - :Lm "r" 'neotree-rename-node - :Lm "R" 'neotree-change-root))) - -(provide 'core-project) -;;; core-project.el ends here diff --git a/core/core-repl.el b/core/core-repl.el deleted file mode 100644 index ab1884322..000000000 --- a/core/core-repl.el +++ /dev/null @@ -1,6 +0,0 @@ -;;; core-repl.el - -;; TODO - -(provide 'core-repl) -;;; core-repl.el ends here diff --git a/core/core-set.el b/core/core-set.el deleted file mode 100644 index d58fd354f..000000000 --- a/core/core-set.el +++ /dev/null @@ -1,23 +0,0 @@ -;;; core-set.el --- centralized inter-package configuration - -(defvar doom-settings '() - "docstring") - -(defun doom-define-setting (name &optional docs &rest args) - (declare (indent defun))) - -(defun doom-set (mode key value) - (declare (indent defun))) - -(defmacro config! (package-name &rest args) - (declare (indent defun)) - `(let ((doom-current-package ',package-name)) - ,(macroexpand-progn args)) - ;; 1. Check for `set!' calls - ;; 2. Append mode - ) - -(defmacro set! (&rest args)) - -(provide 'core-set) -;;; core-set.el ends here diff --git a/core/core-snippets.el b/core/core-snippets.el deleted file mode 100644 index eba74827c..000000000 --- a/core/core-snippets.el +++ /dev/null @@ -1,6 +0,0 @@ -;;; core-snippets.el - -;; TODO - -(provide 'core-snippets) -;;; core-snippets.el ends here diff --git a/core/core-syntax-checking.el b/core/core-syntax-checking.el deleted file mode 100644 index fbfa459b2..000000000 --- a/core/core-syntax-checking.el +++ /dev/null @@ -1,42 +0,0 @@ -;;; core-syntax-checking.el --- tasing you for every forgotten semicolon - -(package! flycheck - :commands (flycheck-mode flycheck-list-errors flycheck-buffer) - :init - (setq flycheck-indication-mode 'right-fringe - ;; Removed checks on idle/change for snappiness - flycheck-check-syntax-automatically '(save mode-enabled) - flycheck-highlighting-mode 'symbols - flycheck-disabled-checkers '(emacs-lisp emacs-lisp-checkdoc make) - ;; `flycheck-pos-tip' - flycheck-pos-tip-timeout 10 - flycheck-display-errors-delay 0.5) - - :config - ;; (def-popup! " ?\\*Flycheck.+\\*" :align below :size 14 :noselect t :regexp t) - - (map! :map flycheck-error-list-mode-map - :n "C-n" 'flycheck-error-list-next-error - :n "C-p" 'flycheck-error-list-previous-error - :n "j" 'flycheck-error-list-next-error - :n "k" 'flycheck-error-list-previous-error - :n "RET" 'flycheck-error-list-goto-error) - - ;; Flycheck buffer on ESC in normal mode. - (defun doom*flycheck-buffer () - (when (bound-and-true-p flycheck-mode) (flycheck-buffer))) - (advice-add 'evil-force-normal-state :after 'doom*flycheck-buffer) - - (define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow - [0 0 0 0 0 4 12 28 60 124 252 124 60 28 12 4 0 0 0 0])) - -;; NOTE Looks bad on emacs-mac build on MacOS -(package! flycheck-pos-tip - :unless (eq window-system 'ns) - :after flycheck - :config (flycheck-pos-tip-mode +1)) - -(package! flyspell :commands flyspell-mode) - -(provide 'core-syntax-checking) -;;; core-syntax-checking.el ends here diff --git a/core/core-vcs.el b/core/core-vcs.el deleted file mode 100644 index 16d13cc01..000000000 --- a/core/core-vcs.el +++ /dev/null @@ -1,103 +0,0 @@ -;;; core-vcs.el - -(package! gitconfig-mode - :mode "/\\.?git/?config$" - :mode "/\\.gitmodules$" - :init (add-hook 'gitconfig-mode-hook 'flyspell-mode)) - -(package! gitignore-mode - :mode "/\\.gitignore$" - :mode "/\\.git/info/exclude$" - :mode "/git/ignore$") - -(package! git-gutter-fringe - :commands git-gutter-mode - :init (add-hook! (text-mode prog-mode conf-mode) 'git-gutter-mode) - :config - ;; places the git gutter outside the margins. - (setq-default fringes-outside-margins t) - - ;; thin fringe bitmaps - (define-fringe-bitmap 'git-gutter-fr:added - [224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224] - nil nil 'center) - (define-fringe-bitmap 'git-gutter-fr:modified - [224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224 224] - nil nil 'center) - (define-fringe-bitmap 'git-gutter-fr:deleted - [0 0 0 0 0 0 0 0 0 0 0 0 0 128 192 224 240 248] - nil nil 'center) - - ;; Refreshing git-gutter on ESC and focus - (advice-add 'evil-force-normal-state :after 'git-gutter) - (add-hook 'focus-in-hook 'git-gutter:update-all-windows)) - -(package! magit - :commands magit-status - :config - ;; Prevent magit + evil-snipe conflicts - (add-hook 'magit-mode-hook 'turn-off-evil-snipe-override-mode) - - (map! :map magit-mode-map - ;; Don't let Tab binding in my-bindings conflict with Tab in magit - :m "" 'magit-section-toggle - ;; Don't interfere with window movement keys - :nv "C-j" nil - :nv "C-k" nil)) - -(package! evil-magit :after magit) - -(package! browse-at-remote - :commands (browse-at-remote/browse browse-at-remote/get-url)) - -(after! vc-annotate - (evil-set-initial-state 'vc-annotate-mode 'normal) - (evil-set-initial-state 'vc-git-log-view-mode 'normal) - (map! :map vc-annotate-mode-map - :n "q" 'kill-this-buffer - :n "d" 'vc-annotate-show-diff-revision-at-line - :n "D" 'vc-annotate-show-changeset-diff-revision-at-line - :n "SPC" 'vc-annotate-show-log-revision-at-line - :n "]]" 'vc-annotate-next-revision - :n "[[" 'vc-annotate-prev-revision - :n [tab] 'vc-annotate-toggle-annotation-visibility - :n "RET" 'vc-annotate-find-revision-at-line)) - - -;; -;; Defuns -;; - -(defun doom-git-root () - "Get git url root." - (when-let (url (car-safe (browse-at-remote--remote-ref buffer-file-name))) - (cdr (browse-at-remote--get-url-from-remote url)))) - -(defun doom/git-browse-issues () - "Open the github issues page for current repo." - (interactive) - (if-let (root (doom-git-root)) - (browse-url (concat root "/issues")) - (user-error "No git root found!"))) - -(evil-define-command doom:git-browse (&optional bang) - "Open the website for the current (or specified) version controlled FILE. If -BANG, then copy it to clipboard. Fallback to repository root." - (interactive "") - (let (url) - (condition-case err - (setq url (browse-at-remote-get-url)) - (error - (setq url (shell-command-to-string "hub browse -u --")) - (setq url (if url - (concat (s-trim url) "/" (f-relative (buffer-file-name) (doom-project-root)) - (when (use-region-p) (format "#L%s-L%s" - (line-number-at-pos (region-beginning)) - (line-number-at-pos (region-end))))))))) - (when url - (if bang - (message "Url copied to clipboard: %s" (kill-new url)) - (browse-url url))))) - -(provide 'core-vcs) -;;; core-vcs.el ends here diff --git a/core/core-workspaces.el b/core/core-workspaces.el deleted file mode 100644 index 9cedfd3af..000000000 --- a/core/core-workspaces.el +++ /dev/null @@ -1,6 +0,0 @@ -;;; core-workspaces.el - - - -(provide 'core-workspaces) -;;; core-workspaces.el ends here