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

Why I'm not switching to command mode?

Expand Messages
  • Alex Kostikov
    I want Ctrl+C to copy selected text to clipboard and switch to command mode. The line bellow populates clipboard but doesn t do the switching to command mode.
    Message 1 of 6 , Nov 29, 2011
    View Source
    • 0 Attachment
      I want Ctrl+C to copy selected text to clipboard and switch to command
      mode.
      The line bellow populates clipboard but doesn't do the switching to
      command mode. Why?

      vnoremap <C-c> "+y<ESC>

      -- Alexander

      --
      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
    • Alexander Kostikov
      After some retries I figure out command that does the thing I want: snoremap gv *ygv Few lessons learned: 1) if vnoremap is used I m not able
      Message 2 of 6 , Nov 29, 2011
      View Source
      • 0 Attachment
        After some retries I figure out command that does the thing I want:

        snoremap <C-C> <ESC>gv"*ygv<ESC>

        Few lessons learned:
        1) if vnoremap is used I'm not able to return to command mode for some reason
        2) first esc goes to command mode
        3) gv restores selection and goes to the visual mode
        4) "*y copies selection to windows clipboard
        5) second gv<ESC> is used to go to command mode with preserving cursor position.

        The question is - could this command be written easier?

        -- Alexander


        On Tue, Nov 29, 2011 at 1:02 PM, Alex Kostikov <alex.kostikov@...> wrote:
        > I want Ctrl+C to copy selected text to clipboard and switch to command
        > mode.
        > The line bellow populates clipboard but doesn't do the switching to
        > command mode. Why?
        >
        > vnoremap <C-c> "+y<ESC>
        >
        > -- Alexander
        >
        >



        --
        Alexander Kostikov

        --
        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
      • Jean-Rene David
        ... There is no command mode in vim. One may think you are referring to command-line mode, but you seem to be referring to normal mode. That s the mode
        Message 3 of 6 , Nov 30, 2011
        View Source
        • 0 Attachment
          * Alexander Kostikov [2011.11.29 21:40]:
          > After some retries I figure out command that does the thing I want:
          >
          > snoremap <C-C> <ESC>gv"*ygv<ESC>
          >
          > Few lessons learned:
          > 1) if vnoremap is used I'm not able to return to command mode for some reason

          There is no "command" mode in vim. One may think
          you are referring to "command-line" mode, but you
          seem to be referring to "normal" mode. That's the
          mode where h,j,k,l move the cursor around in the
          text.

          If you don't return to normal mode after your
          original command, what mode *are* you in?

          > The question is - could this command be written
          > easier?

          Sure.

          :vnoremap <c-c> "*y`>

          --
          JR

          --
          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
        • Ben Fritz
          ... command mode is another (rarely used) name for normal mode. I made the same mistake a while back on this same list. ... -- You received this message from
          Message 4 of 6 , Nov 30, 2011
          View Source
          • 0 Attachment
            On Nov 30, 7:45 pm, Jean-Rene David <jrda...@...> wrote:
            > * Alexander Kostikov [2011.11.29 21:40]:
            >
            > > After some retries I figure out command that does the thing I want:
            >
            > > snoremap <C-C> <ESC>gv"*ygv<ESC>
            >
            > > Few lessons learned:
            > > 1) if vnoremap is used I'm not able to return to command mode for some reason
            >
            > There is no "command" mode in vim. One may think
            > you are referring to "command-line" mode, but you
            > seem to be referring to "normal" mode. That's the
            > mode where h,j,k,l move the cursor around in the
            > text.
            >

            command mode is another (rarely used) name for normal mode. I made the
            same mistake a while back on this same list.

            :help command-mode

            --
            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
          • Ben Fritz
            ... This works for me, except that it beeps at me. The reason it beeps at me, is that the y operator in visual mode already returns to command/ normal mode
            Message 5 of 6 , Nov 30, 2011
            View Source
            • 0 Attachment
              On Nov 29, 3:02 pm, Alex Kostikov <alex.kosti...@...> wrote:
              > I want Ctrl+C to copy selected text to clipboard and switch to command
              > mode.
              > The line bellow populates clipboard but doesn't do the switching to
              > command mode. Why?
              >
              > vnoremap <C-c> "+y<ESC>
              >

              This works for me, except that it beeps at me. The reason it beeps at
              me, is that the 'y' operator in visual mode already returns to command/
              normal mode automatically, making the final <Esc> redundant.

              If you're expecting to still be in visual mode after a "+y, then
              perhaps you're running with 'insertmode' set? Or in "easy" mode? If
              'insertmode' is set, Vim is usually in insert mode instead of command/
              normal mode, and rather than using <Esc> to go to command/normal mode,
              you use <C-L>.

              --
              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
            • Jean-Rene David
              ... I stand corrected. -- JR -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For
              Message 6 of 6 , Dec 1, 2011
              View Source
              • 0 Attachment
                * Ben Fritz [2011.11.30 23:40]:
                > On Nov 30, 7:45 pm, Jean-Rene David <jrda...@...> wrote:
                > > There is no "command" mode in vim.
                >
                > command mode is another (rarely used) name for normal mode. I made the
                > same mistake a while back on this same list.
                >
                > :help command-mode

                I stand corrected.

                --
                JR

                --
                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
              Your message has been successfully submitted and would be delivered to recipients shortly.