开发者

Changing text appearence in vim

开发者 https://www.devze.com 2022-12-28 03:29 出处:网络
Suppose I have a file开发者_开发知识库, whose entire contents is: \\u1234 and suppose 1234 is the code for \\alpha

Suppose I have a file开发者_开发知识库, whose entire contents is:

\u1234

and suppose 1234 is the code for \alpha

is there a way to, in vim, have the "\1234" show up as a single \alpha symbol (and be treated as an \alpha symbol) ?

Thanks!

[This problem arises since I want to to use unicode names in g++]


I really don't think this is possible, since vim is designed to present and edit the actual contents of a file (it is not a WYSIWIG editor). I wouldn't recommend it for the exact same reasons, even if you find a way to do it - it will lead to confusion in the future (once you forget the feature, or if it is triggered in a document you weren't expecting, or the script contains a bug, etc.)


There is a plugin for Vim to display certain characters in Haskell as the Unicode symbol: http://www.vim.org/scripts/script.php?script_id=2603. It even decodes the symbols to their text-representation before writing (and vice versa after reading a Haskell file).

I guess you can do the same, just inspect the plugin's source.


One thing you could do is define custom highlighting so that you know that that character maps to something else. May not be exactly what you want but as soulmerge points out anything else may be dangerous/unclear.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号