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

Clearing screen when using Vi keybindings on Bash command-line

Expand Messages
  • Srikanth Cherla
    Hi, I recently switched to using Vi keybindings in bash shell as described here http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal. It s great, except that
    Message 1 of 7 , Mar 14, 2014
      Hi,

      I recently switched to using Vi keybindings in bash shell as described here http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal. It's great, except that ^L (Ctrl + l) does not clear screen any more. I tried the two options mentioned in the link but neither of them works. I also tried adding the line

      alias ^L='clear'

      in my .bashrc but that didn't work. Can someone suggest what else I can do?

      Thanks!

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • brandon wallace
      ... This is easy. One key. alias c= clear ... -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you
      Message 2 of 7 , Mar 14, 2014
        > ----- Original Message -----
        > From: Srikanth Cherla
        > Sent: 03/14/14 01:02 PM
        > To: vim_use@...
        > Subject: Clearing screen when using Vi keybindings on Bash command-line
        >
        > Hi,
        >
        > I recently switched to using Vi keybindings in bash shell as described here http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal. It's great, except that ^L (Ctrl + l) does not clear screen any more. I tried the two options mentioned in the link but neither of them works. I also tried adding the line
        >
        > alias ^L='clear'
        >
        > in my .bashrc but that didn't work. Can someone suggest what else I can do?
        >
        > Thanks!


        This is easy. One key.

        alias c='clear'


        >
        > --
        > --
        > You received this message from the "vim_use" maillist.
        > Do not top-post! Type your reply below the text you are replying to.
        > For more information, visit http://www.vim.org/maillist.php
        >
        > ---
        > You received this message because you are subscribed to the Google Groups "vim_use" group.
        > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        > For more options, visit https://groups.google.com/d/optout.

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Tim Chase
        ... Control+L works in Emacs editing mode (which I tend to prefer for general command-line operations), but seems to have strange behavior in vi mode. In some
        Message 3 of 7 , Mar 14, 2014
          On 2014-03-14 10:02, Srikanth Cherla wrote:
          > http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal. It's great,
          > except that ^L (Ctrl + l) does not clear screen any more. I tried
          > the two options mentioned in the link but neither of them works. I
          > also tried adding the line

          Control+L works in Emacs editing mode (which I tend to prefer for
          general command-line operations), but seems to have strange behavior
          in vi mode. In some contexts, it seems to correctly clear the
          screen; but in other contexts (which I haven't completely sussed
          out), it seems to ignore the control+L. You could try explicitly
          adding

          "\C-l": clear-screen

          in your ~/.inputrc

          > alias ^L='clear'
          >
          > in my .bashrc but that didn't work. Can someone suggest what else I
          > can do?

          The alias doesn't work for reasons I'd expect for multiple reasons.

          -tim







          --
          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Marcin Szamotulski
          ... Just press and then CTRL-L, at least it works for me in bash in an xterm. It does not work in in the insert mode. Cheers, Marcin -- -- You received
          Message 4 of 7 , Mar 14, 2014
            On 18:19 Fri 14 Mar , Tim Chase wrote:
            > On 2014-03-14 10:02, Srikanth Cherla wrote:
            > > http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal. It's great,
            > > except that ^L (Ctrl + l) does not clear screen any more. I tried
            > > the two options mentioned in the link but neither of them works. I
            > > also tried adding the line
            >
            > Control+L works in Emacs editing mode (which I tend to prefer for
            > general command-line operations), but seems to have strange behavior
            > in vi mode. In some contexts, it seems to correctly clear the
            > screen; but in other contexts (which I haven't completely sussed
            > out), it seems to ignore the control+L. You could try explicitly
            > adding
            >
            > "\C-l": clear-screen
            >
            > in your ~/.inputrc
            >
            > > alias ^L='clear'
            > >
            > > in my .bashrc but that didn't work. Can someone suggest what else I
            > > can do?
            >
            > The alias doesn't work for reasons I'd expect for multiple reasons.
            >
            > -tim

            Just press <Esc> and then CTRL-L, at least it works for me in bash in an
            xterm. It does not work in in the insert mode.

            Cheers,
            Marcin

            --
            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Tim Chase
            ... Yeah, I just couldn t figure out how to get .inputrc to perform a clear-screen on control+L in vi-insert mode in addition to vi-command mode. And there
            Message 5 of 7 , Mar 14, 2014
              On 2014-03-15 00:36, Marcin Szamotulski wrote:
              > On 18:19 Fri 14 Mar, Tim Chase wrote:
              >> On 2014-03-14 10:02, Srikanth Cherla wrote:
              >> > http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal. It's
              >> > great, except that ^L (Ctrl + l) does not clear screen any
              >> > more. I tried the two options mentioned in the link but neither
              >> > of them works. I also tried adding the line
              >>
              >> Control+L works in Emacs editing mode (which I tend to prefer for
              >> general command-line operations), but seems to have strange
              >> behavior in vi mode. In some contexts, it seems to correctly
              >> clear the screen; but in other contexts (which I haven't
              >> completely sussed out), it seems to ignore the control+L. You
              >> could try explicitly adding
              >>
              >> "\C-l": clear-screen
              >>
              >> in your ~/.inputrc
              >
              > Just press <Esc> and then CTRL-L, at least it works for me in bash
              > in an xterm. It does not work in in the insert mode.

              Yeah, I just couldn't figure out how to get .inputrc to perform a
              "clear-screen" on control+L in vi-insert mode in addition to
              vi-command mode. And there were some edge cases where control+L
              *did* work without hitting <esc> first (perhaps before entering a
              command?).

              -tim


              --
              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • John Little
              ... With bash vi mode there are two keymaps, corresponding to vim s normal mode and insert modes, called vi-command and vi-insert. ctrl-L works by default in
              Message 6 of 7 , Mar 14, 2014
                On Saturday, March 15, 2014 6:02:11 AM UTC+13, Srikanth Cherla wrote:
                >
                > I recently switched to using Vi keybindings in bash shell ... ^L (Ctrl + l) does not clear screen any more.

                With bash vi mode there are two keymaps, corresponding to vim's normal mode and insert modes, called vi-command and vi-insert. ctrl-L works by default in vi-command mode, so typing <esc><ctrl-l> will do it, but needs another keystroke "a" to get back to insert mode.

                For ctrl-L to work in insert mode, you need a ~/.inputrc file, that specifies the keymap:

                set keymap vi-insert
                "\C-L": clear-screen

                > alias ^L='clear'

                You have to press enter to invoke an alias, and it has to be the first word on the line, not at all like the ctrl-L you're used to.

                Regards, John Little

                --
                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php

                ---
                You received this message because you are subscribed to the Google Groups "vim_use" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • Srikanth Cherla
                ... ^L works after pressing . I don t know how I missed that. I did try it a few times before posting the question and it didn t work then. My sincere
                Message 7 of 7 , Mar 15, 2014
                  El sábado, 15 de marzo de 2014 04:20:13 UTC, John Little escribió:
                  > On Saturday, March 15, 2014 6:02:11 AM UTC+13, Srikanth Cherla wrote:
                  > >
                  > > I recently switched to using Vi keybindings in bash shell ... ^L (Ctrl + l) does not clear screen any more.
                  >
                  > With bash vi mode there are two keymaps, corresponding to vim's normal mode and insert modes, called vi-command and vi-insert. ctrl-L works by default in vi-command mode, so typing <esc><ctrl-l> will do it, but needs another keystroke "a" to get back to insert mode.
                  >
                  > For ctrl-L to work in insert mode, you need a ~/.inputrc file, that specifies the keymap:
                  >
                  > set keymap vi-insert
                  > "\C-L": clear-screen
                  >
                  > > alias ^L='clear'
                  >
                  > You have to press enter to invoke an alias, and it has to be the first word on the line, not at all like the ctrl-L you're used to.
                  >
                  > Regards, John Little

                  ^L works after pressing <Esc>. I don't know how I missed that. I did try it a few times before posting the question and it didn't work then. My sincere apologies for posting the question, and thank you to those who replied.

                  Srikanth

                  --
                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                Your message has been successfully submitted and would be delivered to recipients shortly.