Vim text coloring

前端 未结 3 503
無奈伤痛
無奈伤痛 2021-01-12 00:44

I use echo -e to color my scripts output, it works fine when using standard output.

But when I redirect the output to a file, vim doesn

3条回答
  •  粉色の甜心
    2021-01-12 00:56

    Redirecting to a file creates that file with all the characters in the input -- including the color escapes. This is actually correct behaviour, and vim is showing you the right thing when it shows these special characters to you.

    It seems that perhaps what you're looking for is syntax highlighting. Vim comes with the ability to understand and colorize many different types of text.

    Try making sure you have the filetype option correctly set for whatever type of script you're using. Once you get it, you can get vim to set it automatically with the au command. Check out :help filetype for more info.

提交回复
热议问题