Loading ...
Sorry, an error occurred while loading the content.

Re: Caps Lock

Expand Messages
  • Hari Krishna Dara
    ... put ... Yep, that is what came into my mind too. You should really use a soft version of capslock, implemented in Vim. Something like to start with:
    Message 1 of 7 , Nov 1, 2005
    • 0 Attachment
      On Tue, 1 Nov 2005 at 12:49pm, Moshe Kaminsky wrote:

      > Hi,
      >
      > * Robert Cussons <r.cussons@...> [01/11/05 12:29]:
      > >
      > > Hi all,
      > >
      > > don't know how difficult or possible this is to do, but here goes!
      > >
      > > I sometimes want to write a large amount of test in capitals so I turn on
      > > Caps Lock, but then I want to use commands and forget that Caps Lock is on
      > > and obviously get unexpected results. Is there a way to get Vim to ignore
      > > Caps Lock when in command mode, but still allow me to press <shift> + o for
      > > example to get O in command mode, with Caps Lock on. Example to clarify the
      > > above:
      > > I am typing away with Caps Lock on, then I enter command mode and want to
      put
      > > in a blank line above the one I am on, so I want the command for this to
      > > still be <shift> + o, even though I have Caps Lock turned on.
      > > Hope at least someone can understand what I mean!
      >
      > Maybe instead of pressing Caps, you should :imap any non capital letter
      > to a capital one. Then, when you are done, unmap it. All this should be
      > done by a suitable command, of course.
      >

      Yep, that is what came into my mind too. You should really use a "soft"
      version of capslock, implemented in Vim. Something like to start with:

      function! ToggleCaps()
      if !exists('g:capslock')
      let g:capslock = 0
      endif
      let lc=char2nr('a')
      let diff=lc - char2nr('A')
      let c = lc
      while c < (lc+26)
      if !g:capslock
      exec 'inoremap' nr2char(c) nr2char(c-diff)
      else
      exec 'iunmap' nr2char(c)
      endif
      let c = c + 1
      endwhile
      let g:capslock = !g:capslock
      endfunction
      nnoremap <silent> \cl :call ToggleCaps()<CR>:echo "Caps lock is
      ".(g:capslock?"ON":"OFF")<CR>

      Extending this to all keys would require more sohisticated mapping.

      --
      HTH,
      Hari




      __________________________________
      Yahoo! Mail - PC Magazine Editors' Choice 2005
      http://mail.yahoo.com
    Your message has been successfully submitted and would be delivered to recipients shortly.