~kaction/config

ref: milestone/1 config/aux/fix-ftplugin -rwxr-xr-x 509 bytes
8f4e28c9 — Dmitry Bogatov vim: drop custom implementation of snippets 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh -eu
# When vim changes file types, in executes b:undo_ftplugin command,
# which should undo all customization, done by previous file type.
#
# This small script reads ftplugin file and writes on stdout
# its copy with b:undo_ftplugin appended. Automation!

input=$1

extract_options () {
    awk '/^[ ]*set(local)?/ { print $2 }' |
        awk -F '[=+]' '{ printf("%s< ", $1) }'
}

options=$(extract_options < "${input}")
cat "${input}"
printf 'let b:undo_ftplugin .= "|setlocal %s"\n' "${options}"