Skip to content

Instantly share code, notes, and snippets.

@liushapku
Created December 7, 2018 02:06
Show Gist options
  • Save liushapku/063ef225a3e9f301b00c725e28a3c28a to your computer and use it in GitHub Desktop.
Save liushapku/063ef225a3e9f301b00c725e28a3c28a to your computer and use it in GitHub Desktop.
a patch make vim able to log
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 9040c0d07..e7f040fc2 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1,3 +1,23 @@
+#include <stdio.h>
+#include <stdarg.h>
+int shouldout = 0;
+int mprintf(char *fmt, ...)
+{
+ static FILE * pf = NULL;
+ if (shouldout)
+ {
+ if (pf == NULL)
+ pf = fopen("/dev/pts/26", "w");
+ int ret;
+ va_list myargs;
+ va_start(myargs, fmt);
+ ret = vfprintf(pf, fmt, myargs);
+ va_end(myargs);
+ return ret;
+ }
+ return 0;
+}
+
/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
diff --git a/src/vim.h b/src/vim.h
index be86c6b10..f2ce16ff7 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1,3 +1,6 @@
+extern int shouldout;
+int mprintf(char * fmt, ...);
+
/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment