LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-02-2015, 04:01 PM   #1
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Rep: Reputation: 30
Binding ctrl+a and ctrl+e


Hi all --

I've a Solaris 10 machine running bash 3.2.52 which has
Code:
set -o vi
in my .profile and there, ctrl+a and ctrl+e function as one would expect - taking the cursor to the beginning and ending of a line.

I've a RHEL 6.6 machine running bash 4.1.2 which also uses the vi keybindings, but ctrl+a and ctrl+e aren't working. I'm not using screen, which seems to most often be the culprit in other forum posts. I understand that it's weird for them to work with the vi keybindings anyway, so chances are someone fixed the other machine somewhere (or it's a Solaris thing).

I could use set -o emacs instead to get those specific bindings to work, but I'm more interested in how to bind them manually instead of changing the whole keymap?

Thanks!

Last edited by rose_bud4201; 02-02-2015 at 04:02 PM.
 
Old 02-03-2015, 09:28 AM   #2
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Original Poster
Rep: Reputation: 30
Replying to myself - solved.

The answer is, create a new file ~/.inputrc with contents:
Code:
# LHH inputrc
set editing-mode vi
$if mode=vi
"\C-a":beginning-of-line
"\C-e":end-of-line
$endif
# prevent coworkers from wanting to kill me
set bell-style none
And then in .profile or .bashrc (or on the commandline, for one-time use/testing of .inputrc changes), include

Code:
bind -f ~/.inputrc
And voila, Ctrl+A and Ctrl+E work again.

Some useful links I used while figuring this out:
http://superuser.com/questions/81296...e-vi-shortcuts
https://www.gnu.org/software/bash/ma...Init-File.html
https://bbs.archlinux.org/viewtopic....428760#p428760
 
  


Reply

Tags
bash, keybindings


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GNU screen - binding Ctrl-Z to meta shuple Linux - Newbie 5 04-01-2012 03:33 PM
How to disable Ctrl+C, Ctrl+V, Ctrl+X in rdesktop? Aswathy Linux - Newbie 1 01-19-2011 06:22 PM
[SOLVED] vim:ctrl+v command to select some data.But when I push ctrl+v.It doesn't work.. e3399 Linux - Newbie 20 12-07-2010 06:21 AM
Recognizing ctrl+c,ctrl+l,ctrl+d in C programs leonardo6023 Programming 1 08-19-2009 09:23 AM
ctrl + alt + del binding in X windows azrael808 Linux - General 1 08-04-2006 09:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration