vim script to highlight plain text files
here is a screenshot with xterm16 colorscheme
if you like my work, check here for a list of my vim plugins, or buy me a coffee
-
use Vundle or any other plugin manager you like to install
Plugin 'ZSaberLv0/ZFVimTxtHighlight'
-
by default, all
text
files or any other file that have nosyntax
specified, would be set tozftxt
assyntax
you can disable it by setting:
let g:zf_txt_auto_highlight=0
or, set the file type to auto enable:
let g:zf_txt_auto_syntax = ['', 'txt', 'text']
or, you may want to set
syntax
manually when necessary:set syntax=zftxt
or, replace original file type detect:
autocmd FileType html,markdown set syntax=zftxt
-
by default, files that larger than 5MB would be ignored from highlight, you may change this setting by
let g:zf_txt_large_file=5*1024*1024
-
to add your custom syntax or keyword, add
*.vim
file to yourrtp
(:h rtp
), with this directory structure:rtp/ zftxt/ your_syntax.vim
the
*.vim
file would be sourced (:h :source
) during highlighting, seezftxt.vim
itself for examples
:call ZF_VimTxtHighlightToggle()
: toggle current file syntax:call ZF_VimTxtHighlightEcho()
or:ZFHIGHLIGHT
: echo the highlight info of the word under cursor