[HN Gopher] RESH: Rich Enhanced Shell History
       ___________________________________________________________________
        
       RESH: Rich Enhanced Shell History
        
       Author : hxelk1
       Score  : 74 points
       Date   : 2022-05-16 17:20 UTC (5 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | smartmic wrote:
       | The example shows many fields which are stored in the JSON for
       | each command. I wonder how the file size will blow up after some
       | time. Also, how are duplicates handled? Looking at all the
       | details which are kept in context of a command, removing
       | duplicate commands seems not to be an option without loosing the
       | rich context.
        
         | o_____________o wrote:
         | Yeah, based on the issues that might be a fair assumption:
         | 
         | https://github.com/curusarn/resh/issues
         | 
         | more expected issues from relying on a big JSON file:
         | 
         | https://github.com/curusarn/resh/issues/171
        
           | curusarn wrote:
           | Hi, author here. I have almost two years of history on my
           | machine right now. It's 77k history records which takes up
           | 126MB.
           | 
           | The amount of saved context is currently excessive. When I
           | started the project I didn't know exactly what I would need
           | so I included a lot of things that were never used.
           | 
           | I do plan to reduce the history records to about 16 fields
           | which should more than halve the space requirements. I
           | haven't done this yet because I need to safely convert the
           | existing history records people already have to the new
           | reduced version during update which is tricky.
        
             | yjftsjthsd-h wrote:
             | Can you save a version flag and support both until you
             | write the migration logic? That way at least new users
             | benefit
        
       | cmer wrote:
       | Been using something similar, McFly, for a while. It works really
       | well. https://github.com/cantino/mcfly
        
       | phiresky wrote:
       | Alternatives (without judgement):
       | 
       | https://github.com/cantino/mcfly
       | 
       | https://github.com/jcsalterego/historian
       | 
       | https://github.com/larkery/zsh-histdb +
       | https://github.com/m42e/zsh-histdb-fzf
       | 
       | https://github.com/ellie/atuin
       | 
       | All of these except the OP (I think) use SQLite databases.
       | 
       | Personally I use zsh-histdb, which is great but only for ZSH. I'm
       | working on adding a rich SQLite history to nushell so I can
       | finally try nu: https://github.com/nushell/reedline/pull/401 .
        
         | csdvrx wrote:
         | > I'm working on adding a rich SQLite history to nushell
         | 
         | You may then be interested in my solution for bash, where
         | Ctrl-R gives you fzy history for the given directory and Ctrl-T
         | for all directories: https://github.com/csdvrx/bash-
         | timestamping-sqlite
         | 
         | Everything goes into SQLite, which is helpful for stats - like,
         | when do I make the most mistakes?
        
       | ape4 wrote:
       | My favorite shell keystroke saver now is tab-completion. Its
       | wonderful that it works for things besides files. eg `systemctl
       | iso<tab>` gives 'systemctl isolate`
       | 
       | Its great but it could be even better. For example if there is
       | ambiguity the possible choices are shown but not as a menu.
        
         | fcarraldo wrote:
         | I think you want `fzf`?
        
       | tcoff91 wrote:
       | This looks interesting, I'll have to try this and see how I like
       | it compared to fzf's fuzzy history search.
        
       | pepemon wrote:
       | Is there something similar available for fish?
        
         | ghishadow wrote:
         | https://github.com/cantino/mcfly it uses small neural engine
         | and pretty fast
        
         | ilaksh wrote:
         | How does the default fish completion compare to this I wonder?
         | It's pretty great already.
        
         | trulyrandom wrote:
         | I believe fish already does some of these things. For example:
         | if there is no binary available in PATH for one of the commands
         | in your history, that command won't be suggested. Same goes for
         | commands that have file/directory names in them that don't
         | exist.
        
       | foobarian wrote:
       | I use a homerolled thing in .bashrc using plain text files.
       | Regardless of implementation details, this kind of thing saved me
       | vast amount of time over the years. Some requirements that I find
       | the most useful:
       | 
       | - Session ID: assign session IDs so multiple shells don't get
       | mixed up. Make customizable so it's easy to integrate with screen
       | or tmux etc. On reboot, if session IDs are restored, the history
       | can be recovered.
       | 
       | - Instant write: command typed in one shell should be available
       | to search in a different shell right away
       | 
       | - Search order: reverse search should return commands for the
       | current session first, but also make other sessions available
        
       ___________________________________________________________________
       (page generated 2022-05-16 23:00 UTC)