convert files (images for example) and output to vim as colored ascii chars
it's designed extensible, with some hacks, you may use it as video player, canvas drawer, or even game player
if you like my work, check here for a list of my vim plugins, or buy me a coffee
use vim-plug or any other plugin manager you like to install
Plug 'ZSaberLv0/ZFVimAsciiPlayer'
this repo only holds basic API, you must also install extensions to support actual file types:
-
Plug 'ZSaberLv0/ZFVimAsciiPlayer_image'
: image/gif viewer- you need
python
andpip install img2txt.py
to make this extension to work, see ZFVimAsciiPlayer_image for detail
- you need
simply open a supported file
see ZFVimAsciiPlayer_image for example
to write extensions:
-
supply impl functions:
" params: { " 'file' : 'file to open', " 'maxWidth' : 'max width (char count)', " 'maxHeight' : 'max height (char count)', " 'heightScale' : 'height scale to suit terminal char size', " } " return state: { // return empty for error " 'fps' : '-1 to use global g:ZFAsciiPlayer_fps', " 'totalFrame' : 'total frame count, -1 for infinite', " ... // extra impl state " } function! MyExt_converterInit(params) endfunction " return frame data: { " 'time' : 'frame time, 0 to use global fps', " 'lines' : [], " 'hlCmds' : [ " { " 'group' : '', " 'iLine' : 'start from 1', " 'pos' : '', " 'len' : '', " }, " ... " ], " } function! MyExt_converterFrame(state, frame) endfunction
-
register the impl functions:
if !exists('g:ZFAsciiPlayer_converters') let g:ZFAsciiPlayer_converters = {} endif " register by file extension (must be lowercase) let g:ZFAsciiPlayer_converters['my_ext'] = { \ 'init' : function('MyExt_converterInit'), \ 'frame' : function('MyExt_converterFrame'), \ }
-
now try to open
*.my_ext
files