" Vim html_french plugin. " Version: 1.0 " " Description: " When loading a html file, this plugin replaces all " HTML-coded French characters (like é) with the " normal representation (). " " ripped from the Danish version by sune vuorela, based on the html_umlaute by Timo Teifel . " and the html_portuguese by Rubens Marins " Maintainer: Roger Pilkey " Usage: " It does everything automatically. When reading a file, " it replaces (é , à etc) with the corresponding " character encoding. " When saving, it replaces the special Characters with the " html-Code, undoing it after the write, to keep the chars " if you keep working with the file. " " Installation: " Save this file in vim plugin dir ( /usr/share/vim/vim61/plugin) or " ~/.vim/plugin/html_french.vim. " " Licence: GPL " " Changelog: " v1.0 " - initial release " do this only once per buffer: if exists("b:loaded_html_french") finish endif let b:loaded_html_french = 1 if has("autocmd") augroup html_french au! au FileType html,php call s:Html2Char() au BufWrite *.shtml,*.html,*.htm,*.php call s:Char2Html() au BufWritePost *.shtml,*.html,*.htm,*.php call s:Html2Char() augroup END endif " functions need to be sourced only once per session if exists("s:loaded_html_french_functions") finish endif let s:loaded_html_french_functions = 1 function s:Html2Char() " remember cursor position: let s:line = line(".") let s:column = col(".") " if more than 'report' substitutions have been done, vim " displays it. let s:save_report = &report set report=99999 "french special characters %s/À/À/eIg %s/Â/Â/eIg %s/Ä/Ä/eIg %s/Ç/Ç/eIg %s/É/É/eIg %s/È/È/eIg %s/Ë/Ë/eIg %s/Ê/Ê/eIg %s/Ï/Ï/eIg %s/Î/Î/eIg %s/Ô/Ô/eIg %s/Û/Û/eIg %s/&OELig;/Œ/eIg %s/à/à/eIg %s/â/â/eIg %s/ä/ä/eIg %s/ç/ç/eIg %s/é/é/eIg %s/è/è/eIg %s/ê/ê/eIg %s/ë/ë/eIg %s/ï/ï/eIg %s/î/î/eIg %s/ô/ô/eIg %s/û/û/eIg %s/œ/œ/eIg let &report=s:save_report unlet s:save_report call cursor(s:line,s:column) unlet s:line unlet s:column endfunction function s:Char2Html() let s:line = line(".") let s:column = col(".") let s:save_report = &report set report=99999 " french special characters %s/À/\À/eIg %s/Â/\Â/eIg %s/Ä/\Ä/eIg %s/Ç/\Ç/eIg %s/É/\É/eIg %s/È/\È/eIg %s/Ê/\Ê/eIg %s/Ë/\Ë/eIg %s/Ï/\Ï/eIg %s/Î/\Î/eIg %s/Ô/\Ô/eIg %s/Û/\Û/eIg %s/Œ/\Œ/eIg %s/à/\à/eIg %s/â/\â/eIg %s/ä/\ä/eIg %s/ç/\ç/eIg %s/é/\é/eIg %s/è/\è/eIg %s/ê/\ê/eIg %s/ë/\ë/eIg %s/ï/\ï/eIg %s/î/\î/eIg %s/ô/\ô/eIg %s/û/\û/eIg %s/œ/\œ/eIg let &report=s:save_report unlet s:save_report call cursor(s:line,s:column) unlet s:line unlet s:column endfunction