2

Whenever I want to install a new Vim script on the Linux server I'm working on, my typical workflow is as the following:

  1. surf the plugin's homepage in Vim online using FireXXXX
  2. download a right version of the plugin to my laptop by click some highlighted link
  3. upload the downloaded plugin from my laptop to Linux server using WinSCP

which is really inconvenient. I don't know what is the magic behind this: I mean for the same hyperlink I click it in web browser. I can let you download it but use Wget plus the hyperlink in Linux command-line will end up with nothing but an error indication. Hyperlink in the web browser. Otherwise I can get the link in web browser and then use Wget or some similar tool to actually do the downloding.

I try new cool Vim scripts quite ofte , so you can imagine my dismay when I have to repeat the tedious action all the time. What are some tips which can let me download the Vim scripts in a more "professional" way?


Post edit:

My problem is not find a tool like Wget or cURL. The problem I met is quite specific; to use these tools to download a Vim script. Let's take http://www.vim.org/scripts/script.php?script_id=30 as an example.

It's the normal place where one can get the script, at least for me. But I can't find an working URL from this page that can feed to Wget.

4
  • It would help if you gave an example URL and indicated exactly what problems you are having with wget. It (or something like it, e.g. cURL, etc.) is the usual solution to “command line downloading”. Mar 11, 2010 at 3:49
  • are there permissions issues with the linux server? what is the error you are getting?
    – kajaco
    Mar 11, 2010 at 6:20
  • @Chris Johensn and kajaco: vim.org/scripts/script.php?script_id=30 I can't find the url for the script in the above link that is my problem. Mar 11, 2010 at 8:26
  • The URL for that script seems fairly obvious to me. It is the first link in the table at the bottom of the page. That is what you click to download via a web browser, is it not? Again, what problem are you having with wget? The URL http://www.vim.org/scripts/download_script.php?src_id=9196 (for the 1.13 version on the page you gave) works fine for me with wget 1.12 and curl 7.20.0. Mar 11, 2010 at 18:41

8 Answers 8

3

Take a look at wget http://www.gnu.org/software/wget/

2

Answering to the specific case of python_fn.vim. The links provided on the page work just fine in wget - they just get the wrong name (download_script.php?src_id=9196). If this is causing you troubles, you can use wget's -O. As in:

wget -O python_fn.vim http://www.vim.org/scripts/download_script.php?src_id=9196

2
  • 3
    The --content-disposition option of wget will cause the downloaded files to use the server-provided name like web browsers do. Also, you may want to quote the URL (I prefer single quotes) so that the shell does not try to expand it as a glob (since it has ? in it; depending on the shell and the options that are active, globs that do not match anything sometimes expand to an empty string, and sometimes cause errors). Mar 12, 2010 at 3:44
  • That's very useful, I actually skimmed the man page to find out if there was such a feature, but apparently not thoroughly enough.
    – Sarah
    Mar 14, 2010 at 11:17
2

Perhaps GetLatestVimScripts is something for you?

2

From page 'http://www.vim.org/scripts/script.php?script_id=30' , you can find the download url is 'http://www.vim.org/scripts/download_script.php?src_id=9196'. This step is quite easy.

I think the really problem for you is after

wget http://www.vim.org/scripts/download_script.php?src_id=9196

you got file 'download_script.php?src_id=9196' and you thought the download failed..

Actually the plugins has downloaded successfully as 'download_script.php?src_id=9196', just rename it as 'python_fn.vim' or add '-O python_fn.vim' for wget.

1

Comparison of open source download tools (most of them command line, including wget tronpxs already mentioened)

1

To download the file you've mentioned in post edit:

%> wget http://www.vim.org/scripts/download_script.php?src_id=9196
%> mv download_script.php?src_id=9196 python_fn.vim

The general algorithm is:

  1. go to desired vim script page
  2. locate a table with downloads in the bottom which looks like

package | script version | date | Vim version | user | release notes

  1. copy hyperlink of the desired file and feed it to wget
  2. rename resulting file to what you have seen in package column on download page
1
/usr/bin/vim-addons 

in Ubuntu, but I actually use pathogen and github or

.../download_script.php?src_i=... 

with vimballs and then gunzip and mkdir, and :UseVimball

0

Use a text-based browser, like w3m.

w3m http://www.vim.org/scripts/script.php?script_id=30 

It won't have any problems with redirection, so pointing it to the script download url:

w3m http://www.vim.org/scripts/download_script.php?src_id=9196

Will present you with the option of downloading the file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .