1

I'm using nano editor to edit my server's config files. Now I've discovered that pasting in a few lines removes all line breaks of the pasted lines as well as the following lines! It then says I can UnJustify that again. What?! Is this Microsoft Word auto formatting?

How can I prevent this from happening ever again?

UnJustify doesn't work, it only restores part of the broken text, not all.

This is Ubuntu Server 16.04.

  • I mainly use servers and only use nano and have never seen your issue. I can only assume that, somehow, your nano sessions are defaulting to justify mode. Check /etc/nanorc and the files it might include, such as /usr/share/nano/*.nanorc. – Doug Smythies Apr 18 '17 at 22:13
  • @DougSmythies What would I be looking for in these files? I couldn't identify anything interesting. – ygoe Apr 22 '17 at 13:46
  • I don't know, I can not find such a setting either. I did find (this)[bugs.debian.org/cgi-bin/bugreport.cgi?bug=715288], but it has not been my experience. – Doug Smythies Apr 22 '17 at 14:37
  • 1
    That bug is exactly the issue! CR, LF corresponds to ^J, ^M. And ^J is a hotkey. Very unfortunately placed. For a unix system. Interestingly, the combination of ^J and ^M won't trigger justify. Heading over to nano now. – ygoe Apr 22 '17 at 18:38
  • I'm seeing this issue on Raspbian stretch. Very annoying to paste ssh keys. – Jaakko Jan 20 '18 at 11:46
0

Adding below to ~/.nanorc did the trick for me:

unbind ^J main

I think it breaks the justify, but I'm more than glad to give it for clean paste.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.