Standard less interprets ^H by moving the cursor to the left, characters
overstruck this way (x^Hx) are bold. I have made runtime/syntax/pager.vim which
mimics this, and updated less.vim to use it when the input is stdin. I'm not
sure if everything is done the way it should be, but the patch works and it's
only a few lines. Plus, we get nice yellow-and-white instead of stupid
monochrome :)
This among others fixes man pages and the python repl help() command.
For feedback please cc to [email protected], thanks
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r 8187706695fc runtime/macros/less.vim
--- a/runtime/macros/less.vim Thu Aug 23 22:28:46 2012 +0200
+++ b/runtime/macros/less.vim Fri Aug 24 19:21:00 2012 +0200
@@ -242,4 +242,8 @@
unmap ?
endfun
+if bufname("%") == ""
+ set syntax=pager
+endif
+
" vim: sw=2
diff -r 8187706695fc runtime/syntax/pager.vim
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/syntax/pager.vim Fri Aug 24 19:21:00 2012 +0200
@@ -0,0 +1,16 @@
+" This converts overstruck characters (like the f^Hfo^Hoo^Ho stuff in man
+" pages) into bold text.
+
+if has("conceal")
+ syn match Overstruck "\(.\)\1" contains=Overstrike
+ syn match Overstrike "." conceal
+ endif
+
+if &background == "dark"
+ hi def Overstruck cterm=bold ctermfg=3 guifg=#FFFF00
+else
+ hi def Overstruck cterm=bold ctermfg=4 guifg=#2222BB
+ endif
+
+setlocal conceallevel=2
+setlocal concealcursor=n