Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
can I do command substitutions in vimscript?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ninjaaron  
View profile  
 More options Nov 10 2011, 5:24 pm
From: ninjaaron <ninjaa...@gmail.com>
Date: Thu, 10 Nov 2011 14:24:13 -0800 (PST)
Local: Thurs, Nov 10 2011 5:24 pm
Subject: can I do command substitutions in vimscript?
In bash, I can do something like this:

foo=`cat bar`

... and then the variable $foo will be the content of the file "bar."

I want to use the cat command to assign a value in my vimrc.  I'm sure this
is possible, but I can't figure it out.

--
View this message in context: http://vim.1045645.n5.nabble.com/can-I-do-command-substitutions-in-vi...
Sent from the Vim - General mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Taylor Hedberg  
View profile  
 More options Nov 10 2011, 5:37 pm
From: Taylor Hedberg <tmhedb...@gmail.com>
Date: Thu, 10 Nov 2011 17:37:58 -0500
Local: Thurs, Nov 10 2011 5:37 pm
Subject: Re: can I do command substitutions in vimscript?
I'm not 100% sure what you're trying to accomplish, but if you want to
actually invoke cat to dump the contents of a file "bar" into a Vim
variable "foo", you can do:

    let foo = system('cat bar')

where the string passed to system() can be any arbitrary shell command.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Weber  
View profile  
 More options Nov 10 2011, 5:47 pm
From: Marc Weber <marco-owe...@gmx.de>
Date: Thu, 10 Nov 2011 23:47:24 +0100
Local: Thurs, Nov 10 2011 5:47 pm
Subject: Re: can I do command substitutions in vimscript?
Excerpts from ninjaaron's message of Thu Nov 10 23:24:13 +0100 2011:

> In bash, I can do something like this:
> foo=`cat bar`

let foo=system('cat bar')
or let foo = join(readfile('bar'),"\n") # lookup binary options

> I want to use the cat command to assign a value in my vimrc.  I'm sure this
> is possible, but I can't figure it out.

Why do you want to use cat? ..

Marc Weber


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ninjaaron  
View profile  
 More options Nov 10 2011, 8:35 pm
From: ninjaaron <ninjaa...@gmail.com>
Date: Thu, 10 Nov 2011 17:35:49 -0800 (PST)
Local: Thurs, Nov 10 2011 8:35 pm
Subject: Re: can I do command substitutions in vimscript?
Thanks guys.  I've been writing some scripts to change themes for my window
manager and my terminals together on the fly, and I made some vim
highlighting schemes to go along with them.  With this command, I can echo
some text from my scripts to a file, and then have .vimrc read the file and
select the appropriate color scheme.

--
View this message in context: http://vim.1045645.n5.nabble.com/can-I-do-command-substitutions-in-vi...
Sent from the Vim - General mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »