Config: start configure general and hydra
This commit is contained in:
@@ -4,6 +4,67 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(use-package hydra
|
||||
:defines (consult-imenu-config posframe-border-width)
|
||||
:functions childframe-completion-workable-p
|
||||
:hook ((emacs-lisp-mode . hydra-add-imenu)
|
||||
((after-init after-load-theme server-after-make-frame) . hydra-set-posframe))
|
||||
:init
|
||||
(with-eval-after-load 'consult-imenu
|
||||
(setq consult-imenu-config
|
||||
'((emacs-lisp-mode :toplevel "Functions"
|
||||
:types ((?f "Functions" font-lock-function-name-face)
|
||||
(?h "Hydras" font-lock-constant-face)
|
||||
(?m "Macros" font-lock-function-name-face)
|
||||
(?p "Packages" font-lock-constant-face)
|
||||
(?t "Types" font-lock-type-face)
|
||||
(?v "Variables" font-lock-variable-name-face))))))
|
||||
|
||||
(defun hydra-set-posframe ()
|
||||
"Set display type and appearance of hydra."
|
||||
;; Display type
|
||||
(if (childframe-completion-workable-p)
|
||||
(setq hydra-hint-display-type 'posframe)
|
||||
(setq hydra-hint-display-type 'lv))
|
||||
;; Appearance
|
||||
(setq hydra-posframe-show-params
|
||||
`(:left-fringe 8
|
||||
:right-fringe 8
|
||||
:internal-border-width ,posframe-border-width
|
||||
:internal-border-color ,(face-background 'posframe-border nil t)
|
||||
:background-color ,(face-background 'tooltip nil t)
|
||||
:foreground-color ,(face-foreground 'tooltip nil t)
|
||||
:lines-truncate t
|
||||
:poshandler posframe-poshandler-frame-center-near-bottom))))
|
||||
|
||||
;; multiple-cursors
|
||||
(defhydra hydra-multiple-cursors ()
|
||||
"
|
||||
^Mark^ ^Unmark^ ^Other^
|
||||
------------------------------------------------------------------
|
||||
_p_ : prev line _P_ : previous _c_ : edit lines
|
||||
_n_ : next line _N_ : next _._ : pop
|
||||
_f_ : next symbol _q_ : quit
|
||||
_b_ : prev symbol
|
||||
_s_ : in region
|
||||
_a_ : all dwim
|
||||
"
|
||||
("p" mc/mark-previous-like-this)
|
||||
("n" mc/mark-next-like-this)
|
||||
("b" mc/mark-previous-like-this-symbol)
|
||||
("f" mc/mark-next-like-this-symbol)
|
||||
("P" mc/unmark-previous-like-this)
|
||||
("N" mc/unmark-next-like-this)
|
||||
("a" mc/mark-all-dwim)
|
||||
("s" mc/mark-all-in-region)
|
||||
("c" mc/edit-lines)
|
||||
("." mc/mark-pop)
|
||||
("q" nil))
|
||||
|
||||
(global-set-key (kbd "C-c c") 'hydra-multiple-cursors/body)
|
||||
|
||||
(use-package general)
|
||||
|
||||
;; 修改mac键位
|
||||
(when *is-mac*
|
||||
(setq mac-command-modifier 'meta)
|
||||
@@ -17,10 +78,6 @@
|
||||
|
||||
(global-set-key (kbd "<f2>") 'open-init-file)
|
||||
|
||||
;; 快速打开函数与变量的定义
|
||||
(global-set-key (kbd "C-h C-f") 'find-function)
|
||||
(global-set-key (kbd "C-h C-v") 'find-variable)
|
||||
|
||||
;; 根据平台使用不同的重启方式
|
||||
(if *is-windows*
|
||||
(progn
|
||||
@@ -33,18 +90,6 @@
|
||||
(global-set-key (kbd "C-c r") 'restart-emacs))
|
||||
(global-set-key (kbd "C-c r") 'restart-emacs))
|
||||
|
||||
;; multiple cursors
|
||||
(global-set-key (kbd "C-c c c") 'mc/edit-lines)
|
||||
(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")
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
org-journal-time-format "%m-%d \n<%Y-%m-%d %a %H:%M:%S>\n"
|
||||
org-journal-hide-entries-p t
|
||||
org-journal-date-format (lambda (time)
|
||||
(format "* %s %s\n[%s]\n"
|
||||
(format "* %s %s\n\n[%s]\n"
|
||||
(format-time-string "%Y-%m-%d" time)
|
||||
(format-time-string "%a" time)
|
||||
(format-time-string "%Y-%m-%d %a" time)))
|
||||
@@ -259,12 +259,12 @@
|
||||
my-org-capture-temp-title)))))
|
||||
"#+title: %(symbol-value 'my-org-capture-temp-title)
|
||||
#+date: %U
|
||||
#+category: %^{Category|none|project|book|article|note|insight}
|
||||
#+category: %^{Category|none|project|book|article|note|insight|fun}
|
||||
|
||||
* %(symbol-value 'my-org-capture-temp-title) %^g
|
||||
%U
|
||||
:PROPERTIES:
|
||||
:END:
|
||||
%U
|
||||
|
||||
%?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user