change CR+LF(Windows) to LF(UNIX)

可以使用VIM命令行,快速实现

 

例如:

 file test.txt
test.txt: ASCII text, with CRLF line terminators

执行命令

vim -c ":w ++ff=unix" -c "q" test.txt

 file test.txt
test.txt: ASCII text

 

来源:https://stackoverflow.com/questions/13522599/how-to-run-vim-commands-from-terminal

 

Use

vim --cmd 'Command launched before vimrc' \
     -c 'Command launched after vimrc' \
     -c 'qa!' # Quit vim

. For running a command in an existing vim session you have to use +clientserver feature: run one vim with

vim --servername vim

and others with

vim --remote-send '<C-\><C-n>:Command<CR>'

posted @ 2024-07-29 17:08  profesor  阅读(12)  评论(0编辑  收藏  举报