swapping caps lock and escape

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

swapping caps lock and escape

Robert Cussons
Hi everyone,

I at the moment have a little file that I got from somewhere, probably
in the vim tips, that swaps caps lock and escape around this is it:

remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock

but this means that each time I have logged out, I have to remember to
run xmodmap ~/.speedswapper (the name of the file) otherwise I start
getting strange effects from running pressing K instead of k for example.
I have tried including this in .bashrc and things to run automatically
on login but couldn't get it to work, then I just thought this morning,
it would be much more sensible to have it written into my .vimrc. Only
trouble being I have no idea how to do this, answers on the back of a
postcard to this address would be greatly appreciated (e-mail will do).
Many thanks,
Rob.
Reply | Threaded
Open this post in threaded view
|

Re: swapping caps lock and escape

iler.ml
On 4/10/06, Robert Cussons <[hidden email]> wrote:

> Hi everyone,
>
> I at the moment have a little file that I got from somewhere, probably
> in the vim tips, that swaps caps lock and escape around this is it:
>
> remove Lock = Caps_Lock
> keysym Escape = Caps_Lock
> keysym Caps_Lock = Escape
> add Lock = Caps_Lock
>
> but this means that each time I have logged out, I have to remember to
> run xmodmap ~/.speedswapper (the name of the file) otherwise I start
> getting strange effects from running pressing K instead of k for example.
> I have tried including this in .bashrc and things to run automatically
> on login but couldn't get it to work, then I just thought this morning,
> it would be much more sensible to have it written into my .vimrc. Only
> trouble being I have no idea how to do this, answers on the back of a
> postcard to this address would be greatly appreciated (e-mail will do).

You can add your xmodmap command to your ~/.xinitrc
This is a file which is executed when X server starts.
If your gui doesn't restart X after logout, you'll want to reconfigure
it to restart X when you log out.

Yakov
Reply | Threaded
Open this post in threaded view
|

Re: swapping caps lock and escape

Eddy Petrișor
In reply to this post by Robert Cussons
On 4/10/06, Robert Cussons <[hidden email]> wrote:
> remove Lock = Caps_Lock
> keysym Escape = Caps_Lock
> keysym Caps_Lock = Escape
> add Lock = Caps_Lock
>
> but this means that each time I have logged out, I have to remember to
> run xmodmap ~/.speedswapper (the name of the file) otherwise I start

add a line like:

! ~/./.speedswapper

in ~/.vimrc ?

--
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein
Reply | Threaded
Open this post in threaded view
|

Re: swapping caps lock and escape

Gerhard Siegesmund
In reply to this post by Robert Cussons
Hello Robert

> but this means that each time I have logged out, I have to remember to
> run xmodmap ~/.speedswapper (the name of the file) otherwise I start
> getting strange effects from running pressing K instead of k for example.

Does just renaming the file to

.Xmodmap

in your home-directory help? Normally this file is load by default from
xmodmap on login.

If there already is a .Xmodmap-File, just add your lines from
speedswapper to that file.

HTH

--
cu
  --== Jerri ==--
Homepage: http://www.jerri.de/   ICQ: 54160208
Public PGP Key: http://www.jerri.de/jerris_public_key.asc

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: swapping caps lock and escape

Robert Cussons
Thanks for the suggestions, at the moment I think, I like Gerhard's the
most. I have created the file, and I'll just have to see tomorrow
morning as I don't want to close everything and lock out and in again
just now.
Thanks again for the help,
Rob.

Gerhard Siegesmund wrote:

> Hello Robert
>
>
>>but this means that each time I have logged out, I have to remember to
>>run xmodmap ~/.speedswapper (the name of the file) otherwise I start
>>getting strange effects from running pressing K instead of k for example.
>
>
> Does just renaming the file to
>
> .Xmodmap
>
> in your home-directory help? Normally this file is load by default from
> xmodmap on login.
>
> If there already is a .Xmodmap-File, just add your lines from
> speedswapper to that file.
>
> HTH
>

