[Emacs] Reorganize some packages, add two, better ivy
Ivy now appears as a floating frame, and some better defaults Packages related to one another are now better grouped Add code auto-completion with company Add eldoc and support for company Add shortcuts specific to emacs-lisp, org-src-mode Add pdf-tools, pdf-view-midnight-minor-mode enabled by default
This commit is contained in:
parent
8e66f73d30
commit
c23066cad2
@ -87,7 +87,6 @@
|
||||
delete-by-moving-to-trash t ; delete files to trash
|
||||
window-combination-resize t ; take new window space from all other windows
|
||||
undo-limit 100000000 ; raise undo limit to 100Mb
|
||||
evil-want-fine-undo t ; more granular undo with evil
|
||||
auto-save-default t
|
||||
truncate-string-ellipsis "…")
|
||||
|
||||
@ -114,7 +113,7 @@ the user."
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; Initialize package sources
|
||||
(require 'package)
|
||||
;; (require 'package)
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("org" . "https://orgmode.org/elpa/")
|
||||
("elpa" . "https://elpa.gnu.org/packages/")))
|
||||
@ -143,98 +142,7 @@ the user."
|
||||
(require 'use-package)
|
||||
(setq use-package-always-ensure t)
|
||||
|
||||
(use-package command-log-mode
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
|
||||
(use-package ivy
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:diminish
|
||||
:bind (("C-s" . swiper)
|
||||
:map ivy-minibuffer-map
|
||||
("TAB" . ivy-alt-done)
|
||||
("C-l" . ivy-alt-done)
|
||||
("C-t" . ivy-next-line)
|
||||
("C-s" . ivy-previous-line)
|
||||
:map ivy-switch-buffer-map
|
||||
("C-t" . ivy-next-line)
|
||||
("C-s" . ivy-previous-line)
|
||||
("C-l" . ivy-done)
|
||||
("C-d" . ivy-switch-buffer-kill)
|
||||
:map ivy-reverse-i-search-map
|
||||
("C-t" . ivy-next-line)
|
||||
("C-s" . ivy-previous-line)
|
||||
("C-d" . ivy-reverse-i-search-kill))
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
|
||||
;; NOTE: Thi first time you load your configuration on a new machine,
|
||||
;; you’ll need to run the following command interactively o that mode
|
||||
;; line icons display correctly:
|
||||
;;
|
||||
;; M-x all-the-icons-install-fonts
|
||||
|
||||
(use-package all-the-icons
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
|
||||
(use-package doom-modeline
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (doom-modeline-mode 1)
|
||||
:custom ((doom-modeline-height 15)))
|
||||
|
||||
(use-package doom-themes
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (load-theme 'doom-nord t))
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
(use-package which-key
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (which-key-mode)
|
||||
:diminish which-key-mode
|
||||
:config
|
||||
(setq which-key-idle-delay 0.3))
|
||||
|
||||
(use-package ivy-rich
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init
|
||||
(ivy-rich-mode 1))
|
||||
|
||||
(use-package counsel
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:bind (("M-x" . counsel-M-x)
|
||||
("C-x b" . counsel-ibuffer)
|
||||
("C-x C-f" . counsel-find-file)
|
||||
:map minibuffer-local-map
|
||||
("C-r" . 'counsel-minibuffer-history)))
|
||||
|
||||
(use-package helpful
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:custom
|
||||
(counsel-describe-function-function #'helpfull-callable)
|
||||
(counsel-describe-variable-function #'helpfull-variable)
|
||||
:bind
|
||||
([remap describe-function] . counsel-describe-function)
|
||||
([remap describe-command] . helpful-command)
|
||||
([remap describe-variable] . counsel-describe-variable)
|
||||
([remap describe-key] . helpful-key))
|
||||
|
||||
(use-package bind-map
|
||||
:straight (:build t)
|
||||
:ensure t
|
||||
:defer )
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Keybinding packages
|
||||
(use-package spaceleader
|
||||
:defer t
|
||||
:after bind-map
|
||||
@ -254,6 +162,7 @@ the user."
|
||||
(setq evil-want-C-i-jump nil)
|
||||
:config
|
||||
(evil-mode 1)
|
||||
(setq evil-want-fine-undo t) ; more granular undo with evil
|
||||
|
||||
;; Use visual line motions even outside of visual-line-mode buffers
|
||||
(evil-global-set-key 'motion "t" 'evil-next-visual-line)
|
||||
@ -300,10 +209,248 @@ the user."
|
||||
(use-package evil-collection
|
||||
:after evil
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:config
|
||||
(evil-collection-init))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(use-package command-log-mode
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
|
||||
;; NOTE: The first time you load your configuration on a new machine,
|
||||
;; you’ll need to run the following command interactively o that mode
|
||||
;; line icons display correctly:
|
||||
;;
|
||||
;; M-x all-the-icons-install-fonts
|
||||
|
||||
(use-package all-the-icons
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;; ivy
|
||||
|
||||
(use-package ivy
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:diminish
|
||||
:bind (("C-s" . swiper)
|
||||
:map ivy-minibuffer-map
|
||||
("TAB" . ivy-alt-done)
|
||||
("C-l" . ivy-alt-done)
|
||||
("C-t" . ivy-next-line)
|
||||
("C-s" . ivy-previous-line)
|
||||
:map ivy-switch-buffer-map
|
||||
("C-t" . ivy-next-line)
|
||||
("C-s" . ivy-previous-line)
|
||||
("C-l" . ivy-done)
|
||||
("C-d" . ivy-switch-buffer-kill)
|
||||
:map ivy-reverse-i-search-map
|
||||
("C-t" . ivy-next-line)
|
||||
("C-s" . ivy-previous-line)
|
||||
("C-d" . ivy-reverse-i-search-kill))
|
||||
:config
|
||||
(ivy-mode 1)
|
||||
(setq ivy-wrap t
|
||||
ivy-height 17
|
||||
ivy-fixed-height-minibuffer t
|
||||
ivy-read-action-functions #'ivy-hydra-read-action
|
||||
ivy-read-action-format-function #'ivy-read-action-format-columns
|
||||
projectile-completion-system 'ivy
|
||||
ivy-on-del-error-function #'ignore
|
||||
ivy-use-selectable-prompt t))
|
||||
|
||||
(use-package ivy-prescient
|
||||
:defer t
|
||||
:straight (:build t))
|
||||
|
||||
(use-package all-the-icons-ivy
|
||||
:straight (:build t)
|
||||
:after ivy
|
||||
:hook (after-init . all-the-icons-ivy-setup))
|
||||
|
||||
(use-package ivy-posframe
|
||||
:hook (ivy-mode . ivy-posframe-mode)
|
||||
:straight (ivy-posframe :type git
|
||||
:host github
|
||||
:repo "tumashu/ivy-posframe")
|
||||
:config
|
||||
(setq ivy-fixed-height-minibuffer nil
|
||||
ivy-posframe-border-width 10
|
||||
ivy-posframe-parameters
|
||||
`((min-width . 90)
|
||||
(min-height . ,ivy-height))))
|
||||
|
||||
(use-package ivy-rich
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init
|
||||
(ivy-rich-mode 1))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Company
|
||||
|
||||
(use-package company
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (company-mode . evil-normalize-keymaps)
|
||||
:init
|
||||
(setq company-minimum-prefix-length 2
|
||||
company-toolsip-limit 14
|
||||
company-tooltip-align-annotations t
|
||||
company-require-match 'never
|
||||
company-global-modes '(not erc-mode message-mode help-mode gud-mode)
|
||||
company-frontends
|
||||
'(company-pseudo-tooltip-frontend ; always show candidates in overlay tooltip
|
||||
company-echo-metadata-frontend) ; show selected candidate docs in echo area
|
||||
|
||||
;; Buffer-local backends will be computed when loading a major
|
||||
;; mode, so only specify a global default here.
|
||||
company-backends '(company-capf)
|
||||
|
||||
;; These auto-complete the current selection when
|
||||
;; `company-auto-complete-chars' is typed. This is too
|
||||
;; magical. We already have the much more explicit RET and
|
||||
;; TAB.
|
||||
company-auto-complete nil
|
||||
company-auto-complete-chars nil
|
||||
|
||||
;; Only search the current buffer for `company-dabbrev' (a
|
||||
;; backend that suggests text you open buffers). This prevents
|
||||
;; Company from causing lag once you have a lot of buffers
|
||||
;; open.
|
||||
company-dabbrev-other-buffers nil
|
||||
|
||||
;; Make `company-dabbrev' fully case-sensitive, to improve UX
|
||||
;; with domai-specific words with particular casing.
|
||||
company-dabbrev-ignore-case nil
|
||||
company-dabbrev-downcase nil))
|
||||
|
||||
(use-package company-dict
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:config
|
||||
(setq company-dict-dir (expand-file-name "dicts" user-emacs-directory)))
|
||||
|
||||
(use-package company-box
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:config
|
||||
(setq company-box-show-single-candidate t
|
||||
company-box-backends-colors nil
|
||||
company-box-max-candidates 50
|
||||
company-box-icons-alist 'company-box-icons-all-the-icons
|
||||
company-box-icons-all-the-icons
|
||||
(let ((all-the-icons-scale-factor 0.8))
|
||||
`((Unknown . ,(all-the-icons-material "find_in_page" :face 'all-the-icons-purple))
|
||||
(Text . ,(all-the-icons-material "text_fields" :face 'all-the-icons-green))
|
||||
(Method . ,(all-the-icons-material "functions" :face 'all-the-icons-red))
|
||||
(Function . ,(all-the-icons-material "functions" :face 'all-the-icons-red))
|
||||
(Constructor . ,(all-the-icons-material "functions" :face 'all-the-icons-red))
|
||||
(Field . ,(all-the-icons-material "functions" :face 'all-the-icons-red))
|
||||
(Variable . ,(all-the-icons-material "adjust" :face 'all-the-icons-blue))
|
||||
(Class . ,(all-the-icons-material "class" :face 'all-the-icons-red))
|
||||
(Interface . ,(all-the-icons-material "settings_input_component" :face 'all-the-icons-red))
|
||||
(Module . ,(all-the-icons-material "view_module" :face 'all-the-icons-red))
|
||||
(Property . ,(all-the-icons-material "settings" :face 'all-the-icons-red))
|
||||
(Unit . ,(all-the-icons-material "straighten" :face 'all-the-icons-red))
|
||||
(Value . ,(all-the-icons-material "filter_1" :face 'all-the-icons-red))
|
||||
(Enum . ,(all-the-icons-material "plus_one" :face 'all-the-icons-red))
|
||||
(Keyword . ,(all-the-icons-material "filter_center_focus" :face 'all-the-icons-red))
|
||||
(Snippet . ,(all-the-icons-material "short_text" :face 'all-the-icons-red))
|
||||
(Color . ,(all-the-icons-material "color_lens" :face 'all-the-icons-red))
|
||||
(File . ,(all-the-icons-material "insert_drive_file" :face 'all-the-icons-red))
|
||||
(Reference . ,(all-the-icons-material "collections_bookmark" :face 'all-the-icons-red))
|
||||
(Folder . ,(all-the-icons-material "folder" :face 'all-the-icons-red))
|
||||
(EnumMember . ,(all-the-icons-material "people" :face 'all-the-icons-red))
|
||||
(Constant . ,(all-the-icons-material "pause_circle_filled" :face 'all-the-icons-red))
|
||||
(Struct . ,(all-the-icons-material "streetview" :face 'all-the-icons-red))
|
||||
(Event . ,(all-the-icons-material "event" :face 'all-the-icons-red))
|
||||
(Operator . ,(all-the-icons-material "control_point" :face 'all-the-icons-red))
|
||||
(TypeParameter . ,(all-the-icons-material "class" :face 'all-the-icons-red))
|
||||
(Template . ,(all-the-icons-material "short_text" :face 'all-the-icons-green))
|
||||
(ElispFunction . ,(all-the-icons-material "functions" :face 'all-the-icons-red))
|
||||
(ElispVariable . ,(all-the-icons-material "check_circle" :face 'all-the-icons-blue))
|
||||
(ElispFeature . ,(all-the-icons-material "stars" :face 'all-the-icons-orange))
|
||||
(ElispFace . ,(all-the-icons-material "format_paint" :face 'all-the-icons-pink))))))
|
||||
|
||||
;; (setq x-gtk-resize-child-frames 'resize-mode)
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Emacs-lisp
|
||||
|
||||
(use-package eldoc
|
||||
:after company
|
||||
:init
|
||||
(eldoc-add-command 'company-complete-selection
|
||||
'company-complete-common
|
||||
'company-capf
|
||||
'company-abort))
|
||||
|
||||
(leader/set-keys-for-major-mode 'emacs-lisp-mode
|
||||
"e" '("eval" . "evaluate expression")
|
||||
"ee" #'eval-last-sexp
|
||||
"ed" #'eval-defun
|
||||
"er" #'eval-region
|
||||
|
||||
"h" "help"
|
||||
"hh" #'helpful-at-point)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; themes
|
||||
|
||||
(use-package doom-modeline
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (doom-modeline-mode 1)
|
||||
:custom ((doom-modeline-height 15)))
|
||||
|
||||
(use-package doom-themes
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (load-theme 'doom-nord t))
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
(use-package which-key
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (which-key-mode)
|
||||
:diminish which-key-mode
|
||||
:config
|
||||
(setq which-key-idle-delay 0.3))
|
||||
|
||||
(use-package counsel
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:bind (("M-x" . counsel-M-x)
|
||||
("C-x b" . counsel-ibuffer)
|
||||
("C-x C-f" . counsel-find-file)
|
||||
:map minibuffer-local-map
|
||||
("C-r" . 'counsel-minibuffer-history)))
|
||||
|
||||
(use-package helpful
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:custom
|
||||
(counsel-describe-function-function #'helpfull-callable)
|
||||
(counsel-describe-variable-function #'helpfull-variable)
|
||||
:bind
|
||||
([remap describe-function] . counsel-describe-function)
|
||||
([remap describe-command] . helpful-command)
|
||||
([remap describe-variable] . counsel-describe-variable)
|
||||
([remap describe-key] . helpful-key))
|
||||
|
||||
(use-package bind-map
|
||||
:straight (:build t)
|
||||
:ensure t
|
||||
:defer )
|
||||
|
||||
(use-package hydra
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
@ -369,6 +516,53 @@ the user can match one and open it."
|
||||
:hook
|
||||
(org-mode . mixed-pitch-mode))
|
||||
|
||||
(use-package pdf-tools
|
||||
:defer t
|
||||
:straight (pdf-tools :build t
|
||||
:type git
|
||||
:host github
|
||||
:repo "vedang/pdf-tools")
|
||||
:mode (("\\.pdf\\'" . pdf-view-mode))
|
||||
:config
|
||||
(progn
|
||||
(with-eval-after-load 'pdf-view
|
||||
(setq pdf-view-midnight-colors '("#d8dee9" . "#2e3440")))
|
||||
(leader/set-keys-for-major-mode 'pdf-view-mode
|
||||
"a" "annotations"
|
||||
"f" "fit"
|
||||
"s" "slice/search"
|
||||
|
||||
;; slicing image
|
||||
"sm" 'pdf-view-set-slice-using-mouse
|
||||
"sb" 'pdf-view-set-slice-from-bounding-box
|
||||
"sr" 'pdf-view-reset-slice
|
||||
|
||||
;; annotations
|
||||
"aD" 'pdf-annot-delete
|
||||
"at" 'pdf-annot-attachment-dired
|
||||
"ah" 'pdf-annot-add-highlight-markup-annotation
|
||||
"al" 'pdf-annot-list-annotations
|
||||
"am" 'pdf-annot-markup-annotation
|
||||
"ao" 'pdf-annot-add-strikeout-markup-annotation
|
||||
"as" 'pdf-annot-add-squiggly-markup-annotation
|
||||
"at" 'pdf-annot-add-text-annotation
|
||||
"au" 'pdf-annot-add-underline-markup-annotation
|
||||
|
||||
;; fit image to window
|
||||
"fw" 'pdf-view-fit-width-to-window
|
||||
"fh" 'pdf-view-fit-height-to-window
|
||||
"fp" 'pdf-view-fit-page-to-window
|
||||
|
||||
;; other
|
||||
"ss" 'pdf-occur
|
||||
"o" 'pdf-outline
|
||||
"m" 'pdf-view-midnight-minor-mode)
|
||||
|
||||
(evil-define-key 'visual pdf-view-mode-map "y" 'pdf-view-kill-ring-save))
|
||||
|
||||
:hook
|
||||
(pdf-tools-enabled . pdf-view-midnight-minor-mode))
|
||||
|
||||
;;;;;;;;;;;;;;;; Dashboard
|
||||
|
||||
(use-package dashboard
|
||||
@ -554,8 +748,7 @@ the user can match one and open it."
|
||||
:config
|
||||
(setq org-appear-autoemphasis t
|
||||
org-appear-autolinks t
|
||||
org-appear-autosubmarkers t
|
||||
org-appear-autoemphasis t)
|
||||
org-appear-autosubmarkers t)
|
||||
(run-at-time nil nil #'org-appear--set-elements)
|
||||
:defer t)
|
||||
|
||||
@ -656,10 +849,13 @@ the user can match one and open it."
|
||||
"fi" (lambda ()
|
||||
(interactive)
|
||||
(find-file (expand-file-name "init.el" user-emacs-directory)))
|
||||
"ff" #'find-file
|
||||
"ff" #'counsel-find-file
|
||||
"fo" #'phundrak-find-org-files
|
||||
"fs" #'save-buffer
|
||||
|
||||
"g" "git"
|
||||
"gs" #'magit-status
|
||||
|
||||
"h" "help"
|
||||
"hk" #'which-key-show-top-level
|
||||
"hdf" #'helpful-callable
|
||||
@ -675,9 +871,14 @@ the user can match one and open it."
|
||||
"w" "windows"
|
||||
"w-" #'split-window-below-and-focus
|
||||
"w/" #'split-window-right-and-focus
|
||||
"wo" #'other-window
|
||||
"wb" (lambda ()
|
||||
(interactive)
|
||||
(progn
|
||||
(kill-this-buffer)
|
||||
(delete-window)))
|
||||
"wd" #'delete-window
|
||||
"wD" #'delete-other-windows
|
||||
"wo" #'other-window
|
||||
|
||||
"wc" #'evil-window-left
|
||||
"wt" #'evil-window-down
|
||||
@ -689,11 +890,16 @@ the user can match one and open it."
|
||||
"qq" #'save-buffers-kill-terminal
|
||||
"qQ" #'kill-emacs)
|
||||
|
||||
(leader/set-keys-for-major-mode 'emacs-lisp-mode
|
||||
"e" '("eval" . "evaluate expression")
|
||||
"ee" 'eval-last-sexp
|
||||
"ed" 'eval-defun
|
||||
"er" 'eval-region)
|
||||
(leader/set-keys-for-major-mode 'org-mode
|
||||
"b" "babel"
|
||||
"bt" #'org-babel-tangle
|
||||
|
||||
"," #'org-ctrl-c-ctrl-c
|
||||
"'" #'org-edit-special)
|
||||
|
||||
(leader/set-keys-for-major-mode 'org-src-mode
|
||||
"," #'org-edit-src-exit
|
||||
"k" #'org-edit-src-abort)
|
||||
|
||||
;; Flycheck won’t shut up if I don’t add this
|
||||
;; (provide 'init)
|
||||
|
Loading…
Reference in New Issue
Block a user