Is there a vim runtime log?
running vim with the -V[N] option will do a pretty hefty runtime log, here N is the debug level.
vim -V9myVim.log
would create a log of debug level 9 in the current directory with the filename myVim.log
Vim commands log
Yes, there is! When launching vim use vim -W ~/vimcommands.log
to >> to a file, or -w
to overwrite the file.
-w {scriptout}
All the characters that you type are recorded in the file {scriptout}, until you exit Vim.
This is useful if you want to create a script file to be used with "vim -s" or ":source!".
If the {scriptout} file exists, characters are appended.
-W {scriptout}
Like -w, but an existing file is overwritten.
You may want to add a bash alias to store vim logs based on file name. I am interested to see how you intend to analyse your logs, I would like to do the same.
How do you search through Vim's command history?
Enter the first letters of your previous command and push <Up> arrow (or Ctrl+p).
:set li<up>
:set lines=75
Don't forget to check history option and set it to big enough value
:set history=1000
How to get read of log files after opening vim
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. ;-)
VIM symbol ^A in log file
Try :help digraph-table
in Vim, you can see
char digraph hex dec official name
^@ NU 0x00 0 NULL (NUL)
^A SH 0x01 1 START OF HEADING (SOH)
...
So ^A
is the ASCII 0x01 character. If you want to see ^A
things with hex code, try set display+=uhex
. It'll be displayed as <01>
with color of gray.
Also you can search this character with /Ctrl-VCtrl-AEnter. See :help i_CTRL-V
:
CTRL-V Insert next non-digit literally. For special keys, the
terminal code is inserted. It's also possible to enter the
decimal, octal or hexadecimal value of a character
i_CTRL-V_digit.
The characters typed right after CTRL-V are not considered for
mapping. {Vi: no decimal byte entry}
Note: When CTRL-V is mapped (e.g., to paste text) you can
often use CTRL-Q instead i_CTRL-Q.
You can enter a character with its hex value, <C-V>Xnn
or <C-V>xnn
, or its decimal value, <C-V>nnn
, or its octal value, <C-V>Onnn
or <C-V>onnn
. In this case, it'll be <C-V>x01
, <C-V>001
, or <C-V>o001
.
If you're using Vim on Windows, Ctrl-V
might be used to paste. Then try Ctrl-Q
instead of Ctrl-V
. See :help CTRL-V-alternative
:
Since CTRL-V is used to paste, you can't use it to start a blockwise Visual
selection. You can use CTRL-Q instead. You can also use CTRL-Q in Insert
mode and Command-line mode to get the old meaning of CTRL-V. But CTRL-Q
doesn't work for terminals when it's used for control flow.
Vim : How to start and stop logging everything going on?
You can log actions in Vim if you set verbose level in opened editor:
:set verbose=15
where 15 is debug level (it can be any number between 1 and 15, where 15 is the most detailed logging). If you want to save debug output into a file, you can execute:
:set verbosefile=log.txt
Check the full article by Jonathan Lehman where he explains it
vim editor, navigate at the source code using a log file
What you describe is called a quickfix window in Vim. You may be familiar with it from the results of the :make
command. You can open a quickfix window using :cfile
. The format is determined by the errorformat
variable. Look up Vim help on these for more details.
For your example (filename, line, function, trace statement) you could do:
:set errorformat=%f\\\,\\\ %l\\\,\\\ %m
:cfile log.txt
The gratuitous triple backslashes are there to get around escape sequences in the :set
command. The format translates to %f\,\ %l\,\ %m
.
Alternatively, you could output your log in the gcc format. In that case, the default errorformat
would be able to parse it, and all you would have to do is open it with the :cfile
command.
After loading, you can view the log using the :clist
or :copen
.
How can I remove all console.logs using VIM
You'll have to set args
to files you want to update first and then call argdo
.
:args ./*.js
above will select all the javascript files in the current directory. If the current directory has sub-directories and you want to select files recursively you could use
:args **/*.js
After setting the args you can call the global
command using argdo
:argdo g/log/d | update
Related Topics
Running a Script Just Before Installation of Debian Finishes Using Preseed
Vagrant Ssh -C and Keeping a Background Process Running After Connection Closed
In Linux, Physical Memory Pages Belong to The Kernel Data Segment Are Swappable or Not
How to Provide Extend-On-Write Functionality for Memory Mapped Files in Linux
Linux of Equivalent Cryptprotectmemory
Execute a Script After Every Git Push
Principle of Qemu CPU Emulation
How to Disable Serial Console(Non-Kernel) in U-Boot
Ansible: Check If Service Is Listening on a Specific Port
How to Programmatically Invert Screen Colors in Linux
Implementing Basic File System
What Ncurses Frameworks Are Available for Bash
Berkeley Db Mismatch Error While Configuring Ldap
What's The Difference Between Insmod and Modprobe
How to Check Character Encoding of a File in Linux
The Repository 'Http://Dl.Google.Com/Linux/Chrome/Deb Stable Release' Is Not Signed