Geek Culture
Published in

Geek Culture

Usefull Memo For Vim

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?

 by the author.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Maciej

Maciej

623 Followers

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