forked from irchelp/irchelp.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNickCompleter.irc
More file actions
156 lines (128 loc) · 5.88 KB
/
NickCompleter.irc
File metadata and controls
156 lines (128 loc) · 5.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
### Nick Completer by DC-itsme ([email protected])
### version 0.70 ALPHA (preliminary test version)
### This script claims ^n and ^t .
## modified by Jolo to ^k and ^t
### This is a fairly simple script to run. Start typing the nick of someone
### on the channel to which you are currently speaking. Then press Ctrl-n.
### This script fills in a nick for you. If choices are given (i.e., if
### several nicks match the search string -- whatever you typed after the
### last space preceding your pressing Ctrl-n), press Ctrl-t to switch among
### these. Typing a 2 or 3 letter search string will make using Ctrl-t
### unnecessary in most cases.
### KNOWN BUG: This script will not work properly if the search string
### ends in a \. This has already been fixed in version 0.80, which is not
### yet ready for release however. This bug is easily avoided. e.g., if
### \\bot_jerk is on the channel, you can type \\b and then press Ctrl-n .
### Simply do not press Ctrl-n right after typing a \.
### To cycle through all of the nicks on the channel, simply press Ctrl-n
### at the beginning of the input line, or after a space -- pressing Ctrl-t
### then moves you from nick to nick.
### FEATURES/LIMITATIONS
### Even though this version is unfinished, it is by far the best Nick
### Completion script I have written.
### 1) Like my earlier versions (such as NiComplete.irc, and earlier versions
### of this very script), many odd characters (like {,},|,-, _, ^, and \)
### can be handled (\ can be anywhere in the nick, but it should NOT be at
### the end of the search string -- see KNOWN BUG above).
### 2) This script can be activated from anywhere on the input line.
### 3) If multiple nicks match the search string, all such nicks are shown,
### and you can switch among them by pressing Ctrl-t, as noted above.
### WARNING: Do not press Ctrl-t until this script displays the list of
### possibilities.
### 4) This script should be reasonably portable, but it has only been tested
### on my ircii 2.8.2 client. It should be compatible with other scripts,
### for the most part, the most obvious possible conflict being the binding
### of ^n and ^t by this script.
### NOTES ON CODING
### 1) Handling of odd characters was accomplished by using $^\^^variable
### when appropriate, and by judicious use of command [$variable] in place
### of eval command $variable . eval can really mess things up in a
### script like this.
###
### 2) Because delete_previous_word does not function properly in ircii (e.g.,
### it counts a-b-c-d as four words), I needed some other way to get the
### search string. Cutting the whole line saves it to $U . At that point,
### I wanted to make use of the $~ variable, which stores the last word in
### the current buffer. In order to put $U in the right place, I made it
### a parameter of the get_search routine.
### DISCLAIMER: This program is being tested on a clean installation of
### ircii 2.8.2, not running other scripts. I do not know how it will work
### on other clients. There may be bugs, as this is a test version (see
### KNOWN BUG above).
### Please direct all comments to the author.
### Copyright (c) by David G. Caraballo, July 1996
//^bind ^k parse_command complete_the_nick
//^bind ^t parse_command change_nicks
//alias becho echo $0-
becho Nick Completer 0.70 ALPHA
#becho Nick Completer 0.70 ALPHA TEST (by [email protected])
#becho USAGE: Start typing the nick, and then press Ctrl-n.
#becho If several choices appear, press Ctrl-t to switch among them.
#becho For more details, read the discussion in the script.
### deletes $0 chars from the end of the input line
//alias delchars {
@ delchars_ctr = 0
//while ([$delchars_ctr]<[$0]) {
//parsekey backspace;@ delchars_ctr = delchars_ctr + 1 }
//^assign -delchars_ctr
}
//alias get_search {
//^assign nic.search.temp [$~]
@ nic.search.len = [[email protected]] - 2
@ nic.search = [$mid(1 $nic.search.len [$~])]
//^assign -nic.search.temp
}
//alias complete_the_nick {
//parsekey erase_line;//parsekey yank_from_cutbuffer
@ nic.toggle=0
//^assign -thenick;//^assign -nic.list
//^assign -nic.search;//^assign -nic.search.len
### Get search string.
if ([$right(1 $U)]== [ ]) {
@ nic.search = [$right(0 [])]
}{
get_search $U
}
### Now print the first match and THEN create a list of all nicks in $C
### starting with nic.search .
^assign -nic.chanusers
@ nic.chanusers = [$chanusers($C)]
### The next line won't work right without the ^\^^ in front of nic.chanusers.
@ nic.search2 = [${nic.search##[*]}]
@ listnum = [$match($^\^^nic.search2 $^\^^nic.chanusers)]
@ thenick = [$word(${listnum - 1} $nic.chanusers)]
@ nic.ctr1 = [$listnum]
//^assign -listnum;//^assign -nic.search2
delchars $nic.search.len
//type $^\^^thenick
@ nic.toggle = 1;@nic.ctr2 = 0
@ nic.list = [$thenick]
//while ([$nic.ctr1] <= [$#nic.chanusers]) {
if ( match($^\^^nic.search* $word($nic.ctr1 $^\^^nic.chanusers)) > 0 ) {
@ nic.list = [$nic.list $word($nic.ctr1 $nic.chanusers)]
}{}
@ nic.ctr1 = nic.ctr1 + 1
}
if ([$#nic.list] > 1) {
becho Press Ctrl-t to switch among the nicks in []'s: [$nic.list]
}{
if ([$#nic.list] < 1) {
eval becho *** Nick Completer did not find a nick beginning with '$^\^^nic.search' on channel ${ C }.
}{}
}
}
//alias change_nicks {
if (nic.toggle) {
if (nic.ctr2 < [$#nic.list] - 1) {
@ nic.ctr2 = nic.ctr2 + 1
}{ @ nic.ctr2 = 0}
delchars $@thenick
@ thenick = [$word($nic.ctr2 $nic.list)]
//type $^\^^{ thenick }
//^assign -nic.chanusers
}{}
}
### CREDITS
### Written by [email protected]
### Thanks to [email protected] and [email protected]
### for testing!