I keep getting ^M
character in my vimrc and it breaks my configuration.
相关问题
- Why should we check WIFEXITED after wait in order
- Emacs shell: save commit message
- UNIX Bash - Removing double quotes from specific s
- How to change the first two uppercase characters o
- Insert text into current buffer from function
相关文章
- 如何让 vim 支持 .cshtml 文件的代码高亮
- Auto-save in VIM as you type
- Making new files automatically executable?
- Reverse four length of letters with sed in unix
- How can I use gcc's -I command to add recursiv
- Extracting columns from text file using Perl one-l
- Problem with piping commands in C
- Vim: overloaded mapping for multiple modes
You can fix this in vim using
where ^ is the control character.
It probably means you've got carriage returns (different operating systems use different ways of signaling the end of line).
Use
dos2unix
to fix the files or set the fileformats in vim:try
:%s/\^M//
At least this worked for me.To translate the new line instead of removing it:
In Unix it is probably easier to use 'tr' command.
I got a text file originally generated on a Windows Machine by way of a Mac user and needed to import it into a Linux MySQL DB using the
load data
command.Although VIM displayed the '^M' character, none of the above worked for my particular problem, the data would import but was always corrupted in some way. The solution was pretty easy in the end (after much frustration).
Solution: Executing
dos2unix
TWICE on the same file did the trick! Using thefile
command shows what is happening along the way.And the final version of the file imported perfectly into the database.