--
================================
Robert Cussons
Office SB3 3.163, Theory Group
Gesellschaft für Schwerionenforschung mbH (GSI)
Planckstraße 1
64291 Darmstadt
Germany.

Tel: +49 (0)6159 71 2754
E-mail: [hidden email]
================================
Reply | Threaded
Open this post in threaded view
|

Re: swapping caps lock and escape

mzyzik
On Mon, Apr 10, 2006 at 11:54:50AM +0200, Robert Cussons wrote:
> Thanks for the suggestions, at the moment I think, I like Gerhard's the
> most. I have created the file, and I'll just have to see tomorrow
> morning as I don't want to close everything and lock out and in again
> just now.
> Thanks again for the help,
> Rob.

I do the following:

inoremap <m-i> <tab>
nnoremap <tab> <esc>
vnoremap <tab> <esc>gV
inoremap <tab> <esc>`^

In this way, I use tab to do what escape does. It's great because it
works on every machine. I used to map caps to escape but then when I
went to work, I couldn't do the same on my work machine.

--Matt
Reply | Threaded
Open this post in threaded view
|

Re: swapping tab and escape

Robert Cussons
Hi All,

Matt kindly suggested this mapping for the above

>> inoremap <m-i> <tab>
>> nnoremap <tab> <esc>
>> vnoremap <tab> <esc>gV
>> inoremap <tab> <esc>`^

but how would I add a mapping to make tab work as escape in the command
line, also is there any loss of functionality making this mapping, I
don't use tab in the command line, but does it do anything useful that I
don't know about?

Thanks,
Rob.
Reply | Threaded
Open this post in threaded view
|

Re: swapping tab and escape

Gerald Lai-2
On Thu, 27 Apr 2006, Robert Cussons wrote:

> Hi All,
>
> Matt kindly suggested this mapping for the above
>
>>> inoremap <m-i> <tab>
>>> nnoremap <tab> <esc>
>>> vnoremap <tab> <esc>gV
>>> inoremap <tab> <esc>`^
>
> but how would I add a mapping to make tab work as escape in the command line,
> also is there any loss of functionality making this mapping, I don't use tab
> in the command line, but does it do anything useful that I don't know about?

Tab is used as the completion key in the command line. This is
extremely useful, IMHO. For example, (with cursor as _ underscore) typing

   :help dos-p_

and then hitting <Tab> will produce

   :help msdos-problems_

If you'd like to make <Tab> act as <Esc> in the command line, do

   :cnoremap <Tab> <Esc>

HTH :)
--
Gerald
Reply | Threaded
Open this post in threaded view
|

Re: swapping tab and escape

mzyzik
Yes... I, Matt, who recommended the tab mappings, do no advise mapping
tab this way for command line because of the lack of completion.

However, you can do a <ctrl-d> for a kind of completion.

--Matt

On Thu, Apr 27, 2006 at 01:58:53AM -0700, Gerald Lai wrote:

> On Thu, 27 Apr 2006, Robert Cussons wrote:
>
> >Hi All,
> >
> >Matt kindly suggested this mapping for the above
> >
> >>>inoremap <m-i> <tab>
> >>>nnoremap <tab> <esc>
> >>>vnoremap <tab> <esc>gV
> >>>inoremap <tab> <esc>`^
> >
> >but how would I add a mapping to make tab work as escape in the command
> >line, also is there any loss of functionality making this mapping, I don't
> >use tab in the command line, but does it do anything useful that I don't
> >know about?
>
> Tab is used as the completion key in the command line. This is
> extremely useful, IMHO. For example, (with cursor as _ underscore) typing
>
>   :help dos-p_
>
> and then hitting <Tab> will produce
>
>   :help msdos-problems_
>
> If you'd like to make <Tab> act as <Esc> in the command line, do
>
>   :cnoremap <Tab> <Esc>
>
> HTH :)
> --
> Gerald