Any shell or hack that makes the shell command line take vi commands?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Any shell or hack that makes the shell command line take vi commands?
# 1  
Old 05-30-2012
Any shell or hack that makes the shell command line take vi commands?

basically i'm tired of hitting the left arrow a few dozen times when correcting a mistake or modifying a history command

i'd like to use vim style key shortcuts while on the command line so that a 55[left arrow key] moves the cursor 55 places to the left...

and i want all the other vi goodies, search of history maybe - a dream?, replace, etc
# 2  
Old 05-30-2012
In ksh/bash use the following at the command line (or in ~/.profile or ~/.bash_profile):
Code:
set -o vi

If your on linux, Mac OS, *BSD you can put the following in ~/.inputrc (or /etc/inputrc for system wide), this will work for most command line programs that use the readline library (eg ftp, bash, etc).
Code:
set editing-mode vi


Last edited by Chubler_XL; 05-30-2012 at 11:25 PM..
# 3  
Old 05-30-2012
This is what I do

Code:
#ksh -o vi


Last edited by Scrutinizer; 05-31-2012 at 12:37 AM.. Reason: code tags
# 4  
Old 05-31-2012
See "Korn shell history editing"on this page:
Recalling and editing previous commands
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with shell commands (not sure which command is appropriate)

Dear All, I have 2 files namely file1 and file2. in file1 I have something like this Min X = -250.000000, Max X = 250.000000 Min Y = -95.000000, Max Y = 95.000000 Min Z = -95.000000, Max Z = 136.500000 I have to write this date to file2 as xMin -250.000000; xMax 250.000000; yMin... (15 Replies)
Discussion started by: linuxUser_
15 Replies

2. UNIX for Dummies Questions & Answers

Ls -1 at Command Line vs in a Shell Script

Hello, I have symbolic links to a bunch of directories (all starting with the letter X) in the cwd. When I run the following on the command line, I get the list as I want it. ls -1 X* > dir.list However when I run it in a shell script like given below, it lists all the files in each of... (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

3. Shell Programming and Scripting

Embeded shell variable in command line

Hello, I know this is a situation about the single quote and double literal, but I could not figure out after many search. I need to loop through thousands of different BACs sequencing to optimize kmer individually. IN=/PATH/TO/INPUT/FILES for sample in S{01..1096} do run_program... (9 Replies)
Discussion started by: yifangt
9 Replies

4. Shell Programming and Scripting

Shell Text Based Game, This Error Makes NO sense. Please help

Okay so I'm making a simple text based game that branches into different scenarios. By branching I mean branching off into whole different files with that part of the game in it. I got tired of working on scenario 1 so I'm working on scenario 2. As I get started and try to test it, I get an... (3 Replies)
Discussion started by: lemonoid
3 Replies

5. UNIX for Dummies Questions & Answers

Command line ok but not shell

I want to substitute a charactor "PAN" with "TAN" in a shell, I used sed command in shell, it wo'nt work but the same is run from command prompt it was successful. the command is sed ' s/PAN/TAN/g ' <i/p> > <o/p> sed ' s/^M/^M/g ' <i/p> > <o/p> (1st ^M is Ctrl+V+M, 2nd should be line feed/next... (2 Replies)
Discussion started by: anil_kut
2 Replies

6. UNIX for Dummies Questions & Answers

Passing command line argument between shell's

Hi, I am facing a problem to pass command line arguments that looks like <script name> aa bb "cc" dd "ee" I want to pass all 5 elements include the " (brackets). when I print the @ARGV the " disappear. I hope I explain myself Regards, Ziv (4 Replies)
Discussion started by: zivsegal
4 Replies

7. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

8. UNIX for Dummies Questions & Answers

what are some different commands in c shell and korn shell??

I am doing this simple script using c shell and korn shell. The commands I use are fgrep , ls, and also some redirecting. Is there any difference in using both of these commands in c shell and korn shell? Thanks and sorry for the stupid question. (1 Reply)
Discussion started by: EquinoX
1 Replies

9. Shell Programming and Scripting

How to run unix commands in a new shell inside a shell script?

Hi , I am having one situation in which I need to run some simple unix commands after doing "chroot" command in a shell script. Which in turn creates a new shell. So scenario is that - I need to have one shell script which is ran as a part of crontab - in this shell script I need to do a... (2 Replies)
Discussion started by: hkapil
2 Replies

10. Shell Programming and Scripting

KORN Shell - Spawn new shell with commands

I want to be able to run a script on one server, that will spawn another shell which runs some commands on another server.. I have seen some code that may help - but I cant get it working as below: spawn /usr/bin/ksh send "telnet x <port_no>\r" expect "Enter command: " send "LOGIN:x:x;... (2 Replies)
Discussion started by: frustrated1
2 Replies
Login or Register to Ask a Question