Vim中显示不可见字符

 :set invlist, 或 :%!
或还可以自己定义:
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:< set list
:set nolist可以回到正常的模式
cat -A file 也可以显示不可见字符

dos2unix

is a commandline utility that will do this, or :%s/^M//g will if you use Ctrlv Ctrlmto input the ^M, or you can :set ff=unix and vim will do it for you.

Change the lineendings in the view:

This can also be used as saving operation (:w alone will not save using the lineendings you see on screen):

And you can use it from the command-line:

For more information, see the vim help :

dos2unix can directly modify the file contents.

You can directly use it on the file, with no need for temporary file redirection.

The above uses the assumed US keyboard. Use the -437 option to use the UK keyboard.

@ https://gist.github.com/sparkida/7773170

also, as mentioned above ^M = Ctrl+V + Ctrl+M (don’t just type the caret “^” symbol and M)

that fill find all carriage return signs (one and more reps) up to the end of line and delete, so just \nwill stay at eol.

Categories: OS

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *