Change 'cryptmethod' from a number to a string option. Make it global-local.
diff --git a/src/misc2.c b/src/misc2.c
index 1eb4e8a..9327e89 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -3751,6 +3751,41 @@
static int saved_crypt_method;
/*
+ * Return int value for crypt method string:
+ * 0 for "zip", the old method. Also for any non-valid value.
+ * 1 for "blowfish".
+ */
+ int
+crypt_method_from_string(s)
+ char_u *s;
+{
+ return *s == 'b' ? 1 : 0;
+}
+
+/*
+ * Get the crypt method for buffer "buf" as a number.
+ */
+ int
+get_crypt_method(buf)
+ buf_T *buf;
+{
+ return crypt_method_from_string(*buf->b_p_cm == NUL ? p_cm : buf->b_p_cm);
+}
+
+/*
+ * Set the crypt method for buffer "buf" to "method" using the int value as
+ * returned by crypt_method_from_string().
+ */
+ void
+set_crypt_method(buf, method)
+ buf_T *buf;
+ int method;
+{
+ free_string_option(buf->b_p_cm);
+ buf->b_p_cm = vim_strsave((char_u *)(method == 0 ? "zip" : "blowfish"));
+}
+
+/*
* Prepare for initializing encryption. If already doing encryption then save
* the state.
* Must always be called symmetrycally with crypt_pop_state().