See line breaks and carriage returns in editor

Viewed 367888

Is there a text editor on Linux that allows me to see line breaks and carriage returns? Does Vim support this feature?

9 Answers

By using cat and -A you can see new lines as $ and tabs as ^I:

cat -A myfile

You can view break lines using the gedit editor.

First, if you don't have it installed, for Debian/Ubuntu/Mint based distros:

sudo apt-get install gedit

For Fedora/CentOS/RedHat based distros:

sudo dnf install gedit

or

sudo yum install gedit

Now, install gedit plugins:

sudo apt-get install gedit-plugins

or

Under Gnome2, user plugins were put into ~/.gnome2/gedit/plugins/
For Gnome3: ~/.local/share/gedit/plugins/

Download the plugins from: https://help.gnome.org/users/gedit/stable/gedit-plugin-guide.html.en#gedit-additional-plugins

and select Draw Spaces plugin, enter on Preferences, and chose Draw new lines:

Enter image description here

Enter image description here

Using Visual Studio Code, you can install the Line endings extension.

Sublime Text 3 has a plugin called RawLineEdit that will display line endings and allow the insertion of arbitrary line-ending type

Shift + Ctrl + P and start type the name of the plugin, and toggle to show line endings.

Add the following alias to your .bashrc or .bash_aliases:

alias vidos='vi  -c ":e ++ff=unix" -c "set list"'

Then you can use vidos to edit the file and see newline as $ and carriage return as ^M.

Related