|
1 |
| -*swoop.txt* Grep and replace easily in multiple files being context aware |
| 1 | +*swoop.txt* Grep and replace easily in multiple files being context aware |
2 | 2 |
|
3 | 3 | Author : pelodelfuego <clement.crepy@gmail.com>
|
4 | 4 | Version : 1.1.6
|
5 | 5 | License : GNU license {{{
|
6 | 6 |
|
7 |
| - Copyright (C) 2015 copyright Clément CREPY |
| 7 | + Copyright (C) 2015 copyright Clément CREPY |
8 | 8 |
|
9 |
| - This program is free software; you can redistribute it and/or modify |
10 |
| - it under the terms of the GNU General Public License as published by |
11 |
| - the Free Software Foundation; either version 2 of the License, or |
12 |
| - (at your option) any later version. |
| 9 | + This program is free software; you can redistribute it and/or modify |
| 10 | + it under the terms of the GNU General Public License as published by |
| 11 | + the Free Software Foundation; either version 2 of the License, or |
| 12 | + (at your option) any later version. |
13 | 13 |
|
14 |
| - This program is distributed in the hope that it will be useful, |
15 |
| - but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
| - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
| - GNU General Public License for more details. |
| 14 | + This program is distributed in the hope that it will be useful, |
| 15 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + GNU General Public License for more details. |
18 | 18 |
|
19 |
| - You should have received a copy of the GNU General Public License |
20 |
| - along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 19 | + You should have received a copy of the GNU General Public License |
| 20 | + along with this program; if not, see <http://www.gnu.org/licenses/>. |
21 | 21 |
|
22 | 22 | }}}
|
23 | 23 |
|
24 | 24 | CONTENTS
|
25 | 25 |
|
| 26 | + Introduction |swoop-introduction| |
| 27 | + Usage |swoop-usage| |
| 28 | + Single buffer mode |swoop-usage-single-buffer-mode| |
| 29 | + Multi buffer mode |swoop-usage-multi-buffer-mode| |
| 30 | + Interaction |swoop-interaction| |
| 31 | + Key Mapping |swoop-interaction-keymap| |
| 32 | + Function |swoop-interaction-function| |
| 33 | + Command |swoop-interaction-command| |
| 34 | + Variable |swoop-variable| |
| 35 | + Behaviour |swoop-variable-behaviour| |
| 36 | + Visual |swoop-variable-visual| |
| 37 | + Tips |swoop-tips| |
| 38 | + |
| 39 | + |
26 | 40 | ==============================================================================
|
27 |
| -INTRODUCTION |
| 41 | +INTRODUCTION *swoop-introduction* |
28 | 42 |
|
29 |
| -Vim swoop is directly inspired from helm-swoop we can find as emacs' plugin. |
30 |
| -It allows you to find and replace occurences in many buffers being aware of the context. |
| 43 | + Vim swoop is directly inspired from helm-swoop we can find as emacs' plugin. |
| 44 | + It allows you to find and replace occurences in many buffers being aware of the context. |
31 | 45 |
|
32 |
| -You can edit the swoopBuffer and the changes you applied will be save for all corresponding files by saving the buffer |
| 46 | + You can edit the swoopBuffer and the changes you applied will be save for all corresponding files by saving the buffer |
| 47 | + |
| 48 | + Especially useful to refactor a name in multiple files and keep control on it... |
33 | 49 |
|
34 |
| -Especially useful to refactor a name in multiple files and keep control on it... |
35 | 50 |
|
36 | 51 | ==============================================================================
|
37 |
| -USAGE *swoop-usage* |
| 52 | +USAGE *swoop-usage* |
38 | 53 |
|
39 |
| -When you start vim-swoop (multi or single buffer mode) you get 2 windows. |
| 54 | + When you start vim-swoop (multi or single buffer mode) you get 2 windows. |
40 | 55 |
|
41 |
| -First one contain context, the other is the swoop buffer. As you move the cursor to a match, the display windows will show the context. |
| 56 | + First one contain context, the other is the |swoop buffer|. As you move the cursor to a match, the display windows will show the context. |
42 | 57 |
|
43 |
| -From the swoop buffer, you can: |
44 |
| - Interactivly edit your search |
45 |
| - Navigate in results (and context) by moving the cursor |
46 |
| - Edit and save Swoop Buffer. |
47 |
| - The changes will be repercuted on all files by saving the Swoop Buffer |
48 |
| - Select current result. |
49 |
| - Exit Swoop and go to the location of current match. |
50 |
| - Quit Swoop. |
51 |
| - Exit Swoop will abort modifications and bring you back to the initial buffer and position.* |
52 |
| - Toggle single and multi buffer mode |
| 58 | + From the |swoop buffer|, you can: |
53 | 59 |
|
54 |
| ------------------------------------------------------------------------------- |
55 |
| -SINGLE BUFFER MODE |
56 |
| -Start in insert mode, first line contains the search pattern. |
57 |
| -As you type the pattern, results will interactivly be displayed bellow. |
| 60 | + - Interactivly edit your search |
58 | 61 |
|
| 62 | + - Navigate in results (and context) by moving the cursor |
| 63 | + |
| 64 | + - Edit and save |swoop buffer|. |
| 65 | + The changes will be repercuted on all files by saving the |swoop buffer| |
| 66 | + |
| 67 | + - Select current result. |
| 68 | + |
| 69 | + - Exit Swoop and go to the location of current match. |
| 70 | + |
| 71 | + - Quit Swoop. |
| 72 | + Exit Swoop will abort modifications and bring you back to the initial buffer and position.* |
| 73 | + |
| 74 | + - Toggle single and multi buffer mode |
59 | 75 |
|
60 |
| ------------------------------------------------------------------------------- |
61 |
| -MULTIPLE BUFFER MODE |
62 |
| -Start in insert mode, first line contains the buffer pattern, no pattern means all buffers. |
63 |
| -Buffer will be displayed interactivly bellow |
64 |
| -Second line contains the search pattern just like in single buffer mode |
65 | 76 |
|
66 |
| -============================================================================== |
67 |
| -INTERACTION |
68 | 77 | ------------------------------------------------------------------------------
|
69 |
| -KEYMAP |
70 |
| -Default mapping to use vim-swoop are: |
| 78 | +SINGLE BUFFER MODE *swoop-usage-single-buffer-mode* |
| 79 | + |
| 80 | + Start in insert mode, first line contains the search pattern. |
| 81 | + As you type the pattern, results will interactivly be displayed bellow. |
71 | 82 |
|
72 |
| -Swoop current buffer |
73 |
| - nmap <Leader>l :call Swoop()<CR> |
74 |
| - vmap <Leader>l :call SwoopSelection()<CR> |
75 | 83 |
|
| 84 | +------------------------------------------------------------------------------ |
| 85 | +MULTIPLE BUFFER MODE *swoop-usage-multi-buffer-mode* |
76 | 86 |
|
77 |
| -Swoop multi buffers |
78 |
| - nmap <Leader>ml :call SwoopMulti()<CR> |
79 |
| - vmap <Leader>ml :call SwoopMultiSelection()<CR> |
| 87 | + Start in insert mode, first line contains the buffer pattern, no pattern means all buffers. |
| 88 | + Buffer will be displayed interactivly bellow |
80 | 89 |
|
81 |
| -NB: if you are in visual mode, you will land in normal mode |
| 90 | + Second line contains the search pattern just like in single buffer mode |
82 | 91 |
|
83 | 92 |
|
84 |
| -You can disabledefault mapping by: |
85 |
| - let g:swoopUseDefaultKeyMap = 0 |
| 93 | +============================================================================== |
| 94 | +INTERACTION *swoop-interaction* |
86 | 95 |
|
87 | 96 |
|
88 | 97 | ------------------------------------------------------------------------------
|
89 |
| -FUNCTION |
90 |
| -Those 2 action are also exposed by the following function: |
| 98 | +KEYMAP *swoop-interaction-keymap* |
| 99 | + |
| 100 | + Default mapping to use vim-swoop are: |
91 | 101 |
|
92 |
| -Current buffer function |
93 |
| - :call SwoopPattern(pattern) |
| 102 | + Swoop current buffer |
| 103 | + nmap <Leader>l :call Swoop()<CR> |
| 104 | + vmap <Leader>l :call SwoopSelection()<CR> |
94 | 105 |
|
95 | 106 |
|
96 |
| -Multi buffer function |
97 |
| - For all buffer |
98 |
| - :call SwoopMultiPattern(searchPattern) |
| 107 | + Swoop multi buffers |
| 108 | + nmap <Leader>ml :call SwoopMulti()<CR> |
| 109 | + vmap <Leader>ml :call SwoopMultiSelection()<CR> |
99 | 110 |
|
100 |
| - For specific buffer |
101 |
| - :call SwoopMultiPattern(searchPattern, bufPattern) |
| 111 | + NB: if you are in visual mode, you will land in normal mode |
| 112 | + |
| 113 | + You can disabledefault mapping by: |
| 114 | + let g:swoopUseDefaultKeyMap = 0 |
102 | 115 |
|
103 | 116 |
|
104 | 117 | ------------------------------------------------------------------------------
|
105 |
| -COMMAND |
106 |
| -A third way to acces Swoop is by a direct command: |
| 118 | +FUNCTION *swoop-interaction-function* |
107 | 119 |
|
108 |
| -For single buffer mode |
109 |
| - :Swoop <pattern> |
| 120 | + Those 2 action are also exposed by the following function: |
110 | 121 |
|
111 |
| -For all buffer mode |
112 |
| - :Swoop! <pattern> |
| 122 | + - Current buffer function |
| 123 | + :call SwoopPattern(pattern) |
113 | 124 |
|
114 | 125 |
|
| 126 | + - Multi buffer function |
| 127 | + - For all buffer |
| 128 | + :call SwoopMultiPattern(searchPattern) |
| 129 | + |
| 130 | + - For specific buffer |
| 131 | + :call SwoopMultiPattern(searchPattern, bufPattern) |
115 | 132 |
|
116 | 133 |
|
117 |
| -============================================================================== |
118 |
| -GLOBAL vARIABLE |
119 | 134 | ------------------------------------------------------------------------------
|
120 |
| -BEHAVIOR |
121 |
| -Set search case insensitive |
122 |
| - By default, smartcase is set, you can go to case insensitive search by: |
123 |
| - let g:swoopIgnoreCase = 1 |
| 135 | +COMMAND *swoop-interaction-command* |
| 136 | + |
| 137 | + A third way to acces Swoop is by a direct command: |
124 | 138 |
|
125 |
| -Disable quick regex mode |
126 |
| - By default, typing ```<Space>``` in the search pattern is replaced by ```.*```. And to type an actual space, you will need to escape it ```\<Space>```. |
127 |
| - You can get classic mode by: |
128 |
| - let g:swoopPatternSpaceInsertsWildcard = 0 |
| 139 | + - Single buffer mode |
| 140 | + :Swoop <pattern> |
129 | 141 |
|
130 |
| -Disable auto insert mode for normal mode |
131 |
| - By default, you will start in insert mode, you can disable it by: |
132 |
| - let g:swoopAutoInserMode = 0 |
| 142 | + - All buffer mode |
| 143 | + :Swoop! <pattern> |
| 144 | + |
| 145 | + |
| 146 | +============================================================================== |
| 147 | +VARIABLE *swoop-variable* |
133 | 148 |
|
134 | 149 |
|
135 | 150 | ------------------------------------------------------------------------------
|
136 |
| -VISUAL |
137 |
| -Lazy Filetype Load |
138 |
| - By default, filetype are lazy loaded when itering over multiple. |
139 |
| - let g:swoopLazyLoadFileType = 0 |
| 151 | +BEHAVIOR *swoop-variable-behaviour* |
| 152 | + |
| 153 | + Set search case insensitive |
| 154 | + By default, smartcase is set, you can go to case insensitive search by: |
| 155 | + let g:swoopIgnoreCase = 1 |
140 | 156 |
|
| 157 | + Disable quick regex mode |
| 158 | + By default, typing <Space>` in the search pattern is replaced by `.*`. And to type an actual space, you will need to escape it <Space>. |
| 159 | + You can get classic mode by: |
| 160 | + let g:swoopPatternSpaceInsertsWildcard = 0 |
141 | 161 |
|
142 |
| -Edit default HightLight |
143 |
| - If default highlight is not relevant with your colorscheme, you can edit it by editing g:swoopHighlight variable. |
144 |
| - let g:swoopHighlight = ["hi! link SwoopBufferLineHi Warning", "hi! link SwoopPatternHi Error"] |
| 162 | + Disable auto insert mode for normal mode |
| 163 | + By default, you will start in insert mode, you can disable it by: |
| 164 | + let g:swoopAutoInserMode = 0 |
145 | 165 |
|
146 |
| -Change default layout |
147 |
| - By default, layout will be horizontal, you can set it vertical by: |
148 |
| - let g:swoopWindowsVerticalLayout = 1 |
149 | 166 |
|
150 |
| -Default SwoopWindowSize |
151 |
| - You can force default size for the swoop window with: |
152 |
| - let g:defaultWinSwoopWidth = 12 |
153 |
| - let g:defaultWinSwoopHeight = 15 |
| 167 | +------------------------------------------------------------------------------ |
| 168 | +VISUAL *swoop-variable-visual* |
154 | 169 |
|
| 170 | + Lazy Filetype Load |
| 171 | + By default, filetype are lazy loaded when itering over multiple. |
| 172 | + let g:swoopLazyLoadFileType = 0 |
155 | 173 |
|
156 | 174 |
|
157 |
| -============================================================================== |
158 |
| -TIPS AND TRICKS |
159 |
| -* Toggle mode |
| 175 | + Edit default HightLight |
| 176 | + If default highlight is not relevant with your colorscheme, you can edit it by editing g:swoopHighlight variable. |
| 177 | + let g:swoopHighlight = ["hi! link SwoopBufferLineHi Warning", "hi! link SwoopPatternHi Error"] |
160 | 178 |
|
161 |
| - You can toggle single and multi buffer mode, your Pattern will stay the same. |
| 179 | + Change default layout |
| 180 | + By default, layout will be horizontal, you can set it vertical by: |
| 181 | + let g:swoopWindowsVerticalLayout = 1 |
162 | 182 |
|
163 |
| - Calling again a mode while your already in will reset the search pattern. |
| 183 | + Default SwoopWindowSize |
| 184 | + You can force default size for the swoop window with: |
| 185 | + let g:defaultWinSwoopWidth = 12 |
| 186 | + let g:defaultWinSwoopHeight = 15 |
164 | 187 |
|
165 | 188 |
|
166 |
| -* Search in swoop buffer |
167 |
| - Since the context display depends of the cursor movement, you can lauch a search inside the search buffer. |
168 | 189 |
|
| 190 | +============================================================================== |
| 191 | +TIPS *swoop-tips* |
| 192 | + Toggle mode |
| 193 | + You can toggle single and multi buffer mode, your Pattern will stay the same. |
| 194 | + Calling again a mode while your already in will reset the search pattern. |
169 | 195 |
|
170 |
| -* Use VisualMode in the swoop Buffer |
171 |
| - When you use visual mode in the swoopBuffer, the context will freeze if you select more than 2 lines. |
172 |
| - But it is really usefull on refactoring session: you can keep only the lines you want to refactor and execute global replace. |
| 196 | + Search in |swoop buffer| |
| 197 | + Since the context display depends of the cursor movement, you can lauch a search inside the search buffer. |
173 | 198 |
|
| 199 | + Use VisualMode in the |swoop buffer| |
| 200 | + When you use visual mode in the swoopBuffer, the context will freeze if you select more than 2 lines. |
| 201 | + But it is really usefull on refactoring session: you can keep only the lines you want to refactor and execute global replace. |
174 | 202 |
|
175 |
| -* Use last search |
176 |
| - When you start swoop (either the mode) and don't enter any pattern, search result will be your last search. |
| 203 | + Use last search |
| 204 | + When you start swoop (either the mode) and don't enter any pattern, search result will be your last search. |
177 | 205 |
|
178 | 206 |
|
0 commit comments