📅 2015-Mar-27 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ strace, syntax highlighting, vim ⬩ 📚 Archive
Strace output can be written to a log file by using the -o
option. This output is typically verbose and I find it helpful if the editor can apply syntax highlighting on it. This gives the system call, its parameters and its output different colors and makes it easy to understand the log.
Vim has support for syntax highlighting of strace output. You can see this in the /usr/share/vim/vim74/syntax/strace.vim
file. Vim tries to detect if the file is strace output by looking for an execve
or libc
pattern in the first line. This logic can be seen in its /usr/share/vim/vim74/scripts.vim
file. I have never seen these patterns in the first line in my strace output.
Since Vim does not automatically detect my strace output file, I enable it explicitly using the command: :set filetype=strace
Another trick is to output strace to a file of particular extension, say .strace
and look for that file extension to set the strace
filetype automatically. If you want this, then add this line to your .vimrc
:
autocmd BufRead,BufNewFile *.strace set filetype=strace
Tried with: Vim 7.4, Strace 4.8-1 and Ubuntu 14.04