Stop git from changing line endings on Windows and add support for editorconfig in vim
This commit is contained in:
parent
4464e4f681
commit
28c88ca5f1
21
.editorconfig
Normal file
21
.editorconfig
Normal file
|
@ -0,0 +1,21 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles # between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.bat]
|
||||
end_of_line = crlf
|
||||
|
||||
[*.tsv]
|
||||
indent_style = tab
|
||||
|
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# All text files will have LF line endings, except batch files.
|
||||
* text=auto
|
||||
|
||||
# Preserve crlf in batch files when checking in.
|
||||
*.bat text eol=crlf
|
|
@ -1,5 +1,14 @@
|
|||
[code]
|
||||
editor = vim
|
||||
[core]
|
||||
# Don't change LF line endings and if a CRLF is found then change it to LF on a commit.
|
||||
autocrlf = input
|
||||
# Don't change any line endings. That means if a file has CRLF line endings
|
||||
# the carriage return will stay. I'm only worknig with LF line endings on
|
||||
# Windows now except for .bat files which are forced to have CRLF via
|
||||
# per-project editorconfig and gitattribute files. I want those files to
|
||||
# still have CRLFs when modified on Linux.
|
||||
#
|
||||
# I used these posts for reference:
|
||||
# https://markentier.tech/posts/2021/10/autocrlf-true-considered-harmful/
|
||||
# https://troyready.com/blog/git-windows-dont-convert-line-endings.html
|
||||
#
|
||||
autocrlf = false
|
||||
|
|
6
vimrc
6
vimrc
|
@ -213,6 +213,7 @@ Plug 'vim-scripts/AnsiEsc.vim' " Ansi escape sequences concealed, but hig
|
|||
Plug 'sir-pinecone/errormarker.vim' " Build error highlighting (requires skywind3000/asyncrun.vim).
|
||||
Plug 'skywind3000/asyncrun.vim' " Async commands.
|
||||
Plug 'nelstrom/vim-qargs' " For the GlobalReplaceIt function (i.e. search and replace).
|
||||
Plug 'editorconfig/editorconfig-vim' " Adds support for .editorconfig files.
|
||||
|
||||
if IsWindows()
|
||||
Plug 'suxpert/vimcaps' " Disable capslock (useful if the OS isn't configured to do so).
|
||||
|
@ -722,6 +723,11 @@ inoremap <s-tab> <c-n>
|
|||
let g:localvimrc_sandbox = 0
|
||||
let g:localvimrc_ask = 0
|
||||
|
||||
"##################################################################################
|
||||
" EDITOR CONFIG
|
||||
"##################################################################################
|
||||
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
|
||||
|
||||
"##################################################################################
|
||||
" LION (TEXT ALIGNMENT)
|
||||
"##################################################################################
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
[code]
|
||||
editor = /usr/bin/vim
|
||||
[core]
|
||||
# Convert unix LF to Windows CRLF when checking out and vice-versa when adding files to the index.
|
||||
autocrlf = true
|
||||
# I used to have this set to true, which would result in checked out files
|
||||
# being converted to CRLF line endings and commits converting to LF. I'm
|
||||
# tired of this conversion shit though so I'm turning it off and will be
|
||||
# enforcing LF line endings via a combination of editorconfig and
|
||||
# gitattribute files on a per-project basis. This should make sure that
|
||||
# anyone contributing to my projects will be committing LF line endings.
|
||||
# The only exception is that the gitattributes files will commit batch
|
||||
# files with CRLF to avoid Windows glitches.
|
||||
#
|
||||
# I used these posts for reference:
|
||||
# https://markentier.tech/posts/2021/10/autocrlf-true-considered-harmful/
|
||||
# https://troyready.com/blog/git-windows-dont-convert-line-endings.html
|
||||
#
|
||||
autocrlf = false
|
||||
|
|
Loading…
Reference in New Issue
Block a user