Skip to content

Commit

Permalink
evil-insert -> evil-insert-state & other upds
Browse files Browse the repository at this point in the history
- it's improper to use evil-insert for switching Evli to insert mode,
you need to use evil-insert-state

- consult-yasnippet replaces yas-insert-snippet, because it allows to
search for both - key and the snippet name

- adds anki-editor-ui

- treesit-fold, I think the issue with folding is fixed
emacs-tree-sitter/ts-fold#48

- mpv stuff has it's own file now
  • Loading branch information
agzam committed Jun 16, 2024
1 parent eb258e1 commit 8b3888c
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 36 deletions.
3 changes: 3 additions & 0 deletions config.el
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@
"v" #'helpful-variable
"j" #'info-display-manual)

(:prefix ("i" . "insert")
:desc "snippet" "s" #'consult-yasnippet)

(:prefix ("j" . "jump")
"j" #'avy-goto-char-timer
:desc "xwidget" "x" #'xwidget-webkit-url-get-create)
Expand Down
4 changes: 2 additions & 2 deletions modules/custom/ai/autoload.el
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
(progn
(erase-buffer)
(insert "### ")
(evil-insert nil))))
(evil-insert-state))))

;;;###autoload
(defun gptel+ (&optional arg)
Expand All @@ -215,5 +215,5 @@
(apply #'max)
(funcall (lambda (n) (+ n (if (zerop n) 2 1)))))))
(switch-to-buffer (gptel (format "*ChatGPT-%s*" next-sufx)))
(evil-insert 1))
(evil-insert-state))
(switch-to-buffer (gptel "*ChatGPT*"))))
5 changes: 5 additions & 0 deletions modules/custom/ai/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@
(auth-source-pick-first-password :host "api.openai.com"))
gptel-model "gpt-4o")

