Re: Stuck & confused
- On Tue, Mar 13, 2007 at 11:56:59AM -0400, Brian McKee wrote:
> -----BEGIN PGP SIGNED MESSAGE-----I do not think there is anything mac-specific about this question,
> 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
> 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.
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)
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.
If you want an interactive SQL session in vim, then some plugins
may help. I have never used them myself. For example,
(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