177 ### vi-replace (unbound) (R) (unbound) |
177 ### vi-replace (unbound) (R) (unbound) |
178 ### Enter overwrite mode. |
178 ### Enter overwrite mode. |
179 ### |
179 ### |
180 |
180 |
181 vi-replace() { |
181 vi-replace() { |
|
182 if [[ $ZLE_STATE == *overwrite* ]]; then # Switch back to insert mode |
|
183 builtin zle .vi-insert |
|
184 redisplay-insert |
|
185 return |
|
186 fi |
182 show_mode "$__string_replace" |
187 show_mode "$__string_replace" |
183 builtin zle .vi-replace |
188 builtin zle .vi-replace |
184 } |
189 } |
185 zle -N vi-replace |
190 zle -N vi-replace |
186 bindkey -M vicmd "R" vi-replace |
191 bindkey -M vicmd "R" vi-replace |
209 # Specific to command mode |
214 # Specific to command mode |
210 bindkey -M vicmd "g~" vi-oper-swap-case |
215 bindkey -M vicmd "g~" vi-oper-swap-case |
211 bindkey -M vicmd 'guw' down-case-word |
216 bindkey -M vicmd 'guw' down-case-word |
212 bindkey -M vicmd 'gUw' up-case-word |
217 bindkey -M vicmd 'gUw' up-case-word |
213 |
218 |
214 bindkey -M vicmd "^[[2~" vi-insert |
219 bindkey -M vicmd '^[[2~' vi-insert |
215 bindkey -M vicmd 'q' push-line |
220 bindkey -M vicmd 'q' push-line |
216 |
221 |
217 # Specific to insert mode |
222 # Specific to insert mode |
218 bindkey -M viins '^A' beginning-of-line |
223 bindkey -M viins '^A' beginning-of-line |
219 bindkey -M viins '^E' end-of-line |
224 bindkey -M viins '^E' end-of-line |
220 |
225 |
221 bindkey -M viins '^[[5~' history-beginning-search-backward # PgUp |
226 bindkey -M viins '^[[5~' history-beginning-search-backward # PgUp |
222 bindkey -M viins '^[[6~' history-beginning-search-forward # PgDn |
227 bindkey -M viins '^[[6~' history-beginning-search-forward # PgDn |
|
228 |
|
229 bindkey -M viins '^[[2~' vi-replace |
223 |
230 |
224 bindkey -M viins '^[[A' up-line-or-history |
231 bindkey -M viins '^[[A' up-line-or-history |
225 bindkey -M viins '^[[B' down-line-or-history |
232 bindkey -M viins '^[[B' down-line-or-history |
226 |
233 |
227 bindkey -M viins '^Xc' copy-prev-shell-word |
234 bindkey -M viins '^Xc' copy-prev-shell-word |
254 # These bindings depend on the ftzle script |
261 # These bindings depend on the ftzle script |
255 bindkey -M viins "^X^W" backward-kill-to-slash |
262 bindkey -M viins "^X^W" backward-kill-to-slash |
256 bindkey '^I' ft-complete |
263 bindkey '^I' ft-complete |
257 |
264 |
258 |
265 |
259 if [[ -z ${TERM:#screen} ]]; then |
266 if [[ $TERM == screen* || $TERM == tmux* ]]; then |
260 bindkey -M viins '^[[1~' beginning-of-line # Home |
267 bindkey -M viins '^[[1~' beginning-of-line # Home |
261 bindkey -M vicmd '^[[1~' beginning-of-line # Home |
268 bindkey -M vicmd '^[[1~' beginning-of-line # Home |
262 bindkey -M viins '^[[4~' end-of-line # End |
269 bindkey -M viins '^[[4~' end-of-line # End |
263 bindkey -M vicmd '^[[4~' end-of-line # End |
270 bindkey -M vicmd '^[[4~' end-of-line # End |
264 fi |
271 fi |