slides.vim

Des slides dans votre vim - retour accueil

git clone git://bebou.netlib.re/slides.vim
Log | Files | Refs |

slides.vim.fixtitles (571B)


      1 #!/bin/sh
      2 
      3 usage() <<% cat --
      4 
      5 just before running the talk:
      6 
      7 add extra tailing spaces to title lines so they looks like c columns long.
      8 this is something to do
      9 
     10 	$0 60
     11 
     12 when editing it: remove them
     13 
     14 	$0 -r
     15 remove
     16 
     17 %
     18 
     19 cmd="${1?at least one parameter, see $0 -h}"
     20 shift;
     21 
     22 expand() awk -F'›' '{
     23 	if (l = length($2)) printf "%-*s\n", l + c, $0
     24 	else print
     25 }' "$@"
     26 
     27 case "$cmd"
     28 	in ( [1-9]*      ) expand "c=$cmd" "$@"
     29 	;; ( -r | 0      ) sed -r '/›/s/ +$//' "$@"
     30 	;; ( -h | --help ) usage
     31 	;; ( *           )
     32 		>&2 echo "unknown command $cmd, see $0 -h"
     33 		exit 1
     34 esac
     35 
     36