readline key bindings in command mode

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

readline key bindings in command mode

William Pursell
 From the help section on cmdline-editing:
"For Emacs-style editing on the command-line see |emacs-keys|."

What about vi-style editing?    It seems ironic that the only place I
can't get ready access to the vi-mode of readline is on the command line
in vim.  Am I missing something?  In particular, I want access to the
"f" command for cursor movement.  Ideally, I'd like to be able to use
the following keysequence to echo "foo":
:echo "goo<^C>FgrfA"<CR>
Ideas?


Reply | Threaded
Open this post in threaded view
|

Re: readline key bindings in command mode

bsturk
bill wrote:

>  From the help section on cmdline-editing:
> "For Emacs-style editing on the command-line see |emacs-keys|."
>
> What about vi-style editing?    It seems ironic that the only place I
> can't get ready access to the vi-mode of readline is on the command line
> in vim.  Am I missing something?  In particular, I want access to the
> "f" command for cursor movement.  Ideally, I'd like to be able to use
> the following keysequence to echo "foo":
> :echo "goo<^C>FgrfA"<CR>
> Ideas?
>
>

Probably the one feature I have wanted forever in vim.  It's in my README too
for vimsh as a 'please vote for'.  A very long time ago I asked Bram about this
and he said it would be very difficult unfortunately.  It's quite ironic that
you can use Emacs style in vim and in viper on emacs you can use vi keybindings.

:)

I actually wish all apps used readline where they could.  irssi is another one.

~brian

