Skip to content

Instantly share code, notes, and snippets.

@bootleq
Created August 16, 2011 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bootleq/1149395 to your computer and use it in GitHub Desktop.
Save bootleq/1149395 to your computer and use it in GitHub Desktop.
Right justify *keyword* in Vim help files.
" }}}2 help 檔案將 *keyword* 對齊到右端 {{{2
function! HelpHyperTextEntryJustify()
let save_isk = &l:iskeyword
let save_et = &l:expandtab
let &l:isk = '!-~,^*,^|,^",192-255'
let &l:expandtab = 1
.retab!
call setline(".",
\ substitute(
\ getline('.'),
\ '\v(.*)(\s\*\k+\*)',
\ '\=submatch(1) . repeat(" ", &textwidth - strlen(submatch(0))) . submatch(2)'
\ , ""
\ ))
let &l:isk = save_isk
let &l:et = save_et
.retab!
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment