I am analyzing log file using vim and the format looks like this
YYYY-MM-DD HH:MM:SS.USEC PID Name LogText
Since Most of the times I don't care about date and time. I want to hide them and just focus on the Name and LogText columns (To save some screen estate). Since the first three columns always occupy the first 35 letters in a line. Is there a way to make vim not display first 35 letters of each line ?
Best Answer
You asked about how to hide the first letters, not to remove them, or scroll them out of sight - so here is how to actually hide them:
Hide text in vim using conceal
You can use matching, combined with syntax highlighting and the conceal feature to actually not show matched characters inside lines.
To hide the first 25 chars of each line:
To hide only the lines with the punctuation of a date instead:
To unhide:
What looks like this normally:
will look like this after executing the first two commands:
See also - inside
vim
:help :syn-match
help :syn-conceal
help 'conceallevel'
help 'concealcursor'
(Let me know if it does not behave like that - there may be some more setting I'm not aware of or so - I'll get it to work.)