Re: VIM: :execute question - Help!



In article <pan.2005.08.21.22.54.35.319033@xxxxxxx>,
Fred <itfred@xxxxxxx> wrote:

> Using vim 6.3 under Linux, I'm trying to execute
> the "dict" command. It's a text based application
> that looks up words on a dictionary server.
> The problem arises when attempting to execute
> the dict command in a new split window.
> So in a simple script, I set the variable
> word to hello:
>
> let word="hello"
>
> Now this works fine, but not in a new window:
>
> execute ":!dict " . word
>
>
> This I cannot get to work for the life of me:
>
> execute ":new +read!dict " . word
>
> What the above command does, is open a new window,
> but does not actually lookup the word. Instead it
> displays the following message from dict, which
> is what you get if you type dict without passing
> it a word to lookup:
>
> hartford:/home/fred> dict
> dict 1.9.7/rf on Linux 2.6.12-1.1398_FC4
> Copyright 1997-2002 Rickard E. Faith (faith@xxxxxxxx)
> Use --help for help
>
>
> So for some reason, the variable "word" is not being
> passed in the execute command. Yet it works just
> fine in the first example above, which doesn't
> create a :new window. What am I doing wrong here?
>
>
> -TIA

let word="hello"
execute "new +read!dict\\ ".word

NOTE: NO RAW SPACES. See the :help +cmd
I used \\ inside the "..." so that one would survive the "..." rules. I
also experimented until I got some results. Especially no spaces
between the last " the . and word. Personally I love spaces to make
things move visible, but it seems this is just not allowed for the +cmd
rules.

If you want some flexibility in putting space in your source, then try
constructing the entire new command in a string, and then execute the
string:

let word = "hello"
let command = "new +read!" . "dict\\ " . word
" echo command " uncomment to see what command looks like
execute command

Bob Harris
.



Relevant Pages

  • Re: Question Multi A/V Tool
    ... You have to execute NET START WORKSTATION in a Command Prompt. ... and in the Command Prompt window enter; ...
    (microsoft.public.security.virus)
  • Re: C Programming promt screen closes right away
    ... open a command prompt window, ... If you execute your program by double-clicking it's icon, ... done its thing, the command window closes, by design. ... Bringing you BeadWizard Design Software ...
    (microsoft.public.windowsxp.help_and_support)
  • VIM: :execute question - Help!
    ... I'm trying to execute ... the dict command in a new split window. ... but not in a new window: ...
    (comp.editors)
  • Re: Which program file is executed?
    ... I am looking for an answer that does not require that I actually the program in question or click on the shortcut. ... And, no, not all programs open a window. ... I can execute `excel` from Program> Run, ... easiest way to determine the exact command and path that was used to ...
    (microsoft.public.windowsxp.general)
  • Re: how to access window network
    ... Now whenever you want to mount this file system issue the command ... The "user" attribue in the fstab entry will permit you to execute this ... > I would like to know how to access window network ...
    (Fedora)