Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
c82f49e7
Commit
c82f49e7
authored
Dec 02, 2015
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4652 from psprint/master
znt: updated README.md, twice as fast searching
parents
00344f76
d427ac1e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
README.md
plugins/zsh-navigation-tools/README.md
+3
-2
n-list
plugins/zsh-navigation-tools/n-list
+10
-8
No files found.
plugins/zsh-navigation-tools/README.md
View file @
c82f49e7
...
@@ -105,7 +105,8 @@ colorize output of the tools, via their config files (check out e.g. n-cd.conf,
...
@@ -105,7 +105,8 @@ colorize output of the tools, via their config files (check out e.g. n-cd.conf,
it uses this).
it uses this).
## Performance
## Performance
ZNT
is
fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to
ZNT
are
fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to
be released).
be released).
# vim:filetype=conf
vim:filetype=conf
plugins/zsh-navigation-tools/n-list
View file @
c82f49e7
...
@@ -261,18 +261,15 @@ while (( 1 )); do
...
@@ -261,18 +261,15 @@ while (( 1 )); do
local
search_buffer
=
"
${
NLIST_SEARCH_BUFFER
%% ##
}
"
local
search_buffer
=
"
${
NLIST_SEARCH_BUFFER
%% ##
}
"
search_buffer
=
"
${
search_buffer
## ##
}
"
search_buffer
=
"
${
search_buffer
## ##
}
"
search_buffer
=
"
${
search_buffer
//(#m)[][*?|#~^()><\\]/\\
$MATCH
}
"
search_buffer
=
"
${
search_buffer
//(#m)[][*?|#~^()><\\]/\\
$MATCH
}
"
local
search_pattern
=
""
local
colsearch_pattern
=
""
if
[
-n
"
$search_buffer
"
]
;
then
if
[
-n
"
$search_buffer
"
]
;
then
# Patterns will be *foo*~^*bar* and foo|bar)
# Patterns will be *foo*~^*bar* and foo|bar)
local
search_pattern
=
"
${
search_buffer
// ##/*~^*
}
"
search_pattern
=
"
${
search_buffer
// ##/*~^*
}
"
local
colsearch_pattern
=
"
${
search_buffer
// ##/|
}
"
colsearch_pattern
=
"
${
search_buffer
// ##/|
}
"
list
=(
"
${
(@M)list
:#
(#i)*
$~search_pattern
*
}
"
)
list
=(
"
${
(@M)list
:#
(#i)*
$~search_pattern
*
}
"
)
last_element
=
"
$#list
"
last_element
=
"
$#list
"
local
red
=
$'
\x
1b[00;31m'
reset
=
$'
\x
1b[00;00m'
col_list
=(
"
${
(@)list//(#mi)(
$~colsearch_pattern
)/
$red
${
MATCH
}
$reset
}
"
)
else
col_list
=(
"
$list
[@]"
)
fi
fi
# Called after processing list
# Called after processing list
...
@@ -286,7 +283,12 @@ while (( 1 )); do
...
@@ -286,7 +283,12 @@ while (( 1 )); do
if
[
"
$prev_start_idx
"
-ne
"
$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN
"
]
;
then
if
[
"
$prev_start_idx
"
-ne
"
$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN
"
]
;
then
prev_start_idx
=
"
$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN
"
prev_start_idx
=
"
$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN
"
disp_list
=(
"
${
(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]
}
"
)
disp_list
=(
"
${
(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]
}
"
)
if
[
-n
"
$colsearch_pattern
"
]
;
then
local
red
=
$'
\x
1b[00;31m'
reset
=
$'
\x
1b[00;00m'
disp_list
=(
"
${
(@)disp_list//(#mi)(
$~colsearch_pattern
)/
$red
${
MATCH
}
$reset
}
"
)
fi
# We have display list, lets replace newlines with "\n" when needed (1/3)
# We have display list, lets replace newlines with "\n" when needed (1/3)
[
"
$NLIST_REPLACE_NEWLINES
"
-eq
1
]
&&
disp_list
=(
"
${
(@)disp_list//
$'
\n
'
/\\n
}
"
)
[
"
$NLIST_REPLACE_NEWLINES
"
-eq
1
]
&&
disp_list
=(
"
${
(@)disp_list//
$'
\n
'
/\\n
}
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment