除了通过 :defer t 来延后包的加载外, use-package 为我们提供了一系列的 隐式 延迟加载关键字,它们包括: :commands, :bind, :bind*, :bind-keymap, :bind-keymap*, :mode, :interpreter ,我们会在下面分别介绍。 2.3. 包的条件加载 我们可以使用:if接一条条件表达式来让use-package仅在表达式结果非空时...
(use-package mypackage :hook (xx-1-mode-hook xx-2-mode-hook) :bind (("C-c C-c") . mypackage-compile-region) :init (mypackage-initialize) ) 尽管use-package不一定总是好的,我建议新手尽早建立适合一个自己的包管理机制,因为一旦你的配置文件中已经包含了数十个包的散乱配置,到那时把这一堆语句...
(use-package <package-name> :init <加载包之前,执行的代码> :config <加载包之后,执行的代码> :bind <key bindings for this package>) 3.3 示例 (1) 没有使用use-package (global-company-mode t) (define-key company-active-map (kbd "C-n") 'company-select-next) (define-key company-acti...
2.4 顺序加载::after。确保在指定包加载后才加载。:all 和 :any 选择性加载。2.5 手动安装包管理::load-path、:autoload。管理非 package.el 安装的包路径和 autoload。2.6 key binding:使用 :bind、:map、:bind-keymap。创建或移除全局或特定 keymap 的绑定。2.7 minor-mode 启动::hook。
(my/timer(use-packageprojectile:init(projectile-mode+1):bind("C-c p".projectile-command-map):custom(projectile-project-search-path '("~/code/""~/gh/""~/code/antfin/""~/code/misc")):config(setq projectile-switch-project-action #'projectile-find-file-dwim ...
(use-package ivy :ensure t :bind ("C-s" . 'swiper) ("M-x" . 'counsel-M-x) ) ``` 在这个例子中,我设置了ivy和其相关包的绑定键,使得我可以通过快捷键C-s使用swiper命令,通过快捷键M-x使用counsel-M-x命令。 另外,use-package还可以设置包的hook。hook是一种触发机制,可以在特定的事件发生时...
If you aren't using :commands, :bind, :bind*, :bind-keymap, :bind-keymap*, :mode, :interpreter, or :hook (all of which imply :defer; see the docstring for use-package for a brief description of each), you can still defer loading with the :defer keyword:...
(use-package ... :bind (:map rime-mode-map ("C-`" . 'rime-send-keybinding)) ... ) 六、FAQ 切换折叠 在isearch 中的使用 目前在 isearch 中不能正常工作,但是可以使用phi-search. 候选框最后一项不显示? 切换折叠 极少数用户下会偶尔出现最后一个候选词不显示的情况,可以确定跟 `posframe` 有关...
(use-package foo :init (setq foo-variable t) :config (foo-mode 1))As you might expect, you can use :init and :config together:(use-package color-moccur :commands (isearch-moccur isearch-all) :bind (("M-s O" . moccur) :map isearch-mode-map ("M-o" . isearch-moccur) ("M-...
:bind-keymap ("C-c n d" . org-roam-dailies-map) ;; 日记菜单 :config (require 'org-roam-dailies) ;; 启用日记功能 (org-roam-db-autosync-mode)) ;; 启动时自动同步数据库 (use-package org-roam-ui :ensure t ;; 自动安装 ...