Usefull Memo For Vim

Maciej
Geek Culture
Published in
Aug 24, 2022
Photo by David Travis on Unsplash

Check the newline code of the opened file

:set fileformat?
:se ff?

Visualization of line feed code

Display line feed code

:se list

Hide newline code

:se nolist

Specify line feed code to open

LF

:edit ++fileformat=unix

CRLF

:e ++ff=dos

CR

:e ++ff=mac

Specify line feed code

:se ff=dos
:se ff=mac
:se ff=unix

Remove line feed code

:%s/\r//g

Reopen the file with the specified character code

Reopen the file in UTF-8

#Option 1
:e ++enc=utf-8
#Option 2
:edit ++enc=utf-8

Save file with specified character code

Save the file in UTF-8

#Option 1
:set fileencoding=utf-8
#Option 2
:se fenc=utf-8

Check current encoding

Vim encoding

:se enc?

File encoding

:se fenc?

--

--

Maciej
Geek Culture

DevOps Consultant. I’m strongly focused on automation, security, and reliability.