(setf
(cdr (assoc 'programming gptel-directives))
"You are a large language model and a software engineer. Respond concisely. Prioritize theory, don't provide code snippets until instructed.")


(add-hook! 'gptel-mode-hook
(defun gptel-mode-set-local-keys ()
(map! :map gptel-mode-map
Expand Down
2 changes: 1 addition & 1 deletion modules/custom/clojure/autoload/clojure.el
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ convert from JSON."
(search-backward ":require")
(sp-end-of-sexp)
(newline-and-indent)
(evil-insert 1)
(evil-insert-state)
(keymap-local-set "C-c C-k" #'edit-indirect-abort)
(keymap-local-set "C-c C-c" #'edit-indirect-commit))))))

Expand Down
9 changes: 8 additions & 1 deletion modules/custom/completion/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@
(yas-reload-all)
(yas-global-mode +1)

(add-hook! 'yas-before-expand-snippet-hook #'temporarily-disable-smart-parens)
(add-hook! 'yas-before-expand-snippet-hook
#'temporarily-disable-smart-parens
#'evil-insert-state)
(advice-add 'yas-completing-prompt :around #'yas-completing-prompt-a))

(use-package yasnippet-capf
Expand All @@ -544,6 +546,11 @@
(defun +corfu-remove-t-in-completion-at-point-functions ()
(remove-hook! 'completion-at-point-functions :local 't))))

(use-package consult-yasnippet
:after (consult yasnippet)
:config
(setq consult-yasnippet-use-thing-at-point t))

(use-package! dash-docs
:defer t
:config
Expand Down
1 change: 1 addition & 0 deletions modules/custom/completion/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

(package! consult-projectile)
(package! yasnippet)
(package! consult-yasnippet)

(package! dash-docs)
(package! consult-dash)
Expand Down
2 changes: 1 addition & 1 deletion modules/custom/org/autoload/anki.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
(defun anki-editor-push-tree ()
"Push all notes under a tree."
(interactive)
(anki-editor-push-notes '(4)))
(anki-editor-push-notes 'tree))
2 changes: 1 addition & 1 deletion modules/custom/org/autoload/org.el
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
(org-show-hidden-entry))
(when (and (bound-and-true-p evil-local-mode)
(not (evil-emacs-state-p)))
(evil-insert 1))))
(evil-insert-state))))

;;;###autoload
(defun +org-get-todo-keywords-for (&optional keyword)
Expand Down
4 changes: 3 additions & 1 deletion modules/custom/org/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@
(use-package! anki-editor
:commands (anki-editor-mode anki-editor-push-notes anki-editor-push-tree)
:config
(require 'anki-editor-ui)
(setq anki-editor-create-decks t ; Allow anki-editor to create a new deck if it doesn't exist
anki-editor-org-tags-as-anki-tags t)

Expand All @@ -549,6 +548,9 @@

(add-to-list 'minor-mode-map-alist '(anki-editor-mode anki-editor-mode-map)))

(use-package! anki-editor-ui
:after anki-editor)

(use-package! toc-org
:after org
;; :hook (org-mode . toc-org-enable)
Expand Down
2 changes: 1 addition & 1 deletion modules/custom/tab-bar/autoload.el
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
("]" "history forward" tab-bar-history-forward :transient t)
("d" "kill tab" +tab-bar-kill-tab)
("u" "undo kill tab" tab-undo)
("o" "tempaltes" tab-bar-new-tab-transient)]]
("o" "templates" tab-bar-new-tab-transient)]]
[:hide always
:setup-children
(lambda (_)
Expand Down
6 changes: 1 addition & 5 deletions modules/custom/tree-sitter/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

(package! clojure-ts-mode :recipe (:host github :repo "clojure-emacs/clojure-ts-mode"))

;; (package! ts-fold :recipe (:host github :repo "emacs-tree-sitter/ts-fold"))

;; TODO: switch to default after emacs-tree-sitter/ts-fold#48 fixed
(package! treesit-fold :recipe (:host github :repo "abougouffa/treesit-fold"))

(package! treesit-fold :recipe (:host github :repo "emacs-tree-sitter/treesit-fold"))

(package! evil-matchit :recipe (:host github :repo "redguardtoo/evil-matchit"))
;; (package! elisp-tree-sitter :recipe (:host github :repo "emacs-tree-sitter/elisp-tree-sitter"))
Expand Down
18 changes: 0 additions & 18 deletions modules/custom/web-browsing/autoload/elfeed.el
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,3 @@ e.g., you may want to open HN entries in eww."
#'ignore)
(_
(+eww-open-in-other-window url)))))

(defun mpv-speed-reset ()
(interactive)
(mpv-speed-set 1))

;;;;###autoload
(transient-define-prefix mpv-transient ()
"mpv"
["mpv"
[("f" "follow" elfeed-tube-mpv-follow-mode)
("w" "where" elfeed-tube-mpv-where)]
[("k" "vol up" mpv-volume-increase :transient t)
("j" "vol down" mpv-volume-decrease :transient t)]
[("," "slower" mpv-speed-decrease :transient t)
("." "faster" mpv-speed-increase :transient t)
("0" "reset" mpv-speed-reset)]
[("SPC" "pause" mpv-pause :transient t)
("Q" "quit" mpv-kill)]])
43 changes: 43 additions & 0 deletions modules/custom/web-browsing/autoload/mpv.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
;;; custom/web-browsing/autoload/mpv.el -*- lexical-binding: t; -*-

;;;###autoload
(defun mpv-speed-reset ()
(interactive)
(mpv-speed-set 1))

;;;###autoload
(defun mpv-open+ (&optional path)
(interactive)
(cond
((eq major-mode 'dired-mode)
(mpv-play (dired-get-file-for-visit)))
(t (mpv-play path))))

(defvar osc-style "auto")

;;;###autoload
(defun mpv-toggle-osc ()
(interactive)
(mpv-run-command
"script-message" "osc-visibility"
(setf osc-style (if (string= osc-style "auto") "always" "auto"))))

;;;###autoload
(transient-define-prefix mpv-transient ()
"mpv"
["mpv"
[("f" "follow" elfeed-tube-mpv-follow-mode)
("w" "where" elfeed-tube-mpv-where)]
[("k" "vol up" mpv-volume-increase :transient t)
("j" "vol down" mpv-volume-decrease :transient t)]
[("p" "prev" mpv-playlist-prev :transient t)
("n" "next" mpv-playlist-next :transient t)]
[("h" "<<" mpv-seek-backward :transient t)
("l" ">>" mpv-seek-forward :transient t)
("i" "osc" mpv-toggle-osc :transient t)]
[("," "slower" mpv-speed-decrease :transient t)
("." "faster" mpv-speed-increase :transient t)
("0" "reset" mpv-speed-reset)]
[("SPC" "pause" mpv-pause :transient t)
("o" "play" mpv-open+ :transient t)
("Q" "quit" mpv-kill)]])
7 changes: 3 additions & 4 deletions modules/custom/web-browsing/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
elfeed-search-title-max-width 80
shr-max-image-proportion 0.8)

(set-popup-rule! "^\\*elfeed-entry"
:size 0.75 :actions '(display-buffer-below-selected)
:select t :quit nil :ttl t)

(make-directory elfeed-db-directory t)

;; Ensure elfeed buffers are treated as real
Expand Down Expand Up @@ -153,6 +149,9 @@

)

(after! mpv
(setq mpv-volume-step 1.1))

(use-package! elfeed-tube-mpv
:config
(add-hook! 'elfeed-show-mode-hook
Expand Down
2 changes: 1 addition & 1 deletion modules/custom/writing/autoload/spacehammer.el
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(set-buffer-modified-p nil)
(markdown-mode)
(setq-local spacehammer--caller-pid pid)
(evil-insert +1)))
(evil-insert-state)))

;;;###autoload
(defun spacehammer-before-finish-edit-with-emacs-h (bufname pid)
Expand Down

0 comments on commit 8b3888c

Please sign in to comment.