Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Integrate ido with artist-mode for selecting operations and settings.

Move evil relative bindings from keys.el to evil.el.
  • Loading branch information...
commit 1e7f4536df6a9a200091fe6eecc2d02ca741f569 1 parent a74c5fb
@winfred-lu authored
Showing with 49 additions and 15 deletions.
  1. +13 −4 winfred-evil.el
  2. +36 −11 winfred-keys.el
View
17 winfred-evil.el
@@ -10,11 +10,12 @@
(evil-mode 1)
(loop for (mode . state) in '((calendar-mode . emacs)
+ (cscope-list-entry-mode . emacs)
(Custom-mode . normal)
(grep-mode . emacs)
(hexl-mode . emacs)
(Man-mode . emacs)
- (cscope-list-entry-mode . emacs))
+ (picture-mode . emacs))
do (evil-set-initial-state mode state))
;; kj as escape to return to normal mode
@@ -45,7 +46,13 @@
"," 'wf-evil-comma-map
,@bindings))
-;;;;;; global key bindings (modeless) ;;;;;;
+;;;;;; key bindings regardless of major mode ;;;;;;
+
+;; undo evil's key bindings
+(define-key evil-insert-state-map "\C-e" 'end-of-line)
+(define-key evil-normal-state-map "\C-e" 'end-of-line)
+(define-key evil-insert-state-map "\C-y" 'yank)
+(define-key evil-motion-state-map "y" 'evil-yank)
;; moving with visual line (like gj,gk in vim)
(define-key evil-normal-state-map "j" 'evil-next-visual-line)
@@ -73,6 +80,7 @@
(define-key wf-evil-comma-map "w" 'ace-jump-word-mode)
(define-key wf-evil-comma-map "c" 'ace-jump-char-mode)
(define-key wf-evil-comma-map "l" 'ace-jump-line-mode)
+(define-key wf-evil-comma-map "s" 'ispell-word)
(define-key evil-normal-state-map "," 'wf-evil-comma-map)
(define-key evil-motion-state-map "," 'wf-evil-comma-map)
@@ -98,12 +106,12 @@
(define-key wf-cscope-map "u" 'cscope-pop-mark)
(define-key evil-normal-state-map "\C-_" 'wf-cscope-map)
-;; etags-select
+;; etags-select instead of evil-jump-to-tag
(define-key evil-normal-state-map "\C-]" 'etags-select-find-tag-at-point)
(define-key evil-normal-state-map "\M-." 'etags-select-find-tag)
-;;;;;; local key bindings (modeful) ;;;;;;
+;;;;;; key bindings according to major mode ;;;;;;
(eval-after-load "calc"
'(progn
@@ -173,6 +181,7 @@
"-" 'org-cycle-list-bullet
(kbd "TAB") 'org-cycle
(kbd "RET") 'org-open-at-point
+ "\C-t" 'org-mark-ring-goto
"zm" 'hide-body
"zr" 'show-all
"zo" 'show-subtree
View
47 winfred-keys.el
@@ -1,16 +1,6 @@
-;;;;;; global key bindings (modeless) ;;;;;;
-
(global-set-key [(f11)] 'whitespace-mode)
(global-set-key [(f12)] (lambda()(interactive)(switch-to-buffer "*scratch*")))
-;; undo evil's key bindings
-(define-key evil-insert-state-map "\C-e" 'end-of-line)
-(define-key evil-normal-state-map "\C-e" 'end-of-line)
-(define-key evil-insert-state-map "\C-y" 'yank)
-
-;; yank at motion state
-(define-key evil-motion-state-map "y" 'evil-yank)
-
(define-prefix-command 'wf-minor-mode-map)
(define-key wf-minor-mode-map "a" 'artist-mode)
(define-key wf-minor-mode-map "h" 'hl-line-mode)
@@ -24,7 +14,42 @@
(global-set-key "\C-xm" 'wf-minor-mode-map)
(global-set-key "\C-x\C-b" 'ibuffer)
-;;;;;; local key bindings (modeful) ;;;;;;
+;; ido with artist-mode
+(defun artist-ido-select-operation (type)
+ "Use ido to select a drawing operation in artist-mode"
+ (interactive
+ (list (ido-completing-read
+ "Drawing operation: "
+ (list "Pen" "Pen Line" "line" "straight line" "rectangle"
+ "square" "poly-line" "straight poly-line" "ellipse"
+ "circle" "text see-thru" "text-overwrite" "spray-can"
+ "erase char" "erase rectangle" "vaporize line" "vaporize lines"
+ "cut rectangle" "cut square" "copy rectangle" "copy square"
+ "paste" "flood-fill"))))
+ (artist-select-operation type))
+(defun artist-ido-select-settings (type)
+ "Use ido to select a setting to change in artist-mode"
+ (interactive
+ (list (ido-completing-read
+ "Setting: "
+ (list "Set Fill" "Set Line" "Set Erase" "Spray-size" "Spray-chars"
+ "Rubber-banding" "Trimming" "Borders"))))
+ (if (equal type "Spray-size")
+ (artist-select-operation "spray set size")
+ (call-interactively (artist-fc-get-fn-from-symbol
+ (cdr (assoc type '(("Set Fill" . set-fill)
+ ("Set Line" . set-line)
+ ("Set Erase" . set-erase)
+ ("Rubber-banding" . rubber-band)
+ ("Trimming" . trimming)
+ ("Borders" . borders)
+ ("Spray-chars" . spray-chars))))))))
+
+
+(add-hook 'artist-mode-hook
+ (lambda ()
+ (define-key artist-mode-map "\C-c\C-o" 'artist-ido-select-operation)
+ (define-key artist-mode-map "\C-c\C-s" 'artist-ido-select-settings)))
(add-hook 'cscope-list-entry-hook
'(lambda ()
Please sign in to comment.
Something went wrong with that request. Please try again.