n-help
5615 bytes
1autoload colors
2colors
3
4local h1="$fg_bold[magenta]"
5local h2="$fg_bold[green]"
6local h3="$fg_bold[blue]"
7local h4="$fg_bold[yellow]"
8local h5="$fg_bold[cyan]"
9local rst="$reset_color"
10
11LESS="-iRc" less <<<"
12${h1}Key Bindings${rst}
13
14${h2}H${rst}, ${h2}?${rst} (from n-history) - run n-help
15${h2}Ctrl-A${rst} - rotate entered words (1+2+3 -> 3+1+2)
16${h2}Ctrl-F${rst} - fix mode (approximate matching)
17${h2}Ctrl-L${rst} - redraw of whole display
18${h2}Ctrl-T${rst} - browse themes (next theme)
19${h2}Ctrl-G${rst} - browse themes (previous theme)
20${h2}Ctrl-U${rst} - half page up
21${h2}Ctrl-D${rst} - half page down
22${h2}Ctrl-P${rst} - previous element (also done with vim's k)
23${h2}Ctrl-N${rst} - next element (also done with vim's j)
24${h2}[${rst}, ${h2}]${rst} - jump directory bookmarks in n-cd and typical signals in n-kill
25${h2}g, ${h2}G${rst} - beginning and end of the list
26${h2}/${rst} - show incremental search
27${h2}F3${rst} - show/hide incremental search
28${h2}Esc${rst} - exit incremental search, clearing filter
29${h2}Ctrl-W${rst} (in incremental search) - delete whole word
30${h2}Ctrl-K${rst} (in incremental search) - delete whole line
31${h2}Ctrl-O, ${h2}o${rst} - enter uniq mode (no duplicate lines)
32${h2}Ctrl-E, ${h2}e${rst} - edit private history (when in private history view)
33${h2}F1${rst} - (in n-history) - switch view
34${h2}F2${rst}, ${h2}Ctrl-X${rst}, ${h2}Ctrl-/${rst} - search predefined keywords (defined in config files)
35
36${h1}Configuration files${rst}
37
38Location of the files is ${h3}~/.config/znt${rst}. Skeletons are copied there
39when using ${h3}zsh-navigation-tools.plugin.zsh${rst} file (sourcing it or using
40a plugin manager). There's a main config file ${h3}n-list.conf${rst} and files
41for each tool.
42
43To have a skeleton copied again into ${h3}~/.config/znt${rst}, delete it from
44there and restart Zsh a few times (3-7 or so; there's a random check
45that optimizes startup time).
46
47${h1}Predefined search keywords${rst}
48
49Following block of code in e.g. ${h3}~/.config/znt/n-history.conf${rst} defines
50set of keywords that can be invoked (i.e. searched for) via ${h2}F2${rst}, ${h2}Ctrl-X${rst}
51or ${h2}Ctrl-/${rst}:
52
53 ${h4}# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/${rst}
54 ${h2}local${rst} -a keywords
55 keywords=( ${h2}\"git\" \"vim\" \"mplayer\"${rst} )
56
57${h1}Search query rotation${rst}
58
59When searching, after pressing ${h2}Ctrl-A${rst}, words 1 2 3 will become 3 1 2, etc.
60This can be used to edit some not-last word.
61
62${h1}Fix mode${rst}
63
64Approximate matching - pressing ${h2}f${rst} or ${h2}Ctrl-F${rst} will enter "FIX" mode, in which
651 or 2 errors are allowed in what's searched. This utilizes original Zsh
66approximate matching features and is intended to be used after entering
67search query, when a typo is discovered.
68
69${h1}Color themes${rst}
70
71Following block of code in ${h3}~/.config/znt/n-list.conf${rst} defines set of
72themes that can be browsed with ${h2}Ctrl-T${rst} and ${h2}Ctrl-G${rst}:
73
74 ${h4}# Combinations of colors to try out with Ctrl-T and Ctrl-G
75 # The last number is the bold option, 0 or 1${rst}
76 ${h2}local${rst} -a themes
77 themes=( ${h2}\"white/black/1\" \"green/black/0\" \"green/black/1\"${rst}
78 ${h2}\"white/blue/0\" \"white/blue/1\" \"magenta/black/0\"${rst}
79 ${h2}\"magenta/black/1\"${rst} )
80
81It's \"foreground/background/bold\". There's support for 256-color themes
82for Zsh > 5.2, defined like e.g.:
83
84 themes=( ${h2}\"white/17/0\" \"10/17/1\" \"white/24/1\"${rst} )
85
86i.e. with use of numbers, from 0 to 254.
87
88${h1}Private history${rst}
89
90N-history stores what's selected in its own history file. It can be
91edited. Use ${h2}e${rst} or ${h2}Ctrl-E${rst} for that when in n-history. Your \$EDITOR will
92start. This is a way to have handy set of bookmarks prepared in private
93history's file.
94
95Private history is instantly shared among sessions.
96
97${h1}Zshrc integration${rst}
98
99There are 5 standard configuration variables that can be set in zshrc:
100
101${h4}znt_history_active_text${rst}
102\"underline\" or \"reverse\" - how should be active element highlighted
103${h4}znt_history_nlist_coloring_pattern${rst}
104Pattern that can be used to colorize elements
105${h4}znt_history_nlist_coloring_color${rst}
106Color with which to colorize via the pattern
107${h4}znt_history_nlist_coloring_match_multiple${rst}
108Should multiple matches be colorized (${h2}\"0\"${rst} or ${h2}\"1\"${rst})
109${h4}znt_history_keywords ${h2}(array)${rst}
110Search keywords activated with Ctrl-X, F2, Ctrl-/, e.g. ( ${h2}\"git\"${rst} ${h2}\"vim\"${rst} )
111
112Above variables will work for n-history tool. For other tools, change
113\"_history_\" to e.g. \"_cd_\", for the n-cd tool. The same works for
114all 8 tools.
115
116Common configuration of the tools uses variables with \"_list_\" in them:
117
118${h4}znt_list_bold${rst}
119Should draw text in bold (${h2}\"0\"${rst} or ${h2}\"1\"${rst})
120${h4}znt_list_colorpair${rst}
121Main pair of colors to be used, e.g ${h2}\"green/black\"${rst}
122${h4}znt_list_border${rst}
123Should draw borders around windows (${h2}\"0\"${rst} or ${h2}\"1\"${rst})
124${h4}znt_list_themes ${h2}(array)${rst}
125List of themes to try out with Ctrl-T, e.g. ( ${h2}\"white/black/1\"${rst}
126${h2}\"green/black/0\"${rst} )
127${h4}znt_list_instant_select${rst}
128Should pressing enter in search mode leave tool (${h2}\"0\"${rst} or ${h2}\"1\"${rst})
129
130If you used ZNT before v2.1.12 then remove old configuration files
131${h3}~/.config/znt/*.conf${rst} so that ZNT can update them to the latest versions
132that support integration with Zshrc. If you used installer then run it
133again (after the remove of configuration files), that is not needed when
134using as plugin.
135"