Closed fekir closed 1 year ago
Probably, you are using Vim on WSL that is sharing ~/.vim
with Windows? And probably you clone the repository on Windows. Right? Then, you should not set autocrlf=true in your .gitconfig.
No, I'm not using WSL. I've cloned the repo with git-for-windows:
> git config core.autocrlf
false
> git clone https://github.com/prabirshrestha/asyncomplete.vim.git
[...]
> file asyncomplete.vim/plugin/asyncomplete.vim
asyncomplete.vim/plugin/asyncomplete.vim: ASCII text, with CRLF line terminators
I have explicitly set autocrlf = false
in my git configuration, but this decision is overridden by .gitattibutes
.
Instead of deleting the .gitattibutes
, you might want to consider setting * text=auto eol=lf
...
What do you get with?
$ wget https://raw.githubusercontent.com/prabirshrestha/asyncomplete.vim/master/autoload/asyncomplete.vim
$ file asyncomplete.vim
$ wget https://raw.githubusercontent.com/prabirshrestha/asyncomplete.vim/master/autoload/asyncomplete.vim
$ file asyncomplete.vim
asyncomplete.vim: ASCII text
Note that I also have lf
line terminators if I clone the repository with WSL.
It is a windows-specific "feature" that text files have crlf line terminator, and git-for-windows is honoring that convention with the given .gitattributes
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@mattn considering the fact that the issue is trivial to fix could you revert what the bot decided?
Do you need other information?
Pleaes try this solution https://stackoverflow.com/questions/2517190/how-do-i-force-git-to-use-lf-instead-of-crlf-under-windows/33424884#33424884
Anyway, this is not an issue of vim-lsp.
At least, AFAIK, you must not set * text=auto
I think there are two issues:
* text=auto
setting.
This setting is only useful if someone wants to checkout a file in CRLF on Windows and LF on other systems. Nowadays, Windows Notepad supports both CRLF and LF. Only a few filetypes like batch files and VisualStudio project files need to be in CRLF. Of course, no need to checkout vim files in CRLF. So, I don't think that this setting is needed.E488: Trailing characters: ^M
error.
This is most likely a setup issue. This can happen when someone try to source a CRLF vim file into Vim on a unix-like system. Here "unix-like" includes Vim in WSL, Cygwin, MSYS2, and Git for Windows.
If you use Vim on a unix-like system, you should use Git on that system. (Vim in Git for Windows is an exception, though.)@mattn I think we are talking past each other.
I've already configured git not to make any conversion, but the .gitattibutes
file that is checked in overwrites any configuration.
* text=auto
is not set by me, it is set in this repository, and leads to the described error.
@prabirshrestha What reason for adding * text=auto
?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Ping
On Windows, when starting vim, I have following error/warning:
The root cause seems to be the
.gitattibutes
file, that contains* text=auto
. Simply deleting it fixes the issue.I cannot even override the settings by setting globally in git
and since vim wants config files with lf as line-ending, I do not think there are many use-cases for setting line endings conversions.