From f64f51110258ddecdea447093ac5cbe489146a04 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Sat, 9 Mar 2013 21:17:31 +0000 Subject: [PATCH] Add custom modeline to top of file as well This gives the custom modeline a chance to run first, that way if the default modeline crashes the custom modeline is still used. We leave it at the bottom too so that the custom modeline gets precedence if everything is working OK. --- index.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.cgi b/index.cgi index 0b7859e..bbabd30 100755 --- a/index.cgi +++ b/index.cgi @@ -116,7 +116,8 @@ function respond { function format { # Create a temp file with the provided modeline tmp="$(mktemp)" - sed "\$avim: $(get_modeline)" "$1" > "$tmp" + sed -e "1ivim: $(get_modeline)" \ + -e "\$avim: $(get_modeline)" "$1" > "$tmp" # Determine cache name md5="$(cat index.cgi vimrc "$tmp" /usr/bin/ex | md5sum -b)" @@ -136,7 +137,7 @@ function format { '+sil! set iconstring= ruf= stl= tal=' \ "+sil! set titlestring=$1\ -\ vpaste.net" \ '+sil! set noml' \ - '+sil! $d|'$2 \ + '+sil! 1d|$d|'$2 \ '+sil! %s/\r//g' \ '+sil! TOhtml' \ "+sav! $out" \ -- 2.43.2