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

Running Vim inside Emacs

Expand Messages
  • Sergio Ruiz
    A member of this group wants to run Vim on a Window, and SBCL on another Window. He already tried ConqueTerm, Gnu Screen and Konsole, but all these solutions
    Message 1 of 3 , Nov 25, 2012
    View Source
    • 0 Attachment
      A member of this group wants to run Vim on a Window, and SBCL on another Window. He already tried ConqueTerm, Gnu Screen and Konsole, but all these solutions have serious drawbacks. I was in the same situation a few months ago. I needed to run SBCL on a window, while editing source code on another window. At some point, I remembered the joke about Emacs being an excellent operating system, but lacking a good editor. Therefore, I decided to provide a good text editor to that excellent operating system.

      The scheme is quite simple. Use Slime to call SBCL as inferior lisp. To make things easier, ask Emacs to open a nonexistent Lisp file:

      ~$ emacs garbage.lisp &

      Emacs will open a blank file, with Slime and all the rest of Lisp magics. Choose the option 'Lisp/Run inferior Lisp'. This action will launch SBCL. Split the SBCL window with C-x 2. On the split window, type the command

      M-x term

      Emacs will open a terminal on one of the two split windows. You can start Vim up on this terminal. When Emacs asks which program you want to run, write Vim.

      /usr/local/bin/vim

      Be carefull. You must open a term buffer. The trick does not work on shell buffers. Of course, you can use all Emacs goodies: Org mode for managing projects, flymake for checking the syntax, dired and ido for fast access file, etc. I have been running Vim from inside Emacs for three months. I wonder whether this approach has drawbacks. It must have, because nobody uses it, as far as I know. Can anybody tell me why it is not widely used?

      --
      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
    • Rosangela Medeiros da Silva
      ... A few comments. When you run Vim inside Emacs, the start-up is almost instantaneous, like in a terminal. Emacs poses no overhead. If you want to go from
      Message 2 of 3 , Nov 25, 2012
      View Source
      • 0 Attachment
        > The scheme is quite simple. Use Slime to call SBCL as inferior lisp. To make things easier, ask Emacs to open a nonexistent Lisp file:
        >
        > ~$ emacs garbage.lisp &
        >
        > Emacs will open a blank file, with Slime and all the rest of Lisp magics. Choose the option 'Lisp/Run inferior Lisp'. This action will launch SBCL. Split the SBCL window with C-x 2. On the split window, type the command
        >
        > M-x term
        >
        > Emacs will open a terminal on one of the two split windows. You can start Vim up on this terminal. When Emacs asks which program you want to run, write Vim.
        >
        > /usr/local/bin/vim
        >

        A few comments. When you run Vim inside Emacs, the start-up is almost instantaneous, like in a terminal. Emacs poses no overhead.

        If you want to go from the Vim window to the other window, you must type C-c o, instead of C-x o. In order to return to the Vim window, you need to type C-x o, which is the Emacs command that goes to the other window. You can find this information about the term-mode in the GNU-Emacs Manual. There I learned that each character is sent directly to Vim, except for the Term escape character, normally C-c.

        The GNU-Emacs Manual also says that one can send a literal C-c to the Vim by typing C-c C-c. Therefore, I can enter Vim normal mode by pressing either Esc or C-c C-c

        The manual also says that C-c char is equivalent to C-x char in normal Emacs. For example, C-c o invokes the global binding of C-x o, which is normally ‘other-window’. Thus if you want to go from the Vim window to the other window without using the mouse, you may type C-c o.

        To make a long story short, while you are on the Vim window, all chars are bound to Vim rules, except C-c. Therefore, if you are on the Vim window, and want to send C-x char to Emacs, you must type C-c x.

        By the way, I did not know that it is possible to run Vim inside Emacs. Thank you for this piece of information. As for your question, I don't know why people are not using Emacs machinery as a platform to run Vim.

        --
        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
      • James Freer
        ... Thank you for this info. I m only a beginner on vim and emacs - trying to decide between the two! You say emacs is an excellent operating system. I find
        Message 3 of 3 , Nov 26, 2012
        View Source
        • 0 Attachment
          On Sun, Nov 25, 2012 at 11:33 PM, Sergio Ruiz <sergiusruiz@...> wrote:
          > A member of this group wants to run Vim on a Window, and SBCL on another Window. He already tried ConqueTerm, Gnu Screen and Konsole, but all these solutions have serious drawbacks. I was in the same situation a few months ago. I needed to run SBCL on a window, while editing source code on another window. At some point, I remembered the joke about Emacs being an excellent operating system, but lacking a good editor. Therefore, I decided to provide a good text editor to that excellent operating system.
          ...
          > Be carefull. You must open a term buffer. The trick does not work on shell buffers. Of course, you can use all Emacs goodies: Org mode for managing projects, flymake for checking the syntax, dired and ido for fast access file, etc. I have been running Vim from inside Emacs for three months. I wonder whether this approach has drawbacks. It must have, because nobody uses it, as far as I know. Can anybody tell me why it is not widely used?

          Thank you for this info. I'm only a beginner on vim and emacs - trying
          to decide between the two!

          You say emacs is an excellent operating system. I find emacs hard to
          grasp as there is just so much of it. To me it goes beyond the
          philosophy (some call Unix's) - Do one thing and do it well! Emacs has
          such poor things like it's games and other stuff which aren't as good
          as alternatives. As an editor it doesn't read in some txt files...
          that's just to mention one thing.To me it seems like a system that
          promises much and delivers little.

          Why does one want to use emacs to run vim inside? You ask "Can anybody
          tell me why it is not widely used?" - i can't see any reason to use
          emacs other than an editor. As you mention it , Org i think is a poor
          application. Reading pdf files... one might as well stay with Evince.

          I use a text editor for writing; vim and emacs are the only two that
          provide 'softwrap'. I don't find vim hard to learn but i find emacs
          sort of 'hard going' for no reason. Emacs 'isn't it's own best friend'
          as the saying goes - the manual is comprehensive but an exceptionally
          hard slog. On the emacs mail list there was a post a while back about
          how emacs could be further improved - remove the unnecessary hard
          learning curve and a provide a user friendly manual.

          To me as a learner... the answer to your question is in the above paragraph.

          james

          --
          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.