GithubHelp home page GithubHelp logo

dvorka / hstr Goto Github PK

View Code? Open in Web Editor NEW
3.9K 3.9K 233.0 2.17 MB

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

Shell 13.54% Makefile 0.48% C 79.51% M4 1.12% HTML 0.26% QMake 0.82% Ruby 4.27%
bash c cli command-history history linux ubuntu zsh

hstr's People

Contributors

a-312 avatar b- avatar beslayed avatar bibermann avatar busindre avatar celeritascelery avatar dvorka avatar fastgar avatar fszymanski avatar gitressa avatar haosdent avatar ihsinme avatar imp- avatar jmiserez avatar juppytt avatar livibetter avatar maryasov avatar milisarge avatar monochromec avatar nicknish avatar nkoester avatar pewpewnotes avatar rogerdehe avatar ryanfb avatar sawan avatar snehm avatar sublimino avatar tbabej avatar thibaultcha avatar xaizek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hstr's Issues

Key mgmt & terminal resize

Instead of filtering keys rewrite key loop to accepting only allowed keys.
To be tested on terminal resize, arrows, ...

High color version

  • R/G/B/Y/... version
  • configured by environment property HH_CONFIG=colors;...
  • inspiration: colors, configuration and man by tig

Blacklist doesn't filter out entities

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?

Safe color support

Colors (no color terminal support i.e. on/off colors) i.e. disable white highlight if terminal doesn't support colors.

BASH history mgmt

Introduce keys like 'd' to delete a command with type from BASH history.

Use command line parameter(s) as search string

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. :-)

More visible selection

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.

Improve keyboard-control compatibility with default Bash history handler

This happens when I need to switch between multiple terminal windows, some of which contain SSH sessions to remote machines:

  • on remote machines (where hh is typically not installed) I get the default bash behavior
  • on my machine I get the hh behavior

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)
  • ... maybe more

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 ;)

Flush history

BASH history is written on user log out - make sure that it is flushed before hh is run.

Mac OS X 10.8.x: Segfault in get_prioritized_history () at hstr_history.c:88

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? :-)

hicolor: wide & man

Make highlighted line as wide as the page is.

Man: Configuration options. hh is by default monochromatic - use hicolor to get more colors.

Support BASH substitutions @ cmd line

!! 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

Undesired \n on a cmd execution

\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.

32b & radix size

RadixSort and HashSet indexation 32b vs. 64b int code review. Minimal VirtualBox image, test and fix.

saucy deb

Release hstr for all recent ubuntu versions.

Enable hh scripting: cmd & args & pipes

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

case sensitivity issue

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:

  • make the search case insensitive
  • allow to put uppercased letters in the search box (shit+ and caps lock)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.