Output VIM's buffer to terminal

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Output VIM's buffer to terminal

Srikanth-17

`cat' outputs the file contents to the terminal but I want VIM to do
that because I would like to see all the colors and highlightings :)

may be like:

vim --output-to-terminal myfile.c

Can we do it?

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Output VIM's buffer to terminal

Charles-14

On Sep 19, 4:56 pm, Srikanth <[hidden email]> wrote:
> `cat' outputs the file contents to the terminal but I want VIM to do
> that because I would like to see all the colors and highlightings :)
>
> may be like:
>
> vim --output-to-terminal myfile.c

This isn't perfect, but it works

vimcat.sh
------------------------------
#!/bin/bash

n=`wc -l $1 | awk '{print $1}'`
echo gg > script.vim
while [[ $n > 0 ]]
do
    echo ^F^E^E >> script.vim
    n=`expr $n - $LINES`
done
echo :q >> script.vim
script -c "vim -R --noplugin -c 'set laststatus=0' -s script.vim $1"
cat typescript | sed '1,2d'
------------------------------

test:
export $LINES
./vimcat.sh somfile

note: ^F^E^E = ^VF^VE^VE

---
Charles
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---