* zle_vi.c - vi-specific functions
* This file is part of zsh, the Z shell.
* This software is Copyright 1992 by Paul Falstad
* Permission is hereby granted to copy, reproduce, redistribute or otherwise
* use this software as long as: there is no monetary profit gained
* specifically from the use or reproduction of this software, it is not
* sold, rented, traded or otherwise marketed, and this copyright notice is
* included prominently in any copy made.
* The author make no claims as to the fitness or correctness of this software
* for any use whatsoever, and it is provided as is. Any use of this software
* is at the user's own risk.
static void startvichange(im
)
if (vichgbuf
) free(vichgbuf
);
vichgbuf
= zalloc(vichgbufsz
= 16);
static void startvitext(im
)
if ((ch
= getkey(0)) == -1)
if ((ch
= getkey(0)) == -1)
int k2
,t0
,startline
,endline
;
if (zlecmds
[k2
].flags
& ZLE_ARG
)
return (t0
== ll
) ? t0
: t0
+1;
if (!(zlecmds
[k2
].flags
& ZLE_MOVEMENT
)) {
wordflag
= virangeflag
= 0;
if (startline
!= findbol()) {
if (zlecmds
[k2
].flags
& ZLE_LINEMOVE
) {
if (cs
< startline
) cs
= startline
;
else if (cs
>= endline
) cs
= endline
-1;
if ((c2
= getvirange(0)) == -1)
{ vichgflag
= 0; return; }
if ((c2
= getvirange(1)) == -1)
{ vichgflag
= 0; return; }
if (findeol()-cs
< mult
) mult
= findeol()-cs
;
void vichangewholeline() /**/
if ((c2
= getvirange(0)) == -1) return;
void vireplacechars() /**/
if (ch
= vigetkey()) while (mult
--) line
[cs
++] = ch
;
if (vichgflag
) vichgflag
= 0;
void viopenlinebelow() /**/
void viopenlineabove() /**/
void vioperswapcase() /**/
if ((c2
= getvirange(0)) == -1)
void virepeatchange() /**/
if (!vichgbuf
|| bindtab
== mainbindtab
|| vichgflag
) feep();
else ungetkeys(vichgbuf
,vichgbufptr
);
if (mult
< 0) { mult
= -mult
; viunindent(); return; }
if ((c2
= getvirange(0)) == -1)
if (cs
!= findbol()) { feep(); return; }
for (t0
= 0; t0
!= rmult
; t0
++) line
[cs
++] = '\t';
if (mult
< 0) { mult
= -mult
; viindent(); return; }
if ((c2
= getvirange(0)) == -1)
if (cs
!= findbol()) { feep(); return; }
for (t0
= 0; t0
!= rmult
&& line
[cs
] == '\t'; t0
++) foredel(1);