1

Every time I open vim, it generates various log files.

bt_regexp_debug.log
bt_regexp_log.log
nfa_regexp_debug.log
nfa_regexp_dump.log
nfa_regexp_run.log

Why do they get created, and how can I get read of them?

Camilo Celis Guzman
  • 595
  • 1
  • 5
  • 17
  • How do you "open" it? Any switches (options)? – zdim Mar 16 '16 at 02:23
  • In the most basic ways. No, Just by opening a file (`vim somefile`), or even `vim` alone generates this log files after exiting vim. – Camilo Celis Guzman Mar 16 '16 at 02:26
  • Are you familiar with the `.vimrc` file -- have you customized it? – zdim Mar 16 '16 at 02:29
  • yes. I thought of it too, so I completely deleted it, and still got the same log files. – Camilo Celis Guzman Mar 16 '16 at 02:40
  • Heh. What is in them? General start up messages? Loaded modules? ... – zdim Mar 16 '16 at 02:41
  • Any other configuration, perhaps in `.vim/` directory? There has to be _some_ option somewhere that is setting it off to write that. This is not default behavior. – zdim Mar 16 '16 at 02:44
  • Other files that are suspect are `.exrc` and system-wide config, often `/etc/vimrc`. Also: `vim` respects a `.vimrc` file in the directory in which it is started, if there is one there. – zdim Mar 16 '16 at 02:48
  • As, you can see by the answer below it was because I had compiled `vim` in `DEBUG` mode. Thank you for your help. – Camilo Celis Guzman Mar 16 '16 at 10:34

1 Answers1

4

From regexp_nfa.c:

#ifdef ENABLE_LOG
    log_fd = fopen(NFA_REGEXP_RUN_LOG, "a");

[...]

#ifdef ENABLE_LOG
    { 
        FILE *f = fopen(NFA_REGEXP_RUN_LOG, "a");

and from regexp.c:

#ifdef BT_REGEXP_LOG
    f = fopen("bt_regexp_log.log", "a");

All the calls to this seem to be wrapped in either a #ifdef ENABLE_LOG or #ifdef BT_REGEXP_LOG. On other words: they're compile-time switches.

Looking at the top of these two files, I see:

#ifdef DEBUG
# define NFA_REGEXP_ERROR_LOG   "nfa_regexp_error.log"

and:

#ifdef DEBUG
/* show/save debugging data when BT engine is used */
# define BT_REGEXP_DUMP

Conclusion: Your Vim is compiled with DEBUG defined.

You can verify this with vim --version, where it should show DEBUG BUILD at the bottom. I don't see any way to disable creating these files at runtime; you'll need to recompile Vim.

There doesn't seem to be a configure switch to enable/disable this. It should be disabled by default. In feature.h I see:

/*
 * DEBUG                Output a lot of debugging garbage.
 */
/* #define DEBUG */

And in Makefile I see:

#CFLAGS = -g -DDEBUG -Wall -Wshadow -Wmissing-prototypes

Note that both are commented out.

It's also possible you manually ran make with make CFLAGS="-DDEBUG".


P.S. I didn't know any of this either, but quickly found the answer by using grep on the Vim source tree. Learn to love grep. grep is your friend. ;-)

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
  • Thank you! It was it! I would follow your advice and learn to love `grep` – Camilo Celis Guzman Mar 16 '16 at 10:33
  • 1
    @CamiloCelisGuzman `grep` is actually not such a great tool as such, by the way. I used it more in the generic "to search" meaning ;-) It doesn't really matter *which* tool you use, but I've often found that when encountered with a mysterious error, just searching for the error (or filename in this case) is a great way to find out where it comes from :-) If you want a command-line tool, then `grep` is always available and learning the basics is probably worth-while, but I find that [the_silver_searcher](https://github.com/ggreer/the_silver_searcher) is much better/faster tool in general... – Martin Tournoij Mar 16 '16 at 10:50