Re: VIM: :execute question - Help!
- From: Bob Harris <nospam.News.Bob@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 22 Aug 2005 00:49:21 GMT
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
.
- Follow-Ups:
- Re: VIM: :execute question - Help!
- From: Fred
- Re: VIM: :execute question - Help!
- References:
- VIM: :execute question - Help!
- From: Fred
- VIM: :execute question - Help!
- Prev by Date: Re: Vim - turning off adding // comment at the next line automatically..
- Next by Date: Re: yank buffer size
- Previous by thread: VIM: :execute question - Help!
- Next by thread: Re: VIM: :execute question - Help!
- Index(es):
Relevant Pages
|