Created
August 16, 2011 15:47
-
-
Save bootleq/1149395 to your computer and use it in GitHub Desktop.
Right justify *keyword* in Vim help files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" }}}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