--
.--------------------------------------------------,--------.
| Brian Sturk - http://users.adelphia.net/~bsturk \  C/C++  | .>   )\,^a__
|-------------------------. bsturk<AT>adelphia.net | Python |(  _ _)/ /-."~
| http://www.telengard.com `------------------------`-------| `( )_ )/
| Telengard Technologies Inc. - NT/*nix UI & device drivers |_<_s_<_s
`-----------------------------------------------------------'
Reply | Threaded
Open this post in threaded view
|

Re: readline key bindings in command mode

Marian Csontos
In reply to this post by William Pursell
Hi Bill,

Use ^F instead of ^C, which opens cmdline window.
Available in search prompt too.
Disadvantage: it could break your window layout.

see:
:he cmdwin
:he q:

Best Regards,

-- Marian

On Mon, 21 Nov 2005 09:10:42 +0100, bill <[hidden email]> wrote:

>  From the help section on cmdline-editing:
> "For Emacs-style editing on the command-line see |emacs-keys|."
>
> What about vi-style editing?    It seems ironic that the only place I  
> can't get ready access to the vi-mode of readline is on the command line  
> in vim.  Am I missing something?  In particular, I want access to the  
> "f" command for cursor movement.  Ideally, I'd like to be able to use  
> the following keysequence to echo "foo":
> :echo "goo<^C>FgrfA"<CR>
> Ideas?
>


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
Reply | Threaded
Open this post in threaded view
|

Re: readline key bindings in command mode

William Pursell
Marian Csontos wrote:

>
> Use ^F instead of ^C, which opens cmdline window.
> Available in search prompt too.
> Disadvantage: it could break your window layout.
>
> see:
> :he cmdwin
> :he q:
>
That is so beautiful.  I swear, vim is absolutely orgasmic...
Thanks for the reference.


Reply | Threaded
Open this post in threaded view
|

Re: readline key bindings in command mode

Antony Scriven
On Nov 21, bill wrote:

 > Marian Csontos wrote:
 >
 > >
 > > Use ^F instead of ^C, which opens cmdline window.
 > > Available in search prompt too.
 > > Disadvantage: it could break your window layout.
 > >
 > > see:
 > > :he cmdwin
 > > :he q:
 >
 > That is so beautiful.  I swear, vim is absolutely
 > orgasmic... Thanks for the reference.

Try :set cedit=<C-C>

Antony
Reply | Threaded
Open this post in threaded view
|

Re: readline key bindings in command mode

Bram Moolenaar
In reply to this post by bsturk

Brian Sturk wrote:

> bill wrote:
> >  From the help section on cmdline-editing:
> > "For Emacs-style editing on the command-line see |emacs-keys|."
> >
> > What about vi-style editing?    It seems ironic that the only place I
> > can't get ready access to the vi-mode of readline is on the command line
> > in vim.  Am I missing something?  In particular, I want access to the
> > "f" command for cursor movement.  Ideally, I'd like to be able to use
> > the following keysequence to echo "foo":
> > :echo "goo<^C>FgrfA"<CR>
> > Ideas?
>
> Probably the one feature I have wanted forever in vim.  It's in my
> README too for vimsh as a 'please vote for'.  A very long time ago I
> asked Bram about this and he said it would be very difficult
> unfortunately.  It's quite ironic that you can use Emacs style in vim
> and in viper on emacs you can use vi keybindings.
>
> :)
>
> I actually wish all apps used readline where they could.  irssi is
> another one.

It's less ironic if you call it CTRL-key style editing instead of Emacs
style editing.  Vi uses letter keys for commands, that requires modal
editing.  Splitting the command-line editing mode into
command-line-command mode and command-line-insert mode causes great
confusion.  Not to mention that we would need some place to put the
"-- Command line INSERT --" message to make clear what mode we're in.

To get around these problems the command-line window was added.  There
you can edit the command line with all your favorite Vi commands and hit
Enter to have it executed.  ":help cmdline-window".

--
"Microsoft is like Coke.  It's a secret formula, all the money is from
distribution, and their goal is to get Coke everywhere.  Open source is like
selling water.  There are water companies like Perrier and Poland Spring, but
you're competing with something that's free."   -- Carl Howe


 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         ///
Reply | Threaded
Open this post in threaded view
|

Re: readline key bindings in command mode

bsturk
>>Probably the one feature I have wanted forever in vim.  It's in my
>>README too for vimsh as a 'please vote for'.  A very long time ago I
>>asked Bram about this and he said it would be very difficult
>>unfortunately.  It's quite ironic that you can use Emacs style in vim
>>and in viper on emacs you can use vi keybindings.
>>
>>:)
>>
>>I actually wish all apps used readline where they could.  irssi is
>>another one.
>
>
> It's less ironic if you call it CTRL-key style editing instead of Emacs
> style editing.  Vi uses letter keys for commands, that requires modal
> editing.  Splitting the command-line editing mode into
> command-line-command mode and command-line-insert mode causes great
> confusion.  Not to mention that we would need some place to put the
> "-- Command line INSERT --" message to make clear what mode we're in.

Good point.  I can totally appreciate how confusing it could be for some people.

I would figure that if someone was used to modality in the editing window itself
that having the same in the command line window wouldn't be too bad though.  I
also never look at the messages, and rely on either the cursor style/color and
memory I guess of which mode I'm in.  When all else fails I tend to press 'esc'
5 or so times.   :)

I was half joking about the irony too.   :)
Nothing holds a candle to vim, it is the one application I surely couldn't be
without.

> To get around these problems the command-line window was added.  There
> you can edit the command line with all your favorite Vi commands and hit
> Enter to have it executed.  ":help cmdline-window".

Yep, I just haven't gotten used to it yet.  I should really make an effort to
try using it more often.

While I have your attention, I'm wondering if there is a way through vim script
or otherwise (I'm doing python scripting) to know that the contents of a file
have changed?  I ask because in my vimsh plug-in it is the one large remaining
feature and this would help immensely.  I know that vim detects a file has
changed and asks whether or not to reload.  What I'm looking for is sort of an
autocommand type thing (callback) if a file/file descriptor has changed or has
new data.  Even just an idle function would be fine as then I could check again.

I've tried CursorHold, kicking off a separate thread, the client/server stuff,
and various other methods none of which seemed to work for me.  I'm probably not
explaining myself well as I just got out of bed.  If I'm not being clear I can
elaborate more later after I've had some coffee.

thanks for an awesome editor!
~brian

--
.--------------------------------------------------,--------.
| Brian Sturk - http://users.adelphia.net/~bsturk \  C/C++  | .>   )\,^a__
|-------------------------. bsturk<AT>adelphia.net | Python |(  _ _)/ /-."~
| http://www.telengard.com `------------------------`-------| `( )_ )/
| Telengard Technologies Inc. - NT/*nix UI & device drivers |_<_s_<_s
`-----------------------------------------------------------'