Vimcat displays colored/highlighted text as it is displayed in Vim, using ANSI escape codes. It supports tabular/column alignment, line numbers, line breaks, unicode, full-width characters, and more.
- Vim 7.x (may work with earlier versions)
- Python 2.x, with pty support
- OS with named pipe (FIFO) support
- Place the Python script 'vimcat' somewhere in your $PATH
- Place the file 'vimcat.vim' in your vim runtime path, for example, $HOME/.vim/
$ vimcat [FILE]...
Vimcat consists of two parts: a Python script that launches a headless Vim in a pseudo-terminal, and a Vimscript to do the ANSI conversion work inside Vim. Output and signaling between processes takes place via named pipes (FIFOs). This method allows Vim to start outputting converted data without having to finish converting the whole file. This is nice for interactive viewing/paging. This idea is a workaround for Vimscript's limitations which require a slow character by character query for color/highlight information (see :help synID)
Vimcat attempts to output colors and highlighting to mimic Vim's interactive display. Syntax highlighting, colorschemes, and any other relevant options should be configured in your .vimrc file. Alternatively, if $HOME/.vimcatrc exists, it will will override all normal initializations, including .vimrc.
The Vimscript portion of the code is based on code from Matthew Wozniski ([email protected]).