|
| 1 | +## iy-go-to-char.el |
| 2 | +*Go to next CHAR which is similar to "f" in vim* |
| 3 | + |
| 4 | +--- |
| 5 | + |
| 6 | +This package defines the function `iy-go-to-char` which behaves |
| 7 | +like "f" in vim. It reads a char and go the next Nth occurence of |
| 8 | +the char. User can continue such search using that char key. |
| 9 | + |
| 10 | +To use, make sure this file is on your `load-path` and put the |
| 11 | +following in your .emacs file: |
| 12 | + |
| 13 | + (require 'iy-go-to-char) |
| 14 | + |
| 15 | +To make `iy-go-to-char` works better with `multiple-cursors`, add |
| 16 | +`iy-go-to-char-start-pos` to `mc/cursor-specific-vars` when mc is loaded: |
| 17 | + |
| 18 | + (add-to-list 'mc/cursor-specific-vars 'iy-go-to-char-start-pos) |
| 19 | + |
| 20 | +Then you can bind functions like: |
| 21 | + |
| 22 | + (global-set-key (kbd "C-c f") 'iy-go-to-char) |
| 23 | + (global-set-key (kbd "C-c F") 'iy-go-to-char-backward) |
| 24 | + (global-set-key (kbd "C-c ;") 'iy-go-to-or-up-to-continue) |
| 25 | + (global-set-key (kbd "C-c ,") 'iy-go-to-or-up-to-continue-backward) |
| 26 | + |
| 27 | +Or if you prefer up-to versions: |
| 28 | + |
| 29 | + (global-set-key (kbd "C-c f") 'iy-go-up-to-char) |
| 30 | + (global-set-key (kbd "C-c F") 'iy-go-up-to-char-backward) |
| 31 | + |
| 32 | +You also can bind go-to methods and up-to methods to different keys. |
| 33 | + |
| 34 | +Except repeating the char key, followings keys are defined before |
| 35 | +quitting the search: |
| 36 | + |
| 37 | + ; -- search forward the char, customizable: |
| 38 | + `iy-go-to-char-key-forward` |
| 39 | + |
| 40 | + , -- search backward the char, customizable: |
| 41 | + `iy-go-to-char-key-backward` |
| 42 | + |
| 43 | + C-g -- quit |
| 44 | + |
| 45 | + C-s -- start `isearch-forward` using char as initial search |
| 46 | + string |
| 47 | + |
| 48 | + C-r -- start `isearch-backward` using char as initial search |
| 49 | + string |
| 50 | + |
| 51 | + C-w -- quit and kill region between start and current point. If region is |
| 52 | + activated before search, then use the original mark instead of the |
| 53 | + start position. |
| 54 | + |
| 55 | + M-w -- quit and save region between start and current point. If region is |
| 56 | + activated before search, use the mark instead of start position. |
| 57 | + |
| 58 | +All other keys will quit the search. Then the key event is |
| 59 | +intepreted in the original environment before search. |
| 60 | + |
| 61 | +if the search quits because of error or using "C-g", point is set |
| 62 | +back to the start position. Otherwise, point is not change and the |
| 63 | +start position is set as marker. So you can use "C-x C-x" back to |
| 64 | +that position. |
| 65 | + |
| 66 | +`iy-go-to-char-backward` search backward by default. Also the search can |
| 67 | +cross lines. To continue search last char, use `iy-go-to-char-continue` and |
| 68 | +`iy-go-to-char-continue-backward`. |
| 69 | + |
| 70 | +### Change Log |
| 71 | + |
| 72 | +2013-04-28 (3.2) |
| 73 | + |
| 74 | + - Add up-to versions: `iy-go-up-to-char`, `iy-go-up-to-char-backward`, |
| 75 | + `iy-go-up-to-char-continue` and `iy-go-up-to-char-continue-backward`. |
| 76 | + |
| 77 | +2013-04-28 (3.1) |
| 78 | + |
| 79 | + - Better integration with `multiple-cursors`. |
| 80 | + - Refactoring documentations. |
| 81 | + |
| 82 | +2013-04-08 (3.0) |
| 83 | + |
| 84 | + - When jump is started backward (with negative parameter, or |
| 85 | + `iy-go-to-char-backward`). Repeating continues the search |
| 86 | + backward. Also `iy-go-to-char-key-forward` jumps with the same |
| 87 | + direction when jump is started, and `iy-go-to-char-key-backward` jumps |
| 88 | + to reverse direction. |
| 89 | + |
| 90 | +2013-03-25 (2.1) |
| 91 | + - Fix a but that I forget to set `mc--this-command` |
| 92 | +2013-03-25 (2.0) |
| 93 | + - Use overriding-local-map to setup keymap |
| 94 | + - multiple-cursors compatible |
| 95 | +2012-04-16 (1.1) |
| 96 | + - fix C-s/C-r to enter isearch |
| 97 | + |
| 98 | +### Function Documentation |
| 99 | + |
| 100 | + |
| 101 | +#### `(iy-go-to-char-done)` |
| 102 | + |
| 103 | +Finish iy-go-to-char-mode. |
| 104 | + |
| 105 | +#### `(iy-go-to-char-quit)` |
| 106 | + |
| 107 | +Quit iy-go-to-char-mode. |
| 108 | + |
| 109 | +#### `(iy-go-to-char-pass-through)` |
| 110 | + |
| 111 | +Finish iy-go-to-char-mode and invoke the corresponding command. |
| 112 | + |
| 113 | +#### `(iy-go-to-char-isearch)` |
| 114 | + |
| 115 | +Start isearch using the char. |
| 116 | + |
| 117 | +#### `(iy-go-to-char-isearch-backward)` |
| 118 | + |
| 119 | +Start isearch backward using the char. |
| 120 | + |
| 121 | +#### `(iy-go-to-char-kill-region)` |
| 122 | + |
| 123 | +Kill region between jump start position and current position. |
| 124 | + |
| 125 | +#### `(iy-go-to-char-kill-ring-save)` |
| 126 | + |
| 127 | +Save region between jump start position and current position. |
| 128 | + |
| 129 | +#### `(iy-go-to-char N CHAR)` |
| 130 | + |
| 131 | +Move forward to N occurrences of CHAR. |
| 132 | + |
| 133 | +Uses keymap `iy-go-to-char-keymap`, which is not currently defined. |
| 134 | + |
| 135 | + |
| 136 | +Typing key of CHAR will move to the next occurence of CHAR. |
| 137 | + |
| 138 | +Typing `iy-go-to-char-key-forward` will move to the next |
| 139 | +occurence of CHAR. |
| 140 | + |
| 141 | +Typing `iy-go-to-char-key-backward`, will move to the previous |
| 142 | +occurence of CHAR. |
| 143 | + |
| 144 | +Typing M-x iy-go-to-char-quit will quit and return to the |
| 145 | +original point. |
| 146 | + |
| 147 | +Typing M-x iy-go-to-char-isearch or |
| 148 | +M-x iy-go-to-char-isearch-backward] will start `isearch` using |
| 149 | +CHAR. |
| 150 | + |
| 151 | +Typing M-x iy-go-to-char-kill-region or |
| 152 | +M-x iy-go-to-char-kill-ring-save will kill/copy between current |
| 153 | +point and the start point. |
| 154 | + |
| 155 | +Unless quit using M-x iy-go-to-char-quit or the region is |
| 156 | +activated before searching, the start point is set as mark. |
| 157 | + |
| 158 | +#### `(iy-go-to-char-backward N CHAR)` |
| 159 | + |
| 160 | +Move backward to N occurence of CHAR. |
| 161 | + |
| 162 | +Uses keymap `iy-go-to-char-keymap`, which is not currently defined. |
| 163 | + |
| 164 | + |
| 165 | +Typing key of CHAR will move to the previous occurence of CHAR. |
| 166 | + |
| 167 | +Typing `iy-go-to-char-key-forward` moves to the next occurrence |
| 168 | +of CHAR. |
| 169 | + |
| 170 | +Typing `iy-go-to-char-key-backward`, moves to the previous |
| 171 | +occurrence of CHAR. |
| 172 | + |
| 173 | +Typing M-x iy-go-to-char-quit will quit and return to the |
| 174 | +original point. |
| 175 | + |
| 176 | +Typing M-x iy-go-to-char-isearch or |
| 177 | +M-x iy-go-to-char-isearch-backward] will start `isearch` using |
| 178 | +CHAR. |
| 179 | + |
| 180 | +#### `(iy-go-up-to-char N CHAR)` |
| 181 | + |
| 182 | +Move forward to N occurrences of CHAR. |
| 183 | +Like `iy-go-to-char` but jump up to the CHAR so it is |
| 184 | +not included in the region between search start position and |
| 185 | +current point. |
| 186 | + |
| 187 | +#### `(iy-go-up-to-char-backward N CHAR)` |
| 188 | + |
| 189 | +Move backward to N occurrences of CHAR. |
| 190 | +Like `iy-go-to-char-backward` but jump up to the CHAR so it is |
| 191 | +not included in the region between search start position and |
| 192 | +current point. |
| 193 | + |
| 194 | +#### `(iy-go-to-or-up-to-continue N &optional STOP-POSITION)` |
| 195 | + |
| 196 | +Continue last `iy-go-to-char` or `iy-go-to-char-backward` by N steps. |
| 197 | +Set `STOP-POSITION` to overwrite the last used stop position strategy. |
| 198 | + |
| 199 | +#### `(iy-go-to-or-up-to-continue-backward N &optional STOP-POSITION)` |
| 200 | + |
| 201 | +Continue last `iy-go-to-char` or `iy-go-to-char-backward` by N steps. |
| 202 | +Set `STOP-POSITION` to overwrite the last used stop position strategy. |
| 203 | + |
| 204 | +#### `(iy-go-to-char-continue N)` |
| 205 | + |
| 206 | +Continue last `iy-go-to-char` or `iy-go-to-char-backward` by N steps. |
| 207 | + |
| 208 | +#### `(iy-go-to-char-continue-backward N)` |
| 209 | + |
| 210 | +Continue last `iy-go-to-char` or `iy-go-to-char-backward` by N steps. |
| 211 | + |
| 212 | +#### `(iy-go-up-to-char-continue N)` |
| 213 | + |
| 214 | +Continue last `iy-go-up-to-char` or `iy-go-up-to-char-backward` by N steps. |
| 215 | + |
| 216 | +#### `(iy-go-up-to-char-continue-backward N)` |
| 217 | + |
| 218 | +Continue last `iy-go-up-to-char` or `iy-go-up-to-char-backward` by N steps. |
| 219 | + |
| 220 | +----- |
| 221 | +<div style="padding-top:15px;color: #d0d0d0;"> |
| 222 | +Markdown README file generated by |
| 223 | +<a href="https://github.com/mgalgs/make-readme-markdown">make-readme-markdown.el</a> |
| 224 | +</div> |
0 commit comments