CARVIEW |
Select Language
HTTP/2 200
date: Sat, 26 Jul 2025 00:45:35 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"e3e76499ae5c0d7ba436c78c76628b32"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=pbLortwbD%2BRVKsih3SsOj3w7%2F9cFXoqL2bbWeszESVwtQN65gD7kAHGI0wcy%2BfV5Ry5gG%2F1gcy3ewRK2YClJI17HSxn2LbofJ8%2BFYPMcJNrJBd8Oa3ee%2FsddxXDy4m9raSHXiddzuKa%2F2DaN2HYIWkJO%2BjaVyKm8qCJCW1SIGAg1YQbvfQVCqh2iKMV3x2zz1gEITn0%2F6MBE04LmqEljg68FukThGA3nj71Z2SX2WcXcLnQurcUNwyImmv4Bri8HBN8FLlK85WqHoakLNHkZgw%3D%3D--W6yCZHIi2SdnYmrm--%2BAxaJSW%2BOU8RsPx3RF%2B6Qg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.701090491.1753490734; Path=/; Domain=github.com; Expires=Sun, 26 Jul 2026 00:45:34 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 26 Jul 2026 00:45:34 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: C324:18EAF6:65840:A28B0:6884252E
custom commands · abo-abo/avy Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 113
custom commands
Yuto SASAKI edited this page Jul 21, 2020
·
7 revisions
This page describes how to write your own avy-enabled commands that jump to custom things.
(defun avy-goto-conditional ()
(interactive)
(avy--generic-jump "\\s(\\(if\\|cond\\|when\\|unless\\)\\b" nil 'pre))
(global-set-key (kbd "M-g c") 'avy-goto-conditional)
(defun avy-goto-parens ()
(interactive)
(let ((avy-command this-command)) ; for look up in avy-orders-alist
(avy-jump "(+")))
(add-to-list 'avy-orders-alist '(avy-goto-parens . avy-order-closest))
(global-define-key (kbd "s-p") 'avy-goto-parens)
(defun avy-org-same-level (&optional all)
"Go to any org heading of the same level as the current one.
By default, choices are limited to headings under common
subheading, but if called with a prefix argument, will be
buffer-global."
(interactive "P")
(let ((org-level (org-current-level)))
(avy--generic-jump
(format "^%s "
(regexp-quote
(make-string org-level ?*)))
nil
'pre
(unless (or all (= org-level 1))
(save-excursion
(outline-up-heading 1)
(point)))
(unless (or all (= org-level 1))
(save-excursion
(outline-up-heading 1)
(org-end-of-subtree))))))
(defun avy-org-parent-level (&optional all)
"Go to any org heading one level above the current one.
By default, choices are limited to headings under common
subheading, but if called with a prefix argument, will be
buffer-global."
(interactive "P")
(let ((org-level (org-current-level)))
(if (= org-level 1)
(message "Already at top level.")
(avy--generic-jump
(format "^%s "
(regexp-quote
(make-string (- org-level 1) ?*)))
nil
'pre
(unless (or all (= org-level 2))
(save-excursion
(outline-up-heading 2)
(point)))
(unless (or all (= org-level 2))
(save-excursion
(outline-up-heading 2)
(org-end-of-subtree)))))))
(defun avy-org-child-level (&optional all)
"Go to any org heading one level below the current one.
By default, choices are limited to headings under common
subheading, but if called with a prefix argument, will be
buffer-global."
(interactive "P")
(if (save-excursion (org-goto-first-child))
(let ((org-level (org-current-level)))
(avy--generic-jump
(format "^%s "
(regexp-quote
(make-string (+ org-level 1) ?*)))
nil
'pre
(unless all
(save-excursion
(ignore-errors
(outline-up-heading 0))
(point)))
(unless all
(save-excursion
(ignore-errors
(outline-up-heading 0))
(org-end-of-subtree)))))
(message "Heading has no children.")))
(defun avy-org-goto-level (&optional num)
"Prompt for an org level to go to, defaulting to the current one."
(interactive (list
(read-number "Select heading level: " (org-current-level))))
(avy--generic-jump
(format "^%s " (regexp-quote (make-string num ?*)))
nil
'pre))
(defun avy--org-agenda-cands ()
(let (candidates point)
(save-excursion
(save-restriction
(narrow-to-region (window-start) (window-end (selected-window) t))
(setq point (goto-char (point-min)))
(while (setq point (text-property-not-all point (window-end) 'org-marker nil))
(push (cons point (selected-window)) candidates)
(setq point (text-property-any point (window-end) 'org-marker nil)))))
(nreverse candidates)))
(defun avy-org-agenda ()
"Goto a visible item in an `org-mode-agenda' buffer."
(interactive)
(avy-action-goto (avy-with avy-org-agenda
(avy-process (avy--org-agenda-cands)))))
(defun avy-goto-word-crt-line ()
"Jump to a word start on the current line only."
(interactive)
(avy-with avy-goto-word-0
(avy-goto-word-0 nil (line-beginning-position) (line-end-position))))
;; optional evil integration example
(declare-function 'avy-goto-word-crt-line "avy")
(evil-define-avy-motion avy-goto-word-crt-line inclusive)
(define-key evil-motion-state-map (kbd "w") #'evil-avy-goto-word-crt-line)
(defun avy-org-table-1-char ()
"Avy navigation of cells in org-mode tables. 'SPC' can be used to jump to blank cells. "
(interactive)
;; set some variables to limit candidates to the current table
(let ((table-begin (save-excursion (goto-char (org-table-begin)) (previous-line) (point)))
(table-end (save-excursion (goto-char (org-table-end)) (next-line) (point))))
;; jump to the desired cell and re-align
(goto-char
(avy--generic-jump (concat "|\\{1\\}[^-\n|]+" (char-to-string (read-char "char: " t))) t 'post table-begin table-end))
(org-cycle)))
You can’t perform that action at this time.