mirror of
https://gitea.blesmrt.net/mikaela/shell-things.git
synced 2025-02-16 13:30:57 +01:00
vimrc: convert to UNIX line endings automatically.
This commit is contained in:
parent
0c9b8117ef
commit
3362a57f92
32
vimrc
32
vimrc
@ -6,14 +6,14 @@ set nocompatible
|
|||||||
" Show syntax colours
|
" Show syntax colours
|
||||||
syntax on
|
syntax on
|
||||||
|
|
||||||
set showcmd " Show (partial) command in status line.
|
set showcmd " Show (partial) command in status line.
|
||||||
set showmatch " Show matching brackets.
|
set showmatch " Show matching brackets.
|
||||||
set ignorecase " Do case insensitive matching
|
set ignorecase " Do case insensitive matching
|
||||||
set smartcase " Do smart case matching
|
set smartcase " Do smart case matching
|
||||||
"set incsearch " Incremental search
|
"set incsearch " Incremental search
|
||||||
set autowrite " Automatically save before commands like :next and :make
|
set autowrite " Automatically save before commands like :next and :make
|
||||||
set hidden " Hide buffers when they are abandoned
|
set hidden " Hide buffers when they are abandoned
|
||||||
"set mouse=a " Enable mouse usage (all modes)
|
"set mouse=a " Enable mouse usage (all modes)
|
||||||
|
|
||||||
" Source a global configuration file if available
|
" Source a global configuration file if available
|
||||||
if filereadable("/etc/vim/vimrc.local")
|
if filereadable("/etc/vim/vimrc.local")
|
||||||
@ -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…
x
Reference in New Issue
Block a user