zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: *don't* fail when bck-i-search is over
Date: Tue, 23 Nov 2010 00:12:25 -0800	[thread overview]
Message-ID: <101123001225.ZM14178@torch.brasslantern.com> (raw)
In-Reply-To: <20101122163447.GA2658@WALL-E>

On Nov 22, 11:34am, darwin wrote:
}
} i've this in .zshrc
} 
} zle-line-init(){
} 	zle history-incremental-search-backward }
} 	#zle -K vicmd;}
} zle -N zle-line-init
} bindkey -M isearch "^I" vi-repeat-search
} # bindkey -M isearch "^I" history-incremental-search-forward
} 
} 1. it _almost_ does what i want it to do which is to start off on
} bck-i-search.

If I understand correctly what you're going for here, then I'd suggest
that you try the predictive typing widgets (Functions/Zle/predict-on);
except that you seem to be a vi-mode user, and I'm not confident that
insert-and-predict will work well in that context.

} well, it's all great util user wants to issue a never-issued-before
} command. one way to do this is to get out of bck-i-search and do it
} there (viins, vicmd, what have you). but a more elegent solution,
} i think, is to have shell start digging the $PATH for possible
} completions once it's done with the .histfile.

Once you are in isearch mode, there isn't any way out except to accept
the line or hit an undefined key; a failed search won't do it.  If you
want TAB to go straight out of isearch mode and into completion, then
you must not bind TAB to something else in the isearch map; you can't
have it both ways.

The effect you want is similar to what the insert-and-predict function
does, but it handles it by staying away from isearch mode, instead
calling history-beginning-search-backward as each character is typed;
so if the search doesn't find anything the wrapper widget is still in
control and can try something else.

} 2. the commented lines are what i had before. with all my _elegant_
} solutions there are still situations when i would still want to edit
} a command and that's when i would prefer to go back to vicmd (it's
} a matter of muscle mm really). but with my current setting:
} 	bindkey -M isearch '^[' send-break
} hitting esc gets me out of bck-i-search and dumps me into emacs!

That can only mean you don't have "bindkey -v" in effect globally.
*With* bindkey -v, send-break should take you from isearch to viins,
as you note here:

} i even tried with bindkey -v but that's
} half-baked because i esc bck-i-search into viins and not vicmd.

If you want to end up in vicmd mode when you hit ESC, you shouldn't
need to bind it at all.  An unbound key takes you out of isearch and
then performs the normal function of that key.  So *if* you have
"bindkey -v" and you don't bind ESC in the isearch map, ESC will
take you out of isearch, to viins, and then have it's normal effect
in viins, which is to take you to vicmd where you wanted.


  reply	other threads:[~2010-11-23  8:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 16:34 darwin
2010-11-23  8:12 ` Bart Schaefer [this message]
     [not found]   ` <20101123214048.GA8029@WALL-E>
2010-11-23 21:46     ` darwin
2010-11-24  8:24     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=101123001225.ZM14178@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).