Skip to content

Commit

Permalink
targets.el
Browse files Browse the repository at this point in the history
  • Loading branch information
潘俊杰 committed Mar 8, 2019
1 parent c231d78 commit 9df7ef4
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "awesome-pair"]
path = extensions/awesome-pair
url = [email protected]:manateelazycat/awesome-pair.git
[submodule "targets"]
path = extensions/targets
url = [email protected]:noctuid/targets.el.git
1 change: 1 addition & 0 deletions extensions/targets
Submodule targets added at 105870
7 changes: 2 additions & 5 deletions modes/init-coffeescript.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
:mode "\\.coffee\\'"
:config
;; the syntax table is totally sh*t
(modify-syntax-entry ?* "." coffee-mode-syntax-table)
(modify-syntax-entry ?+ "." coffee-mode-syntax-table)
(modify-syntax-entry ?- "." coffee-mode-syntax-table)
(modify-syntax-entry ?= "." coffee-mode-syntax-table)
(modify-syntax-entry ?/ "." coffee-mode-syntax-table)
(dolist (char '(?* ?+ ?- ?= ?/ ?< ?>))
(modify-syntax-entry char "." coffee-mode-syntax-table))
(modify-syntax-entry ?_ "w" coffee-mode-syntax-table)
(jester/with-major-leader 'coffee-mode
"d" 'coffee-mark-defun))
Expand Down
2 changes: 1 addition & 1 deletion modes/init-company.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
company-dabbrev-ignore-case nil
company-dabbrev-downcase nil
company-minimum-prefix-length 2
company-idle-delay 0.3)
company-idle-delay 0.1)

;; clear default bindings first
(setq company-active-map (make-sparse-keymap))
Expand Down
4 changes: 1 addition & 3 deletions modes/init-editing-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
:commands er/expand-region
:init
(general-define-key
:states '(insert emacs)
"<C-backspace>" 'er/expand-region))


Expand Down Expand Up @@ -265,8 +264,7 @@ otherwise move to before semicolon."

(general-define-key
:states '(insert emacs)
:keymaps '(web-mode-map js2-mode-map)
"C-t" 'jester/insert-this.
:keymaps '(web-mode-map js2-mode-map coffee-mode-map)
"C-t" 'jester/insert-this.)
;; TODO
;; foo "1 xx" -> foo {
Expand Down
41 changes: 40 additions & 1 deletion modes/init-evil.el
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,11 @@
:states '(normal visual motion operator)
"M" 'evilmi-jump-items)
(general-define-key
:keymaps '(evil-inner-text-objects-map evil-outer-text-objects-map)
:keymaps '(evil-inner-text-objects-map)
"m" 'evilmi-inner-text-object)
(general-define-key
:keymaps '(evil-outer-text-objects-map)
"m" 'evilmi-outer-text-object)

:config
(global-evil-matchit-mode 1))
Expand Down Expand Up @@ -193,6 +196,42 @@
:init
(evil-ediff-init))


(push (expand-file-name "targets" jester-submodules-dir) load-path)
(require 'targets)
;; not needed if `targets-setup'?
;; (general-define-key
;; :keymaps 'evil-visual-state-map
;; "I" nil
;; "A" nil)

;; setup has to come before custom bindings
(targets-setup t
:next-key "N"
:last-key "L"
:remote-key "M")

(targets-define-composite-to pair-delimiter
(("(" ")" pair)
("[" "]" pair)
("{" "}" pair)
("<" ">" pair))
:bind t
:next-key "N"
:last-key "L"
:remote-key "M"
:keys "o")

(targets-define-composite-to quote
(("\"" "\"" quote)
("'" "'" quote)
("`" "`" quote))
:bind t
:next-key "N"
:last-key "L"
:remote-key "M"
:keys "'")

;;----------------------------------------------------------------------------
;; Set initial states for modes.
;;----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion modes/init-face.el
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
:config
(general-define-key
:states '(normal visual motion)
:keymaps '(prog-mode-map markdown-mode-map)
:keymaps '(prog-mode-map)
"<tab>" 'jester/symbol-overlay-put
;; "<C-i>" 'symbol-overlay-put
"M-n" 'symbol-overlay-jump-next
Expand Down
3 changes: 2 additions & 1 deletion modes/init-ivy.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"f r" 'counsel-recentf
"t s" 'counsel-load-theme
"s j" 'counsel-imenu
"." 'counsel-imenu
"s b" 'swiper-all
"s B" (lambda! (swiper-all (jester/region-or-symbol)))
"i u" 'counsel-unicode-char)
Expand All @@ -35,7 +36,7 @@
"M-x" 'counsel-M-x
"M-y" 'counsel-yank-pop
"C-s" 'swiper
"C-S-s" (lambda! (swiper (jester/region-or-symbol)))
"C-S-s" (lambda! (swiper (regexp-quote (jester/region-or-symbol))))
"C-h C-f" 'counsel-describe-face)

(dolist (that-ivy-map
Expand Down
5 changes: 5 additions & 0 deletions modes/init-misc.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
(use-package evil-anzu
:after anzu
:demand t)
;; use this in place of anzu when Emacs 27 is here
;; (setq isearch-lazy-count t)

(global-auto-revert-mode 1)
(setq auto-revert-check-vc-info t)
Expand Down Expand Up @@ -40,5 +42,8 @@
;; never ring the bell
(setq ring-bell-function 'ignore)

;; make CJK smoother on Windows
(setq inhibit-compacting-font-caches t)


(provide 'init-misc)
11 changes: 9 additions & 2 deletions modes/init-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ typical word processor."
:keymaps 'org-mode-map
;; "g o" 'org-todo
"H" 'org-shiftleft
"L" 'org-shiftright))
"L" 'org-shiftright)
(jester/with-major-leader 'org-mode-map
"t t" 'org-todo))

(use-package org-bullets
:hook (org-mode . org-bullets-mode)
Expand All @@ -300,7 +302,12 @@ typical word processor."
org-agenda-files '("~/org")))

(use-package evil-org
:hook (org-mode . evil-org-mode))
:hook (org-mode . evil-org-mode)
:config
(general-define-key
:states '(insert)
:keymaps 'evil-org-mode-map
"C-d" 'backward-char))


(provide 'init-org)
7 changes: 5 additions & 2 deletions modes/init-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@
(defun jester/region-or-symbol ()
"Get active region or symbol at point."
(if (region-active-p)
(buffer-substring-no-properties
(region-beginning) (region-end))
(let ((beg (region-beginning))
(end (region-end)))
(deactivate-mark)
(buffer-substring-no-properties
beg end))
(thing-at-point 'symbol t)))

;;----------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion modes/init-web.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
:keymaps 'evil-inner-text-objects-map
"a" 'jester/evil-inner-attribute)
(jester/with-major-leader 'web-mode-map
"r" 'web-mode-element-rename)
"r" 'web-mode-element-rename
"f" 'web-mode-fold-or-unfold)

(setq
web-mode-style-padding 0
Expand All @@ -30,6 +31,7 @@
(modify-syntax-entry ?_ "w" web-mode-syntax-table)
(modify-syntax-entry ?- "w" web-mode-syntax-table)
(modify-syntax-entry ?# "_" web-mode-syntax-table)
(modify-syntax-entry ?+ "." web-mode-syntax-table)

(define-key web-mode-map (kbd "TAB") nil)
(define-key web-mode-map (kbd "<tab>") nil)
Expand Down
5 changes: 5 additions & 0 deletions snippets/coffee-mode/jqt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: jqt
# key: jqt
# --
$(this)

0 comments on commit 9df7ef4

Please sign in to comment.