Skip to content

Instantly share code, notes, and snippets.

@Fuco1
Created September 12, 2018 17:48
Show Gist options
  • Save Fuco1/8c1ea39aa403d5b8442fc1ac72c4222c to your computer and use it in GitHub Desktop.
Save Fuco1/8c1ea39aa403d5b8442fc1ac72c4222c to your computer and use it in GitHub Desktop.

Motions

  • forward
  • backward
  • next
  • previous
  • down
    • forward
    • backward
  • up
    • forward
    • backward
  • beg of sexp
  • end of sexp

Visual operations

  • select
    • point to beg
    • point to end
  • extend
    • point to beg (= no change)
    • point to end

Operations

  • change (= kill)
    • inner
    • outer
  • delete (= remove with no history)

Objects

  • thing
  • sexp
    • next
      • next in buffer
      • with specific delimiter
    • enclosing
      • parent
      • with specific delimiter
  • symbol
  • word
(bind-key "[" 'smartparens-state-hydra/main/body smartparens-mode-map)
(defhydra smartparens-state-hydra/main (:exit t)
("[" self-insert-command)
("s" smartparens-state-hydra/select/body)
("x" smartparens-state-hydra/extend/body)
("q" nil "Quit"))
(defhydra smartparens-state-hydra/select (:foreign-keys nil)
("f" smartparens-state-select/forward))
(defvar smartparens-state-extend-pre-point nil)
(defhydra smartparens-state-hydra/extend (:foreign-keys nil
:post (setq smartparens-state-extend-pre-point nil))
("f" smartparens-state-extend/forward))
(defun smartparens-state-select/forward ()
(interactive)
(let ((ok (sp-forward-sexp)))
(sp-get ok
(push-mark :beg-prf)
(goto-char :end-suf)
(activate-mark))))
(defun smartparens-state-extend/forward ()
(interactive)
(unless smartparens-state-extend-pre-point
(setq smartparens-state-extend-pre-point (point)))
(sp-select-next-thing)
(push-mark smartparens-state-extend-pre-point)
(activate-mark))
@Fuco1
Copy link
Author

Fuco1 commented Sep 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment