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

Re: Stuck & confused

Expand Messages
  • Benji Fisher
    ... I do not think there is anything mac-specific about this question, so you may get more help on the general vim users list. If your SQL commands are in the
    Message 1 of 3 , Mar 14 6:17 AM
      On Tue, Mar 13, 2007 at 11:56:59AM -0400, Brian McKee wrote:
      > -----BEGIN PGP SIGNED MESSAGE-----
      > Hash: SHA1
      >
      > On 13-Mar-07, at 11:42 AM, M.C wrote:
      > >The problem is I want to be able to launch vim and then use this
      > >window to
      > >launch mysql before submitting queries to the mysql server which
      > >are written
      > >in vim(the server is local on my comp btw). how would I put 'mysql -
      > >p' into
      > >vim so that I can connect to the server and then how would I submit
      > >the
      > >queries?
      >
      > IIUC, you want to run a shell command and 'capture the output' in vim.
      >
      > To run a command inside vim you preface it with :!
      > :!ls will list your current directory, then prompt you to hit
      > enter to go back to using vim
      >
      > To read in external files you use :r
      > :r addMe.txt will add the file to your current document
      >
      > To run a command inside vim and read in the output you combine the
      > commands (very vimmish)
      > :r!ls will add the directory listing to the bottom of your document
      >
      > So, you should be able to do something like
      > :r!mysql -e help
      > or whatever - the sql I leave to you.
      >
      > HTH
      > Brian

      I do not think there is anything mac-specific about this question,
      so you may get more help on the general vim users' list.

      If your SQL commands are in the vim buffer, you can yank them and
      paste to the command line. For example (starting in Normal mode)

      y$:<C-R>"

      will yank the current line, enter Command-line mode, and paste the
      yanked text. If you want to do this a lot, you may want to define a
      mapping for it.

      :help y
      :help c_CTRL-R

      If you want an interactive SQL session in vim, then some plugins
      may help. I have never used them myself. For example,
      http://www.vim.org/scripts/script.php?script_id=165
      (The site is behaving oddly. Maybe it is just me, but reloading a page
      seems to help when it initially comes up blank.)

      HTH --Benji Fisher
    Your message has been successfully submitted and would be delivered to recipients shortly.