mirror of
https://gitea.blesmrt.net/mikaela/shell-things.git
synced 2024-11-25 20:59:23 +01:00
vimrc: convert to UNIX line endings automatically.
This commit is contained in:
parent
0c9b8117ef
commit
3362a57f92
18
vimrc
18
vimrc
@ -102,3 +102,21 @@ autocmd BufReadPost *
|
|||||||
if has("autocmd")
|
if has("autocmd")
|
||||||
au BufReadPost * if &modifiable | retab | endif
|
au BufReadPost * if &modifiable | retab | endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" dos2unix ^M copied from http://stackoverflow.com/a/5361702/1675649
|
||||||
|
fun! Dos2unixFunction()
|
||||||
|
let _s=@/
|
||||||
|
let l = line(".")
|
||||||
|
let c = col(".")
|
||||||
|
try
|
||||||
|
set ff=unix
|
||||||
|
w!
|
||||||
|
"%s/\%x0d$//e
|
||||||
|
catch /E32:/
|
||||||
|
echo "Sorry, the file is not saved."
|
||||||
|
endtry
|
||||||
|
let @/=_s
|
||||||
|
call cursor(l, c)
|
||||||
|
endfun
|
||||||
|
com! Dos2Unix keepjumps call Dos2unixFunction()
|
||||||
|
au BufReadPost * keepjumps call Dos2unixFunction()
|
||||||
|
Loading…
Reference in New Issue
Block a user