Public bug reported:

Binary package hint: vim

Running `vim http://...` with a .vimrc to enable netrw works very
differently depending on whether or not you have elinks or links
installed. As you can see from the netrw code below, as soon as you have
either of the text browsers installed, netrw will invoke them to do a
dump of html --> txt and put that into your vim buffer. However, this
takes no account of the Content-Type header of the remote server so is
less than ideal.

$ cat .vimrc 
set nocp                    " 'compatible' is not set
filetype plugin on          " plugins are enabled

$ cat /usr/share/vim/vim72/autoload/netrw.vim
...
if !exists("g:netrw_http_cmd")
 if executable("elinks")
  let g:netrw_http_cmd = "elinks"
  let g:netrw_http_xcmd= "-dump >"
 elseif executable("links")
  let g:netrw_http_cmd = "links"
  let g:netrw_http_xcmd= "-dump >"
 elseif executable("curl")
  let g:netrw_http_cmd  = "curl -o"
 elseif executable("wget")
  let g:netrw_http_cmd  = "wget -q -O"
 elseif executable("fetch")
  let g:netrw_http_cmd  = "fetch -o"
 else
  let g:netrw_http_cmd  = ""
 endif
endif
...

Ideally, if I know a remote plain/text file is available at URL
http://paste.ubuntu.com/155255/plain/ then I want to do `vim
http://paste.ubuntu.com/155255/plain/` and receive that in my buffer for
viewing/editing.

$ curl -v http://paste.ubuntu.com/155255/plain/ 2>&1 | grep Content-Type
< Content-Type: text/plain

However, if the remote Content-Type is text/html then I may want elinks
-dump to proceed as normal.

ProblemType: Bug
Architecture: i386
Dependencies:
 
DistroRelease: Ubuntu 9.04
Package: vim None [modified: /var/lib/dpkg/info/vim.list]
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, user)
 LANG=en_GB.UTF-8
SourcePackage: vim
Uname: Linux 2.6.28-11-generic i686
UnreportableReason: This is not a genuine Ubuntu package

** Affects: vim (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386

-- 
vim http://... support via netrw doesn't inspect Content-Type header
https://bugs.launchpad.net/bugs/364548
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to