dvorka / hstr Goto Github PK
View Code? Open in Web Editor NEWbash and zsh shell history suggest box - easily view, navigate, search and manage your command history.
Home Page: http://me.mindforger.com
License: Apache License 2.0
bash and zsh shell history suggest box - easily view, navigate, search and manage your command history.
Home Page: http://me.mindforger.com
License: Apache License 2.0
Self-bind to key in BASH.
Instead of filtering keys rewrite key loop to accepting only allowed keys.
To be tested on terminal resize, arrows, ...
tig
mc is present - is it caused by blacklist array length?
Read once more also HISTIGNORE in order to find out whether there is anything HH could do - manage blacklist from HH?
Reproducible on Saucy.
History items ranking (prefix > sum(occurences @ history))
Colors (no color terminal support i.e. on/off colors) i.e. disable white highlight if terminal doesn't support colors.
Introduce keys like 'd' to delete a command with type from BASH history.
Here's an enhancement suggestion, which has its pros & cons.
Right now, hh
(v0.71) prints installation instructions when any parameters are given (which got me very confused before I had a look at the main() function :-)). I wonder whether it might be interesting to instead interpret these parameters as search string to narrow down the initially displayed history entries.
My use case is as follows: I often start typing a command (with parameters), only to remember in the middle of the typing that I certainly must have that lengthy command with all its gory details somewhere in my history. For example
git clone https://github.com/dvor
In this case, the built-in C-r search doesn't really help me (unless I want to type everything again), so I usually end up typing 'C-a history | grep'
, resulting in
history | grep 'git clone https://github.com/dvor'
which typically spits out one or more lines that I can use (for copy&paste). It'd be great to instead turn it into something like:
hh 'git clone https://github.com/dvor'
and then hh
works as if I started it without parameters and typed the beginning of that git command manually.
That's the basic idea. I guess, however, that it would not be too trivial to implement because if the parameter to hh
is not properly quoted, it would show up as multiple arguments. On the other hand, binding hh
's C-r
to C-e'C-ahh'
would not work reliably if the search string contains one or more ' itself. But anyway even with running into unbalanced ' issues from time to time, I think hh
would save me even more time then. :-)
e.g. ESC key doesn't work
Set cursor to prompt line after cleanup.
Currently the most visible element is the HISTORY title line.
It might be beneficial to make the selected line (if any) to be the most visible instead, perhaps by inverse colors.
hi, please apply this patch so it builds w/o errors & warnings w/ gcc 4.8.2
http://tmp.watzke.cz/hh-9999-missing-include.patch
(add #include <stdio.h> to hstr_history.c and add #define _GNU_SOURCE to hstr.c)
thanks.
btw here's an ebuild if you want it:
http://tmp.watzke.cz/hh-9999.ebuild
Install Quental env & release.
Common order of arguments argc <> argv
This happens when I need to switch between multiple terminal windows, some of which contain SSH sessions to remote machines:
These two are slightly different, for instance in handling:
ENTER
(hh puts it to commandline without the enter itself so the command does not execute)Esc
(not handled by hh; bash implements it the way hh handles enter)Ctrl+R
(not handled by hh; bash offers next older occurence)Even though the ordering of entries is different in hh, I think it would be beneficial to support the "keyboard" compatibility, as it might further simplify the adoption by users with existing strong bash/keyboard habits. You know, certain keyboard sequences are simply "burned" into fingers ;)
BASH history is written on user log out - make sure that it is flushed before hh is run.
top, ...
I'm trying to get hh-0.71 running on OS X. Two functions appear to be missing in Apple's libreadline implementation, leading to the following error on ./configure&&make
:
gcc --pedantic -Wall -std=c99 -O2 -g -O2 -o hh hashset.o radixsort.o hstr_history.o hstr_utils.o hstr.o -lreadline -lm -lncurses
Undefined symbols for architecture x86_64:
"_free_history_entry", referenced from:
_history_mgmt_remove in hstr_history.o
"_history_list", referenced from:
_get_prioritized_history in hstr_history.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [hh] Error 1
make: *** [all-recursive] Error 1
It works fine by adding -L/opt/local/lib
to the gcc line quoted above, in which (in my case) MacPorts installed its version of libreadline.
However, the resulting ./hh
binary segfaults on execution. gdb
provides the following information:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000803200
0x0000000100001777 in get_prioritized_history () at hstr_history.c:88
88 line=historyList[i]->line;
(gdb) backtrace
#0 0x0000000100001777 in get_prioritized_history () at hstr_history.c:88
#1 0x0000000100002ce3 in hstr [inlined] () at /Users/wolfcw/tmp/build/hh/hh-0.71/src/hstr.c:432
Not sure if both are related. Any ideas? :-)
man history
C library > history management
Bind fc
(fix command) to Ctrl-LEFT so that it opens the selected command in the editor.
Make highlighted line as wide as the page is.
Man: Configuration options. hh is by default monochromatic - use hicolor to get more colors.
Allow switching between "raw" history (same as history command) and metrics ordered history.
!! Execute last command in history
!abc Execute last command in history beginning with abc
!abc:p Print last command in history beginning with abc
!n Execute nth command in history
!$ Last argument of last command
!^ First argument of last command
^abc^xyz Replace first occurance of abc with xyz in last command and execute it
man bash
HISTCONTROL=ignorespace (don't use erasedups and ignoredups as they are used by metric)
HISTFILE ... to load history from the correct file (if empty, use default)
HISTFILESIZE=10000 ... suggested size
HISTSIZE=$HISTFILESIZE
Clean garbage from the first column of the selection.
Remove prefix.
A hashet defect causes history entries to be duplicated.
\n is added as padding, but sometimes there is a blank line which should not be there (\n is supposed just to avoid having BASH prompt after the command send by HH back to shell.
RadixSort and HashSet indexation 32b vs. 64b int code review. Minimal VirtualBox image, test and fix.
Release hstr for all recent ubuntu versions.
Ctrl+C can be more intuitive for users as a mean to exit; adding the current Ctrl+X functionality in the break handler can be more convenient.
hh -l, hh --list ... list history using hh metrics
hh -l [pattern] ... filtered using pattern
hh -lt [pattern], hh --case-sensitive --list [pattern] ... case sensitive listing
http://mentors.debian.net/intro-maintainers
upload to mentors (check packaging prior the upload)
https://wiki.ubuntu.com/UbuntuDevelopment/NewPackages
http://www.debian.org/doc/manuals/developers-reference/pkgs.html#newpackage
http://www.debian.org/Bugs/Reporting
https://wiki.ubuntu.com/Debian/Bugs#Using_reportbug_to_report_bugs_in_Debian
http://packaging.ubuntu.com/html/packaging-new-software.html#submitting-for-inclusion
Key loop to be rewritten in order to handle all allowed key sequences, skip echo for unknown shortcuts, terminal events (resize), etc.
http://cboard.cprogramming.com/c-programming/63166-kbhit-linux.html
Inverse processing: 'default' kills the key & allowed keys have 'case' handling (from switch to different control structure).
Also support/handle common cmd line shortcuts ctrl-a/e/k/u.
e.g.
imagine this commands in history:
mvn .... -P devCompile
mvn .... -P devRelease
and I would like to search for 'devC' or 'devc' and for 'devR' or 'devr'.
fyi: 'devc'/'devr' finds nothing now.
You have at least two options how to fix it:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.