Wikia

Vim Tips Wiki

Changes: Decode MIME text using Perl in Vim

Edit

Back to page

(Remove html character entities)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 5: Line 5:
 
|previous=1031
 
|previous=1031
 
|next=1033
 
|next=1033
|created=October 29, 2005
+
|created=2005
 
|complexity=intermediate
 
|complexity=intermediate
 
|author=Suresh Govindachar
 
|author=Suresh Govindachar
Line 15: Line 15:
 
Requires: Vim 6.x with Perl support. Uses Perl module MIME::Base64.
 
Requires: Vim 6.x with Perl support. Uses Perl module MIME::Base64.
   
If you have MIME Base64 or Quoted-Printable encoded text in a Vim buffer, the following commands can be used to replace the encoded lines with their decoded information. Just visually select the lines corresponding to the encoded text and issue the appropriate command (<tt>:Decode64</tt> or <tt>:DecodeQP</tt>).
+
If you have MIME Base64 or Quoted-Printable encoded text in a Vim buffer, the following commands can be used to replace the encoded lines with their decoded information. Just visually select the lines corresponding to the encoded text and issue the appropriate command (<code>:Decode64</code> or <code>:DecodeQP</code>).
   
 
<pre>
 
<pre>

Latest revision as of 06:04, July 13, 2012

Duplicate tip

This tip is very similar to the following:

These tips need to be merged – see the merge guidelines.

Tip 1032 Printable Monobook Previous Next

created 2005 · complexity intermediate · author Suresh Govindachar · version 6.0


Requires: Vim 6.x with Perl support. Uses Perl module MIME::Base64.

If you have MIME Base64 or Quoted-Printable encoded text in a Vim buffer, the following commands can be used to replace the encoded lines with their decoded information. Just visually select the lines corresponding to the encoded text and issue the appropriate command (:Decode64 or :DecodeQP).

command! -range=% Decode64 :w | <line1>,<line2>delete | let foo = @"
 \| perl my $foo=VIM::Eval(foo); my ($r, $c)=$curwin->Cursor(); $curbuf->Append($r-1, split '\n', MIME::Base64::decode($foo));

command! -range=% DecodeQP :w | <line1>,<line2>delete | let foo = @"
 \| perl my $foo=VIM::Eval(foo); my ($r, $c)=$curwin->Cursor(); $curbuf->Append($r-1, split '\n', MIME::QuotedPrint::decode_qp($foo));

CommentsEdit

Around Wikia's network

Random Wiki