Config: install popper , es-window and ace-pinyin-jump-char , keybinding optimize.
This commit is contained in:
1
init.el
1
init.el
@@ -15,6 +15,7 @@
|
||||
(require 'init-package)
|
||||
(require 'init-org)
|
||||
(require 'init-completion)
|
||||
(require 'init-window)
|
||||
(require 'init-kbd)
|
||||
(require 'init-ui)
|
||||
(require 'init-segmentation)
|
||||
|
||||
@@ -53,4 +53,18 @@
|
||||
(setq-local completion-at-point-functions
|
||||
(list (cape-capf-super #'cape-dabbrev)))) ;; 启用dabbrev
|
||||
|
||||
;; lua
|
||||
(use-package lua-ts-mode
|
||||
:mode ("\\.lua\\'" . lua-ts-mode)
|
||||
:config
|
||||
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode)))
|
||||
|
||||
;; tree-sitter
|
||||
(use-package treesit-auto
|
||||
:demand t
|
||||
:config
|
||||
(setq treesit-auto-install 'prompt)
|
||||
(global-treesit-auto-mode)
|
||||
(setq treesit-font-lock-level 4))
|
||||
|
||||
(provide 'init-completion)
|
||||
|
||||
@@ -33,10 +33,20 @@
|
||||
|
||||
;; multiple cursors
|
||||
(global-set-key (kbd "C-c c c") 'mc/edit-lines)
|
||||
(global-set-key (kbd "C-c c a") 'mc/mark-all-in-region)
|
||||
(global-set-key (kbd "C-c c s") 'mc/mark-all-in-region)
|
||||
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
|
||||
(global-set-key (kbd "C-c c p") 'mc/unmark-previous-like-this)
|
||||
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
|
||||
(global-set-key (kbd "C-c c n") 'mc/unmark-next-like-this)
|
||||
(global-set-key (kbd "<mouse-5>") 'mc/mark-pop)
|
||||
(global-set-key (kbd "C-{") 'mc/mark-previous-like-this-symbol)
|
||||
(global-set-key (kbd "C-}") 'mc/mark-next-like-this-symbol)
|
||||
(global-set-key (kbd "C-c c a") 'mc/mark-all-dwim)
|
||||
|
||||
;; expand region
|
||||
(global-set-key (kbd "C-c e") 'er/expand-region)
|
||||
(setq expand-region-reset-fast-key "r")
|
||||
(setq expand-region-contract-fast-key "c")
|
||||
|
||||
;; 大小写
|
||||
(global-set-key (kbd "M-c") 'capitalize-dwim)
|
||||
@@ -119,10 +129,16 @@
|
||||
(global-set-key (kbd "C-c <delete>") 'scratch-buffer))
|
||||
|
||||
;; 调整window
|
||||
(global-set-key (kbd "<f5>") 'shrink-window-horizontally)
|
||||
(global-set-key (kbd "<f6>") 'enlarge-window-horizontally)
|
||||
(global-set-key (kbd "C-<f5>") 'enlarge-window)
|
||||
(global-set-key (kbd "C-<f6>") 'shrink-window)
|
||||
(global-set-key (kbd "M-<left>") 'shrink-window-horizontally)
|
||||
(global-set-key (kbd "M-<right>") 'enlarge-window-horizontally)
|
||||
(global-set-key (kbd "M-<up>") 'enlarge-window)
|
||||
(global-set-key (kbd "M-<down>") 'shrink-window)
|
||||
|
||||
;; es-windows
|
||||
(global-set-key (kbd "<f10>") 'esw/swap-two-windows)
|
||||
|
||||
;; popper
|
||||
(global-set-key (kbd "M-`") 'popper-toggle-latest)
|
||||
|
||||
;; crux相关
|
||||
(global-set-key (kbd "C-<backspace>") 'crux-kill-line-backwards) ;; C-DEL kill line backwards
|
||||
@@ -134,7 +150,6 @@
|
||||
;; undo-fu
|
||||
(global-set-key (kbd "C-/") 'undo-fu-only-undo)
|
||||
(global-set-key (kbd "C-.") 'undo-fu-only-redo)
|
||||
(global-set-key (kbd "C-c C-/") 'undo-fu-clear-all)
|
||||
|
||||
;; vundo
|
||||
(global-set-key (kbd "C-x u") 'vundo)
|
||||
@@ -142,6 +157,7 @@
|
||||
;; consult
|
||||
(global-set-key (kbd "C-x b") 'consult-buffer) ;; buffer菜单
|
||||
(global-set-key (kbd "C-s") 'consult-line) ;; 搜索
|
||||
(global-set-key (kbd "C-c s") 'consult-focus-lines) ;; focus line
|
||||
(global-set-key (kbd "C-c i") 'consult-imenu) ;; imenu
|
||||
(global-set-key (kbd "C-c f r") 'consult-recent-file) ;; 最近打开
|
||||
(global-set-key (kbd "C-c f f") 'consult-fd) ;; 调用fd进行目录内搜索
|
||||
@@ -158,6 +174,7 @@
|
||||
|
||||
;; avy
|
||||
(global-set-key (kbd "C-M-;") 'avy-goto-char)
|
||||
(global-set-key (kbd "C-M-'") 'ace-pinyin-jump-char)
|
||||
(global-set-key (kbd "M-g g") 'avy-goto-line)
|
||||
|
||||
;; hungry-delete
|
||||
@@ -174,6 +191,10 @@
|
||||
;; embark,修饰键之后加C-h可以查看所有指令
|
||||
(global-set-key (kbd "C-;") 'embark-act)
|
||||
|
||||
;; vterm
|
||||
(with-eval-after-load 'vterm
|
||||
(define-key vterm-mode-map (kbd "M-]") nil))
|
||||
|
||||
;; 打开目录
|
||||
(defun consult-directory-externally (file)
|
||||
"Open FILE externally using the default application of the system."
|
||||
@@ -226,8 +247,18 @@
|
||||
'(define-key calendar-mode-map (kbd "<RET>") 'org-journal-open-entry-for-editing)))
|
||||
|
||||
;; 日记
|
||||
(global-set-key (kbd "C-c j o") 'org-journal-open-current-journal-file)
|
||||
(global-set-key (kbd "C-c j n") 'org-journal-new-entry)
|
||||
(defun org-journal-open-current-journal-file-delete-other-window()
|
||||
(interactive)
|
||||
(org-journal-open-current-journal-file)
|
||||
(delete-other-windows))
|
||||
|
||||
(defun org-journal-new-entry-delete-other-window()
|
||||
(interactive)
|
||||
(org-journal-new-entry nil)
|
||||
(delete-other-windows))
|
||||
|
||||
(global-set-key (kbd "C-c j o") 'org-journal-open-current-journal-file-delete-other-window)
|
||||
(global-set-key (kbd "C-c j n") 'org-journal-new-entry-delete-other-window)
|
||||
|
||||
;; emms
|
||||
(global-set-key (kbd "C-c m n") 'emms-next)
|
||||
|
||||
@@ -31,9 +31,6 @@
|
||||
:config
|
||||
(which-key-mode))
|
||||
|
||||
;; 安装ace-windows,快速切换窗口
|
||||
(use-package ace-window)
|
||||
|
||||
;; 安装vertico
|
||||
(use-package vertico
|
||||
:init (vertico-mode t))
|
||||
@@ -103,14 +100,17 @@
|
||||
(use-package undo-fu)
|
||||
|
||||
(use-package undo-fu-session
|
||||
:config (undo-fu-session-global-mode))
|
||||
:init (undo-fu-session-global-mode))
|
||||
|
||||
;; vundo
|
||||
;; vundop,撤回树
|
||||
(use-package vundo
|
||||
:init (setq undo-limit 800000
|
||||
undo-strong-limit 1200000
|
||||
undo-outer-limit 12000000))
|
||||
|
||||
;; expand-region,快速展开选中
|
||||
(use-package expand-region)
|
||||
|
||||
;; ibuffer-projectile
|
||||
(use-package ibuffer-projectile
|
||||
:init (add-hook 'ibuffer-hook
|
||||
@@ -119,6 +119,9 @@
|
||||
(unless (eq ibuffer-sorting-mode 'alphabetic)
|
||||
(ibuffer-do-sort-by-alphabetic)))))
|
||||
|
||||
(use-package ace-pinyin
|
||||
:init (ace-pinyin-global-mode +1))
|
||||
|
||||
;; 安装ox-hugo
|
||||
(use-package ox-hugo
|
||||
:custom
|
||||
@@ -283,13 +286,4 @@
|
||||
(unless *is-windows*
|
||||
(use-package vterm))
|
||||
|
||||
;; lua
|
||||
(use-package lua-ts-mode
|
||||
:mode ("\\.lua\\'" . lua-ts-mode)
|
||||
:config
|
||||
(add-to-list 'treesit-language-source-alist
|
||||
'(lua "https://github.com/tree-sitter-grammars/tree-sitter-lua"))
|
||||
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-ts-mode))
|
||||
(treesit-install-language-grammar 'lua))
|
||||
|
||||
(provide 'init-package)
|
||||
|
||||
103
lisp/init-window.el
Normal file
103
lisp/init-window.el
Normal file
@@ -0,0 +1,103 @@
|
||||
;;; init-window.el
|
||||
;;; -*- lexical-binding: t -*-
|
||||
|
||||
(use-package popper
|
||||
:defines popper-echo-dispatch-actions
|
||||
:commands popper-group-by-directory
|
||||
:hook (emacs-startup . popper-mode)
|
||||
:init
|
||||
(setq popper-reference-buffers
|
||||
'("\\*Messages\\*"
|
||||
"Output\\*$" "\\*Pp Eval Output\\*$"
|
||||
"\\*Compile-Log\\*"
|
||||
"\\*Completions\\*"
|
||||
"\\*Warnings\\*"
|
||||
"\\*Flymake diagnostics.*\\*"
|
||||
"\\*Async Shell Command\\*"
|
||||
"\\*Apropos\\*"
|
||||
"\\*Backtrace\\*"
|
||||
"\\*prodigy\\*"
|
||||
"\\*Calendar\\*"
|
||||
"\\*Embark Actions\\*"
|
||||
"\\*Finder\\*"
|
||||
"\\*Kill Ring\\*"
|
||||
"\\*Embark Export:.*\\*"
|
||||
"\\*Edit Annotation.*\\*"
|
||||
"\\*Flutter\\*"
|
||||
bookmark-bmenu-mode
|
||||
lsp-bridge-ref-mode
|
||||
comint-mode
|
||||
compilation-mode
|
||||
help-mode helpful-mode
|
||||
tabulated-list-mode
|
||||
Buffer-menu-mode
|
||||
occur-mode
|
||||
gnus-article-mode devdocs-mode
|
||||
grep-mode occur-mode rg-mode deadgrep-mode ag-mode pt-mode
|
||||
ivy-occur-mode ivy-occur-grep-mode
|
||||
process-menu-mode list-environment-mode cargo-process-mode
|
||||
youdao-dictionary-mode osx-dictionary-mode fanyi-mode
|
||||
|
||||
"^\\*eshell.*\\*.*$" eshell-mode
|
||||
"^\\*shell.*\\*.*$" shell-mode
|
||||
"^\\*terminal.*\\*.*$" term-mode
|
||||
"^\\*vterm.*\\*.*$" vterm-mode
|
||||
|
||||
"\\*DAP Templates\\*$" dap-server-log-mode
|
||||
"\\*ELP Profiling Restuls\\*" profiler-report-mode
|
||||
"\\*Flycheck errors\\*$" " \\*Flycheck checker\\*$"
|
||||
"\\*Paradox Report\\*$" "\\*package update results\\*$" "\\*Package-Lint\\*$"
|
||||
"\\*[Wo]*Man.*\\*$"
|
||||
"\\*ert\\*$" overseer-buffer-mode
|
||||
"\\*gud-debug\\*$"
|
||||
"\\*lsp-help\\*$" "\\*lsp session\\*$"
|
||||
"\\*quickrun\\*$"
|
||||
"\\*tldr\\*$"
|
||||
"\\*vc-.*\\*$"
|
||||
"\\*eldoc\\*"
|
||||
"^\\*elfeed-entry\\*$"
|
||||
"^\\*macro expansion\\**"
|
||||
|
||||
"\\*Agenda Commands\\*" "\\*Org Select\\*" "\\*Capture\\*" "^CAPTURE-.*\\.org*"
|
||||
"\\*Gofmt Errors\\*$" "\\*Go Test\\*$" godoc-mode
|
||||
"\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*"
|
||||
"\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode
|
||||
"\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode
|
||||
rustic-cargo-outdated-mode rustic-cargo-test-mode))
|
||||
|
||||
(when (display-grayscale-p)
|
||||
(setq popper-mode-line
|
||||
'("[POP]")))
|
||||
|
||||
(setq popper-echo-dispatch-actions t)
|
||||
(setq popper-group-function nil)
|
||||
:config
|
||||
(popper-echo-mode 1)
|
||||
|
||||
(with-no-warnings
|
||||
(defun my-popper-fit-window-height (win)
|
||||
"Determine the height of popup window WIN by fitting it to the buffer's content."
|
||||
(fit-window-to-buffer
|
||||
win
|
||||
(floor (frame-height) 3)
|
||||
(floor (frame-height) 3)))
|
||||
(setq popper-window-height #'my-popper-fit-window-height)
|
||||
|
||||
(defun popper-close-window-hack (&rest _)
|
||||
"Close popper window via `C-g'."
|
||||
;; `C-g' can deactivate region
|
||||
(when (and (called-interactively-p 'interactive)
|
||||
(not (region-active-p))
|
||||
popper-open-popup-alist)
|
||||
(let ((window (caar popper-open-popup-alist)))
|
||||
(when (window-live-p window)
|
||||
(delete-window window)))))
|
||||
(advice-add #'keyboard-quit :before #'popper-close-window-hack)))
|
||||
|
||||
;; 安装ace-windows,快速切换窗口
|
||||
(use-package ace-window)
|
||||
|
||||
;; es-windos,快速管理窗口
|
||||
(use-package es-windows)
|
||||
|
||||
(provide 'init-window)
|
||||
Reference in New Issue
Block a user