Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
c2b4d9ff
Commit
c2b4d9ff
authored
Nov 30, 2015
by
Sebastian Gniazdowski
Browse files
znt: n-history supports multi-line cmds and starts with current buffer
parent
afd28bf1
Changes
5
Hide whitespace changes
Inline
Side-by-side
plugins/zsh-navigation-tools/.config/znt/n-cd.conf
View file @
c2b4d9ff
# Hotlist
# Hotlist
local
hotlist
local
hotlist
hotlist
=(
hotlist
=(
~/.
config
/
znt
/
usr
/
share
/
zsh
/
site
-
functions
/
usr
/
share
/
zsh
/
site
-
functions
/
usr
/
share
/
zsh
/
usr
/
share
/
zsh
/
usr
/
local
/
share
/
zsh
/
site
-
functions
/
usr
/
local
/
share
/
zsh
/
site
-
functions
...
...
plugins/zsh-navigation-tools/.config/znt/n-history.conf
View file @
c2b4d9ff
...
@@ -3,3 +3,8 @@
...
@@ -3,3 +3,8 @@
# On Linux virtual terminal this will be enforced to reverse (because of poor
# On Linux virtual terminal this will be enforced to reverse (because of poor
# underline support on that terminal)
# underline support on that terminal)
local
active_text
=
underline
local
active_text
=
underline
# Highlight a few keywords
local
NLIST_COLORING_PATTERN
=
"(while|for |sudo|make|(#s)git|vim(#e)|vim |emacs(#e)|emacs )"
local
NLIST_COLORING_COLOR
=$
'\x1b[00;33m'
local
NLIST_COLORING_MATCH_MULTIPLE
=
1
plugins/zsh-navigation-tools/n-history
View file @
c2b4d9ff
...
@@ -10,6 +10,7 @@ emulate -L zsh
...
@@ -10,6 +10,7 @@ emulate -L zsh
setopt extendedglob
setopt extendedglob
zmodload zsh/curses
zmodload zsh/curses
zmodload zsh/parameter
local
IFS
=
"
local
IFS
=
"
"
"
...
@@ -24,16 +25,16 @@ local selected
...
@@ -24,16 +25,16 @@ local selected
NLIST_REMEMBER_STATE
=
0
NLIST_REMEMBER_STATE
=
0
list
=(
`
builtin history
-rn
1
`
)
list
=(
"
$history
[@]"
)
list
=(
"
${
(@M)list
:#
(#i)*
$1
*
}
"
)
list
=(
"
${
(@M)list
:#
(#i)*
$1
*
}
"
)
local
NLIST_GREP_STRING
=
"
$1
"
if
[
"
$#list
"
-eq
0
]
;
then
if
[
"
$#list
"
-eq
0
]
;
then
echo
"No matching history entries"
echo
"No matching history entries"
return
1
return
1
fi
fi
local
NLIST_GREP_STRING
=
"
$1
"
local
NLIST_REPLACE_NEWLINES
=
"1"
n-list
"
${
list
[@]
}
"
n-list
"
${
list
[@]
}
"
if
[
"
$REPLY
"
-gt
0
]
;
then
if
[
"
$REPLY
"
-gt
0
]
;
then
...
...
plugins/zsh-navigation-tools/n-list
View file @
c2b4d9ff
...
@@ -139,6 +139,7 @@ if [ "$#" -lt 1 ]; then
...
@@ -139,6 +139,7 @@ if [ "$#" -lt 1 ]; then
fi
fi
REPLY
=
"-1"
REPLY
=
"-1"
typeset
-ga
reply
reply
=()
reply
=()
integer
term_height
=
"
$LINES
"
integer
term_height
=
"
$LINES
"
...
@@ -188,6 +189,11 @@ if [ "$NLIST_START_IN_SEARCH_MODE" -eq 1 ]; then
...
@@ -188,6 +189,11 @@ if [ "$NLIST_START_IN_SEARCH_MODE" -eq 1 ]; then
NLIST_IS_SEARCH_MODE
=
1
NLIST_IS_SEARCH_MODE
=
1
fi
fi
if
[
-n
"
$NLIST_SET_SEARCH_TO
"
]
;
then
NLIST_SEARCH_BUFFER
=
"
$NLIST_SET_SEARCH_TO
"
NLIST_SET_SEARCH_TO
=
""
fi
if
[
"
$NLIST_START_IN_UNIQ_MODE
"
-eq
1
]
;
then
if
[
"
$NLIST_START_IN_UNIQ_MODE
"
-eq
1
]
;
then
NLIST_START_IN_UNIQ_MODE
=
0
NLIST_START_IN_UNIQ_MODE
=
0
NLIST_IS_UNIQ_MODE
=
1
NLIST_IS_UNIQ_MODE
=
1
...
@@ -281,6 +287,9 @@ while (( 1 )); do
...
@@ -281,6 +287,9 @@ 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
=(
"
${
(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]
}
"
)
# We have display list, lets replace newlines with "\n" when needed (1/3)
[
"
$NLIST_REPLACE_NEWLINES
"
-eq
1
]
&&
disp_list
=(
"
${
(@)disp_list//
$'
\n
'
/\\n
}
"
)
fi
fi
# Output colored list
# Output colored list
...
@@ -333,11 +342,17 @@ while (( 1 )); do
...
@@ -333,11 +342,17 @@ 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
=(
"
${
(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]
}
"
)
disp_list
=(
"
${
(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]
}
"
)
# We have display list, lets replace newlines with "\n" when needed (2/3)
[
"
$NLIST_REPLACE_NEWLINES
"
-eq
1
]
&&
disp_list
=(
"
${
(@)disp_list//
$'
\n
'
/\\n
}
"
)
fi
fi
else
else
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
=(
"
${
(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]
}
"
)
# We have display list, lets replace newlines with "\n" when needed (3/3)
[
"
$NLIST_REPLACE_NEWLINES
"
-eq
1
]
&&
disp_list
=(
"
${
(@)disp_list//
$'
\n
'
/\\n
}
"
)
fi
fi
fi
fi
...
...
plugins/zsh-navigation-tools/znt-history-widget
View file @
c2b4d9ff
autoload znt-usetty-wrapper n-history
autoload znt-usetty-wrapper n-history
local NLIST_START_IN_SEARCH_MODE=1
local NLIST_START_IN_SEARCH_MODE=1
local NLIST_START_IN_UNIQ_MODE=1
local NLIST_START_IN_UNIQ_MODE=1
local NLIST_SET_SEARCH_TO="$BUFFER"
znt-usetty-wrapper n-history "$@"
znt-usetty-wrapper n-history "$@"
unset NLIST_START_IN_SEARCH_MODE
unset NLIST_START_IN_SEARCH_MODE
unset NLIST_START_IN_UNIQ_MODE
unset NLIST_START_IN_UNIQ_MODE
unset NLIST_SET_SEARCH_TO
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