initial checkin
[zsh-lovers.git] / zsh_people / strcat / zshstatusbar
1 # Posted by Thomas Köhler on the Zsh-Mailinglist (since ~1999)
2 #
3 # vi mode extensions
4 redisplay() {
5    builtin zle .redisplay
6    ( true ; show_mode "INSERT") &!
7 }
8 redisplay2() {
9    builtin zle .redisplay
10    (true ; show_mode "COMMAND") &!
11 }
12 screenclear () {
13    echo -n "\033[2J\033[400H"
14    builtin zle .redisplay
15    (true ; show_mode "INSERT") &!
16 }
17
18 screenclearx () {
19    repeat 2 print 
20    local MYLINE="$LBUFFER$RBUFFER"
21    highlight $MYLINE
22    repeat 4 print 
23    builtin zle redisplay
24 }
25 show_mode() {
26    local COL
27    local x
28    COL=$[COLUMNS-3]
29    COL=$[COL-$#1]
30    x=$(echo $PREBUFFER | wc -l )
31 #   x=$[x+1]
32    x=$[x+0]
33    echo -n "\e7\e[$x;A\e[0;G"
34    echo -n ""
35    echo -n "\e[0;37;44m--$1--\e[0m"
36    echo -n "\e8"
37 }
38
39 # vi-add-eol 
40 #    Move  to the end of the line and enter insert mode.
41 vi-add-eol() {
42    show_mode "INSERT"
43    builtin zle .vi-add-eol
44 }
45
46 # vi-add-next
47 #    Enter insert mode after the  current  cursor  position, without changing lines.
48 vi-add-next() {
49    show_mode "INSERT"
50    builtin zle .vi-add-next
51 }
52
53 # vi-change 
54 #    Read a movement command from the keyboard, and kill from the
55 #    cursor position to the endpoint of the movement. Then enter
56 #    insert mode. If the command is vi-change.
57 vi-change() {
58    show_mode "INSERT"
59    builtin zle .vi-change
60 }
61
62 # vi-change-eol 
63 #    Kill  to the end of the line and enter insert mode.
64 vi-change-eol() {
65    show_mode "INSERT"
66    builtin zle .vi-change-eol
67 }
68
69 # vi-change-whole-line 
70 #    Kill the current line and enter insert mode.
71 vi-change-whole-line() {
72    show_mode "INSERT"
73    builtin zle .vi-change-whole-line
74 }
75
76 # vi-insert
77 #    Enter insert mode.
78 vi-insert() {
79    show_mode "INSERT"
80    builtin zle .vi-insert
81 }
82
83 # vi-insert-bol 
84 #    Move to the first non-blank character on the line and enter insert mode.
85 vi-insert-bol() {
86    show_mode "INSERT"
87    builtin zle .vi-insert-bol
88 }
89
90 # vi-open-line-above 
91 #    Open a line above the cursor and enter insert mode.
92 vi-open-line-above() {
93    show_mode "INSERT"
94    builtin zle .vi-open-line-above
95 }
96
97 # vi-open-line-below
98 #    Open a line below the cursor and enter insert mode.
99 vi-open-line-below() {
100    show_mode "INSERT"
101    builtin zle .vi-open-line-below
102 }
103
104 # vi-substitute
105 #    Substitute the next character(s).
106 vi-substitute() {
107    show_mode "INSERT"
108    builtin zle .vi-substitute
109 }
110
111 #vi-replace
112 #   Enter overwrite mode.
113 vi-replace() {
114    show_mode "REPLACE"
115    builtin zle .vi-replace
116 }
117
118 # vi-cmd-mode
119 #    Enter  command  mode;  that  is, select the `vicmd' keymap.  Yes,
120 #    this is bound  by  default  in  emacs mode.
121 vi-cmd-mode() {
122    show_mode "COMMAND"
123    builtin zle .vi-cmd-mode
124 }