Skip to content

Commit

Permalink
yaml-mode optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed Nov 29, 2024
1 parent 10cb5a9 commit 0475913
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 16 additions & 2 deletions lisp/init-evil.el
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,22 @@ COUNT, BEG, END, TYPE is used. If INCLUSIVE is t, the text object is inclusive.
"Go to local definition or first occurrence of symbol in current buffer."
:jump t
:type exclusive
(let* ((string (evil-find-symbol t))
(search (format "\\_<%s\\_>" (regexp-quote string)))
(let ((string (evil-find-symbol t))
search
ientry ipos)

;; left string "$" from variable name in some major modes
(when (and (memq major-mode '(yaml-mode
sh-mode
conf-mode
cmake-mode
dockerfile-mode
graphql-mode))
(string-match "^\$[A-Za-z]" string))
(setq string (substring string 1)))

(setq search (format "\\_<%s\\_>" (regexp-quote string)))

;; load imenu if available
(my-ensure 'imenu)

Expand All @@ -400,6 +413,7 @@ COUNT, BEG, END, TYPE is used. If INCLUSIVE is t, the text object is inclusive.
((and (derived-mode-p 'js2-mode)
(cl-intersection (my-what-face) '(rjsx-tag)))
(js2-jump-to-definition))

((fboundp 'imenu--make-index-alist)
(condition-case nil
(setq ientry (imenu--make-index-alist))
Expand Down
3 changes: 2 additions & 1 deletion lisp/init-misc.el
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,8 @@ It's also controlled by `my-lazy-before-save-timer'."

(with-eval-after-load 'yaml-mode
(setq yaml-imenu-generic-expression
'((nil "^\\(:?[0-9a-zA-Z_-]+\\):" 1))))
'((nil "^\\(:?[0-9a-zA-Z_-]+\\):" 1)
(nil "^ *\\([A-Z][0-9A-Z_-]+\\):" 1))))

;; {{ calendar setup
(with-eval-after-load 'calendar
Expand Down

0 comments on commit 0475913

Please sign in to comment.