LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash vi mode not working perfect (https://www.linuxquestions.org/questions/linux-newbie-8/bash-vi-mode-not-working-perfect-826142/)

hhamid 08-13-2010 11:55 PM

Bash vi mode not working perfect
 
Hey guys,

I am trying to use bash vi mode by issuing "set -o vi" but I am facing two issues; first many of the vi commands are not working and second once I am in the command mode by pressing the Esc key just after I press a single button (e.g., b to go back a word) the mode changes to the normal insert mode. I'm wondering whether there is a way around these two problems. :)

Thanks
-Hamid

Tinkster 08-14-2010 12:15 AM

Your first problem is somewhat nondescript shall I say.
Which vi commands aren't working?



Re the 2nd issue: My bash *doesn't* exit vi command mode
after the first command; it stays in command mode until I
press i,a, ... some editing command. Maybe you're using
odd keybindings?



Cheers,
Tink

babunix 08-14-2010 02:56 AM

Hi hhamid,

Why you not use vim? it is advance version of vi.

regard,

jay73 08-14-2010 05:02 AM

Vi is vim on Ubuntu.

Fred Caro 08-14-2010 05:35 AM

vi vim
 
you could try a different editor and see if the same thing happens.

sem007 08-14-2010 05:41 AM

there is no package called vi in ubuntu.

vim-tiny is a compact version installed by default.

babunix 08-14-2010 05:46 AM

my apologize..

thanks jay73 and sem007

Tinkster 08-14-2010 01:16 PM

Did ANY of you guys actually READ his question? He's trying to use line-editing in
bash in vi-mode, rather than in bash's default, emacs mode.



Cheers,
Tink

jay73 08-14-2010 01:22 PM

Yes, I did. I have actually tried it out on my box and I haven't experienced any problems so it's probably a matter of configuration.

MTK358 08-15-2010 07:31 AM

Quote:

Originally Posted by babunix (Post 4065901)
Hi hhamid,

Why you not use vim? it is advance version of vi.

regard,

He is NOT using vi or vim!

He is using bash's vi input mode which lets you type commands as it it were a vi editor.

hhamid 08-16-2010 02:56 AM

Actually it's kinda weired. Playing more with it, it sounds like sometimes it works well and sometimes I have the mentioned problem. I'm not sure why that is. BTW, once I enter in the vi mode, how can I exit from this binding? I mean is there like an unset command or sth (what is it exactly)? Also what are the different keyboards bindings available besides the vim and emacs? Does anyone have a good reference or link for these stuff?

Thanks
--Hamid

Quote:

Originally Posted by Tinkster (Post 4065832)
Your first problem is somewhat nondescript shall I say.
Which vi commands aren't working?



Re the 2nd issue: My bash *doesn't* exit vi command mode
after the first command; it stays in command mode until I
press i,a, ... some editing command. Maybe you're using
odd keybindings?



Cheers,
Tink


Tinkster 08-16-2010 03:16 AM

The bash man-page basically has it all. There's only emacs (the default)
and vi mode; to get from vi back to emacs, just use 'set -o emacs'.


Cheers,
Tink


P.S.: Please, don't "top post". It's a pointless and ugly habit in
e-Mail, but on a forum even more so.

hhamid 08-16-2010 03:27 AM

Tinkster,

Thanks for the useful info.
BTW as for doing top post, if you're referring to quoting by that I don't see why you think it is pointless and even ugly. Especially in a thread like this where there are multiple posts from different people, it would make it really easy to follow whom and what you're responding to. Ofcourse, you could always refer to people by their names as an alternative but what if there are many posts over multiple pages. And also again in that case whoever is following the thread would need to go back and forth between different posts which would make it kinda hard to follow. So, I really think quoting is actually beneficial....

PS: Not quoting this post as you requested though! :P
Thanks
--Hamid

Tinkster 08-16-2010 03:31 AM

Quote:

Originally Posted by hhamid (Post 4067511)
Tinkster,
So, I really think quoting is actually beneficial....

So do I. Quoting the whole post AFTER/UNDER the response
is what's pointless. And ugly. And wasteful. ;}

Code:

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?





Cheers,
Tink

hhamid 08-16-2010 03:36 AM

Quote:

Originally Posted by Tinkster (Post 4067513)
So do I. Quoting the whole post AFTER/UNDER the response
is what's pointless. And ugly. And wasteful. ;}

Cheers,
Tink

This makes sense and I completely agree with! :-)


--Hamid


All times are GMT -5. The time now is 03:38 PM.