Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #7

Merged
merged 7 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(package-initialize)

;;(setq debug-on-error t)
(let ((minver "24.3"))
(let ((minver "29.3"))
(when (version< emacs-version minver)
(error "This config requires Emacs v%s or higher" minver)))
(setq emacs-load-start-time (current-time))
Expand Down Expand Up @@ -52,6 +52,7 @@
(require 'init-vc)
(require 'init-exec-path)
(require 'init-yas)
(require 'init-llm)

(when (file-exists-p custom-file)
(load custom-file))
Expand Down
11 changes: 10 additions & 1 deletion lisp/init-helm.el
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
("C-x C-f" . helm-find-files)
("C-x C-r" . helm-recentf)
("C-x b" . helm-mini)
("M-x" . helm-M-x))
;;("M-x" . helm-M-x)
)
)

;; helm-smex
Expand Down Expand Up @@ -59,6 +60,14 @@
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
;; (setq vertico-cycle t)
)

;; 补全
(use-package orderless
:ensure t
:custom
(completion-styles '(orderless flex))
(completion-category-overrides '((file (styles basic partial-completion)))))

;; Persist history over Emacs restarts. Vertico sorts by history position.
(use-package savehist
:init
Expand Down
17 changes: 17 additions & 0 deletions lisp/init-llm.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(use-package gptel
:ensure t
:defer t
:init
(setq
gptel-model "qwen2:7b"
gptel-backend (gptel-make-ollama "Ollama"
:host "localhost:11434"
:stream t
:models '("qwen2:7b")))
:config
(setq gptel-api-key "your key")
(add-hook 'gptel-post-response-functions 'gptel-end-of-response)
(add-hook 'gptel-post-stream-hook 'gptel-auto-scroll)
)

(provide 'init-llm)
3 changes: 3 additions & 0 deletions lisp/init-lsp.el
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
;; ))
;;:custom
;;(setq lsp-enable-snippet t)
;;排除'/opt/homebrew'目录下所有文件
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]opt/homebrew")

:hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
(go-mode . lsp-defered)
(python-mode . lsp-deferred)
Expand Down
47 changes: 43 additions & 4 deletions lisp/init-themes.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,50 @@
(use-package ample-theme
:ensure t
:init
(load-theme 'ample t t)
(load-theme 'ample-flat t t)
(load-theme 'ample-light t t)
(load-theme 'ample t nil)
(load-theme 'ample-flat t nil)
(load-theme 'ample-light t nil)
;; choose one to enable
(enable-theme 'ample)
;;(enable-theme 'ample)
:defer t
)

(use-package solarized-theme
:ensure t
:defer t
)

(use-package plan9-theme
:ensure t
:defer t
)

(use-package doom-themes
:ensure t
:defer t
)

(use-package doom-themes
:ensure t
:defer t
)

(use-package dracula-theme
:ensure t
:defer t
)

(defun dej4vu/today-emacs-theme ()
"Chooses a theme based on the day."
(interactive)
(let* ((themes-list (list 'ample 'solarized-light 'plan9 'doom-dark+ 'dracula))
(themes-len (length themes-list))
(today-as-number (string-to-number (format-time-string "%Y%m%d%j")))
(theme-index (% today-as-number themes-len))
(theme-index 4)
(theme-sym (nth theme-index themes-list)))
(message "Loading theme: %s" theme-sym)
(load-theme theme-sym t)))
(dej4vu/today-emacs-theme)

(provide 'init-themes)
197 changes: 113 additions & 84 deletions lisp/init-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,21 @@
(if window-system
(menu-bar-mode +1)
;; disable menu bar
(menu-bar-mode -1))
(menu-bar-mode -1)
)

(defun prettify-continuation-indocator (&optional dummy)
(ignore dummy)
(when buffer-display-table
(set-display-table-slot buffer-display-table 'wrap ?↩)))

(unless window-system
(set-display-table-slot standard-display-table 'wrap ?↩)
(add-hook 'window-configuration-change-hook 'prettify-continuation-indocator)
;; 如果还有问题,试着启用以下设置
;; (with-eval-after-load 'page-break-lines
;; (add-hook 'page-break-lines-mode-hook 'prettify-continuation-indocator))
)

(when (display-graphic-p)
;; disable scroll bar
Expand Down Expand Up @@ -182,89 +196,104 @@
(`interrupted " -")
(`suspicious '(propertize " ?" 'face 'warning))))))

(setq-default mode-line-format
(list
anzu--mode-line-format
;; " %1"
;; '(:eval (propertize
;; (window-number-mode-line)
;; 'face
;; 'font-lock-type-face))
;; " "
;; '(:eval (zilongshanren/update-persp-name))

"%1 "
;; the buffer name; the file name as a tool tip
'(:eval (propertize "%b " 'face 'font-lock-function-name-face
'help-echo (buffer-file-name)))


" [" ;; insert vs overwrite mode, input-method in a tooltip
'(:eval (propertize (if overwrite-mode "Ovr" "Ins")
'face 'font-lock-preprocessor-face
'help-echo (concat "Buffer is in "
(if overwrite-mode
"overwrite"
"insert") " mode")))

;; was this buffer modified since the last save?
'(:eval (when (buffer-modified-p)
(concat "," (propertize "Mod"
'face 'font-lock-function-name-face
'help-echo "Buffer has been modified"))))

;; is this buffer read-only?
'(:eval (when buffer-read-only
(concat "," (propertize "RO"
'face 'font-lock-type-face
'help-echo "Buffer is read-only"))))
"] "


;; relative position, size of file
"["
(propertize "%p" 'face 'font-lock-function-name-face) ;; % above top
"/"
(propertize "%I" 'face 'font-lock-function-name-face) ;; size
"] "

;; the current major mode for the buffer.
'(:eval (propertize "%m" 'face 'font-lock-string-face
'help-echo buffer-file-coding-system))

"%1 "
my-flycheck-mode-line
"%1 "
;; evil state
'(:eval evil-mode-line-tag)

;; minor modes
;;minor-mode-alist
minions-mode-line-modes
" "
;; git info
`(vc-mode vc-mode)

" "

;; global-mode-string goes in mode-line-misc-info
mode-line-misc-info

(mode-line-fill 'mode-line 20)

;; line and column
"(" ;; '%02' to set to 2 chars at least; prevents flickering
(propertize "%02l" 'face 'font-lock-function-name-face) ","
(propertize "%02c" 'face 'font-lock-function-name-face)
") "
;;(setq-default mode-line-format
;; (list
;; anzu--mode-line-format
;; ;; " %1"
;; ;; '(:eval (propertize
;; ;; (window-number-mode-line)
;; ;; 'face
;; ;; 'font-lock-type-face))
;; ;; " "
;; ;; '(:eval (zilongshanren/update-persp-name))
;;
;; "%1 "
;; ;; the buffer name; the file name as a tool tip
;; '(:eval (propertize "%b " 'face 'font-lock-function-name-face
;; 'help-echo (buffer-file-name)))
;;
;;
;; " [" ;; insert vs overwrite mode, input-method in a tooltip
;; '(:eval (propertize (if overwrite-mode "Ovr" "Ins")
;; 'face 'font-lock-preprocessor-face
;; 'help-echo (concat "Buffer is in "
;; (if overwrite-mode
;; "overwrite"
;; "insert") " mode")))
;;
;; ;; was this buffer modified since the last save?
;; '(:eval (when (buffer-modified-p)
;; (concat "," (propertize "Mod"
;; 'face 'font-lock-function-name-face
;; 'help-echo "Buffer has been modified"))))
;;
;; ;; is this buffer read-only?
;; '(:eval (when buffer-read-only
;; (concat "," (propertize "RO"
;; 'face 'font-lock-type-face
;; 'help-echo "Buffer is read-only"))))
;; "] "
;;
;;
;; ;; relative position, size of file
;; "["
;; (propertize "%p" 'face 'font-lock-function-name-face) ;; % above top
;; "/"
;; (propertize "%I" 'face 'font-lock-function-name-face) ;; size
;; "] "
;;
;; ;; the current major mode for the buffer.
;; '(:eval (propertize "%m" 'face 'font-lock-string-face
;; 'help-echo buffer-file-coding-system))
;;
;; "%1 "
;; my-flycheck-mode-line
;; "%1 "
;; ;; evil state
;; '(:eval evil-mode-line-tag)
;;
;; ;; minor modes
;; ;;minor-mode-alist
;; minions-mode-line-modes
;; " "
;; ;; git info
;; `(vc-mode vc-mode)
;;
;; " "
;;
;; ;; global-mode-string goes in mode-line-misc-info
;; mode-line-misc-info
;;
;; (mode-line-fill 'mode-line 20)
;;
;; ;; line and column
;; "(" ;; '%02' to set to 2 chars at least; prevents flickering
;; (propertize "%02l" 'face 'font-lock-function-name-face) ","
;; (propertize "%02c" 'face 'font-lock-function-name-face)
;; ") "
;;
;; '(:eval (buffer-encoding-abbrev))
;; mode-line-end-spaces
;; ;; add the time, with the date and the emacs uptime in the tooltip
;; ;; '(:eval (propertize (format-time-string "%H:%M")
;; ;; 'help-echo
;; ;; (concat (format-time-string "%c; ")
;; ;; (emacs-uptime "Uptime:%hh"))))
;; ))

(use-package nerd-icons
;; :custom
;; The Nerd Font you want to use in GUI
;; "Symbols Nerd Font Mono" is the default and is recommended
;; but you can use any other Nerd Font if you want
;; (nerd-icons-font-family "Symbols Nerd Font Mono")
)

'(:eval (buffer-encoding-abbrev))
mode-line-end-spaces
;; add the time, with the date and the emacs uptime in the tooltip
;; '(:eval (propertize (format-time-string "%H:%M")
;; 'help-echo
;; (concat (format-time-string "%c; ")
;; (emacs-uptime "Uptime:%hh"))))
))
(use-package doom-modeline
:ensure t
:init
(setq nerd-icons-color-icons nil)
(doom-modeline-mode 1)
)

(provide 'init-ui)
Loading