(cleanup) |
(Adjust previous/next navigation + minor manual clean) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{TipImported |
||
− | |||
− | {{review}} |
||
− | {{Tip |
||
|id=1012 |
|id=1012 |
||
+ | |previous=1010 |
||
− | |title=Quoted Printable to Plain |
||
+ | |next=1014 |
||
− | |created= |
+ | |created=2005 |
|complexity=intermediate |
|complexity=intermediate |
||
+ | |author=Bertram Scharpf |
||
− | |author=vim at bertram dash scharpf dot de |
||
|version=6.0 |
|version=6.0 |
||
|rating=5/2 |
|rating=5/2 |
||
+ | |category1=Email |
||
− | |text= |
||
+ | |category2= |
||
}} |
}} |
||
⚫ | |||
− | |||
⚫ | |||
<pre> |
<pre> |
||
⚫ | |||
− | function s:FromQuoPri( ) range |
||
− | + | vnoremap <Leader>Q :s/=\(\x\x\<BAR>\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge<CR> |
|
− | endfunc |
||
− | |||
− | nnoremap <silent> <leader>Q :0/^$/+1,$call <SID>FromQuoPri()<cr> |
||
− | |||
− | vnoremap <silent> <leader>Q :call <SID>FromQuoPri()<cr> |
||
</pre> |
</pre> |
||
− | |||
− | The trick is to use a ranged function. Otherwise the = line continuations won't be substituted correctly. |
||
==Comments== |
==Comments== |
||
− | How is this different from the following? |
||
− | |||
− | <pre> |
||
⚫ | |||
− | vnoremap <silent> <Leader>Q :s/=\(\x\x\<BAR>\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge<CR> |
||
− | </pre> |
||
− | |||
− | ---- |
||
− | Just a matter of taste. I didn't like to edit both lines simultaneously when developing it. |
||
− | |||
− | ---- |
Latest revision as of 10:55, 23 September 2009
Tip 1012 Printable Monobook Previous Next
created 2005 · complexity intermediate · author Bertram Scharpf · version 6.0
Sometimes I pipe an email into Vim and then I cannot read it because it is encoded in quoted printable. Mentioning this in my vimrc helps:
nnoremap <Leader>Q :%s/=\(\x\x\<BAR>\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge<CR> vnoremap <Leader>Q :s/=\(\x\x\<BAR>\n\)/\=submatch(1)=='\n'?'':nr2char('0x'.submatch(1))/ge<CR>