Paul - The Programmer

simple & stupid

Detect file format is dos or unix

Detect file format with grep.

$ grep '^M'  your-file-name

^M is Ctrl-V + Ctrl-M. If the grep returns any line, the file is in DOS format.

Detect file format with vim.

1) Open the file with vim.

2) Use the vim set command to show the file format.

:set ff?

The command returns fileformat=<dos/unix/mac> to indect current file format.

 

 

Hide Vim menu bar and tool bar

" Hide the menu bar

:set guioptions-=m

" Hide the tool bar

:set guioptions-=T

find & insert new line with VIM

:%s/$/\rthis is a new line/g

\r is the new line character in VIM.