6

I am using nano on files with long lines. How could I scroll the nano window horizontally?

Ex:

┌────────────┐
|Lorem ipsum |dolor sit amet, consectetur adipiscing elit, 
|sed do eiusm|od tempor incididunt ut labore et dolore magna aliqua. 
|Dolor sed vi|verra ipsum nunc aliquet bibendum enim.
|In massa tem|por nec feugiat. Nunc aliquet bibendum enim facilisis gravida. 
└────────────┘

I would like scrolling right side:

            ┌────────────┐
Lorem ipsum |dolor sit am|et, consectetur adipiscing elit, 
sed do eiusm|od tempor in|cididunt ut labore et dolore magna aliqua. 
Dolor sed vi|verra ipsum |nunc aliquet bibendum enim.
In massa tem|por nec feug|iat. Nunc aliquet bibendum enim facilisis gravida. 
            └────────────┘
2
  • 2
    +1, but I suspect the answer is "you can't", and the better answer is "use vim". (And the slightly less better answer is "use emacs". :p)
    – Sparhawk
    Jul 18, 2019 at 7:12
  • 2
    +1, also because I appreciate ASCII art ;)
    – dr_
    Jul 18, 2019 at 11:09

2 Answers 2

4

I'm pretty sure you cannot do that in nano. The closest you could get would be line wrapping, precisely "soft wrapping": Esc+$.

This will wrap lines so you could see them all on the screen.

Source: https://www.nano-editor.org/dist/v2.9/nano.html (search for --softwrap)

You could get this kind of behaviour with vim, though, the editor is more configurable. See: https://ddrscott.github.io/blog/2016/sidescroll/

0

Esc+$ wasn't working for me. Not sure if OS or shell matters (I'm on Mac using zsh) but I found something else that worked:

^+J for JUSTIFY. Not side-scrolling, but since OP accepted soft-wrapping and I believe this does the same thing, leaving this answer here for people who don't have success with the accepted answer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .