cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.87k stars 177 forks source link

mcfly prints two additional line each time I select a result #112

Closed rkachach closed 2 years ago

rkachach commented 3 years ago

Each time I run mclfy to select a result (from the history) it prints two additional lines, so in the result I get something like:

localhost ~ $ #mcfly: 
localhost ~ $  mcfly search
localhost ~ $ my_command_from_history

The two first additional lines are written I think in the code in the file:

/home/linuxbrew/.linuxbrew/opt/mcfly/mcfly.bash

# If this is an interactive shell, take ownership of ctrl-r.
# The logic here is:
#   1. Jump to the beginning of the edit buffer, add 'mcfly: ', and comment out the current line. We comment out the line
#      to ensure that all possible special characters, including backticks, are ignored. This commented out line will
#      end up as the most recent entry in the $MCFLY_HISTORY file.
#   2. Type "mcfly search" and then run the command. McFly will pull the last line from the $MCFLY_HISTORY file,
#      which should be the commented-out search from step #1. It will then remove that line from the history file and
#      render the search UI pre-filled with it.
if [[ $- =~ .*i.* ]]; then
  if set -o | grep "vi " | grep -q on; then
    bind "'\C-r': '\e0i#mcfly: \e\C-j mcfly search\C-j'"
  else
    bind "'\C-r': '\C-amcfly: \e# mcfly search\C-j'"
  fi
fi

Would it be possible to avoid adding these two lines?

cantino commented 3 years ago

May be fixed by #105.

cantino commented 3 years ago

Was this fixed for you @rkachach?

rkachach commented 2 years ago

Sorry for the (very)late response. I'm using the latest version and cannot see this problem happening anymore

cantino commented 2 years ago

Thanks!