LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-13-2010, 11:55 PM   #1
hhamid
LQ Newbie
 
Registered: Sep 2005
Location: California
Distribution: Ubuntu
Posts: 17

Rep: Reputation: 0
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
 
Old 08-14-2010, 12:15 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,973
Blog Entries: 11

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
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
 
1 members found this post helpful.
Old 08-14-2010, 02:56 AM   #3
babunix
Member
 
Registered: Jul 2010
Location: India
Distribution: RHEL, Ubuntu
Posts: 35

Rep: Reputation: Disabled
Hi hhamid,

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

regard,
 
0 members found this post helpful.
Old 08-14-2010, 05:02 AM   #4
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Vi is vim on Ubuntu.
 
0 members found this post helpful.
Old 08-14-2010, 05:35 AM   #5
Fred Caro
Member
 
Registered: May 2007
Posts: 667

Rep: Reputation: 60
vi vim

you could try a different editor and see if the same thing happens.
 
0 members found this post helpful.
Old 08-14-2010, 05:41 AM   #6
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 111Reputation: 111
there is no package called vi in ubuntu.

vim-tiny is a compact version installed by default.
 
0 members found this post helpful.
Old 08-14-2010, 05:46 AM   #7
babunix
Member
 
Registered: Jul 2010
Location: India
Distribution: RHEL, Ubuntu
Posts: 35

Rep: Reputation: Disabled
my apologize..

thanks jay73 and sem007
 
0 members found this post helpful.
Old 08-14-2010, 01:16 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,973
Blog Entries: 11

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
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
 
1 members found this post helpful.
Old 08-14-2010, 01:22 PM   #9
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
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.

Last edited by jay73; 08-14-2010 at 01:23 PM.
 
0 members found this post helpful.
Old 08-15-2010, 07:31 AM   #10
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
Quote:
Originally Posted by babunix View Post
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.
 
1 members found this post helpful.
Old 08-16-2010, 02:56 AM   #11
hhamid
LQ Newbie
 
Registered: Sep 2005
Location: California
Distribution: Ubuntu
Posts: 17

Original Poster
Rep: Reputation: 0
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 View Post
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

Last edited by hhamid; 08-16-2010 at 03:02 AM.
 
Old 08-16-2010, 03:16 AM   #12
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,973
Blog Entries: 11

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
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.
 
1 members found this post helpful.
Old 08-16-2010, 03:27 AM   #13
hhamid
LQ Newbie
 
Registered: Sep 2005
Location: California
Distribution: Ubuntu
Posts: 17

Original Poster
Rep: Reputation: 0
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
 
Old 08-16-2010, 03:31 AM   #14
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,973
Blog Entries: 11

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
Quote:
Originally Posted by hhamid View Post
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
 
Old 08-16-2010, 03:36 AM   #15
hhamid
LQ Newbie
 
Registered: Sep 2005
Location: California
Distribution: Ubuntu
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
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
 
  


Reply

Tags
bash, bind, mode, set, vi


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My BASH script work perfect when i run it manualy, but not when it run in the crontab roqarg Linux - Newbie 30 05-06-2010 01:37 PM
eth0 not working in SMP kernel mode (but works in UP mode!) jorgeluis Linux - Networking 2 11-27-2007 08:46 AM
eth0 not working in SMP kernel mode (but works in UP mode!) jorgeluis Red Hat 1 11-26-2007 12:33 PM
What Is The Perfect Hardware For The Perfect Linux Box? petergh Linux - Hardware 7 12-15-2006 08:53 AM


All times are GMT -5. The time now is 05:04 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration