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

Re: Caps Lock

Expand Messages
  • Moshe Kaminsky
    Hi, ... 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
    Message 1 of 7 , Nov 1, 2005
    • 0 Attachment
      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.

      Moshe
      > Thanks,
      > Rob.
      >


      --
      I love deadlines. I like the whooshing sound they make as they fly by.
      -- Douglas Adams

      Moshe Kaminsky <kaminsky@...>
      Home: 08-9456841
    • Tim Chase
      ... [snip] ... Well, there s also visually highlighting the text and pressing U to force the selected text to be highlighted. Additionally, if it s all a
      Message 2 of 7 , Nov 1, 2005
      • 0 Attachment
        > I don't think there is a way to do that. However you could
        > avoid CAPS LOCK all together...
        [snip]
        > mp
        > i
        > TYPE TEXT
        > :'p,'.s/.*/\U&/

        Well, there's also visually highlighting the text and pressing
        "U" to force the selected text to be highlighted.

        Additionally, if it's all a paragraph (delineated by blank lines
        above and below), you can use

        gUip

        to uppercase the entire paragraph. If it's just a sentence
        (":help sentence"), you can use

        gUis

        Or for that matter, any other text object or motion should do
        just fine with the "gU" command.

        :help gU
        :he is
        :he ip
        :he text-objects

        for some pointers on these.

        -tim
      • John Love-Jensen
        Hi Rob, I usually disable Caps Lock altogether, in the OS. (Windows, OS X, Amiga OS.) Or remap Caps Lock to Control. Or use a Happy Hacking Keyboard Lite 2
        Message 3 of 7 , Nov 1, 2005
        • 0 Attachment
          Hi Rob,

          I usually disable Caps Lock altogether, in the OS. (Windows, OS X, Amiga
          OS.)

          Or remap Caps Lock to Control.

          Or use a Happy Hacking Keyboard Lite 2 (USB).

          HTH,
          --Eljay
        • Dominic Evans
          ... Ah `[ and `]. However, the latter one seems to be non-inclusive and miss off the last typed character. The following worked: `[gU . Cheers, Dom
          Message 4 of 7 , Nov 1, 2005
          • 0 Attachment
            On 01/11/05, Keith W. Roberts <keithr@...> wrote:
            > ----Original Message----
            > From: Dominic Evans [mailto:oldmanuk@...]
            > Sent: Tuesday, November 01, 2005 2:43 AM
            > To: r.cussons@...
            > Cc: vim@...
            > Subject: Re: Caps Lock
            >
            > > I don't think there is a way to do that. However you could avoid CAPS
            > > LOCK all together...
            > >
            > > I don't know if there is already a mark for where insert mode was
            > > started (instead of the manual mp here).
            >
            > '[,'] is the range for the most recent insertion (or yank, whichever is
            > later). These maps will let you upcase the prior (or current) insertion:
            >
            > nnoremap <F12> `[gU`]
            > inoremap <F12> <ESC>`[gU`]
            >

            Ah `[ and `].

            However, the latter one seems to be non-inclusive and miss off the
            last typed character. The following worked:

            `[gU'.

            Cheers,
            Dom
          • 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 5 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.