6

So i've copied and pasted text from my browser, and when i hit j/k, it does not bring the cursor up/down single lines like it's supposed to:

COLLEYVILLE, Texas (AP) — The rabbi of a Texas synagogue where a gunman took hostages during livestreamed services said Monday that he threw a chair at his captor before escaping with two others after an hourslong standoff, crediting past security training for getting himself and his congregants out safely.

Rabbi Charlie Cytron-Walker told “CBS Mornings” that he let the gunman inside the suburban Fort Worth synagogue Saturday because he appeared to need shelter. He said the man was not threatening or suspicious at first. Later, he heard a gun click as he was praying.

Another man held hostage, Jeffrey R. Cohen, described the ordeal on Facebook on Monday.
ADVERTISEMENT

“First of all, we escaped. We weren’t released or freed,” said Cohen, who was one of four people in the synagogue for services that many other Congregation Beth Israel members were wat

instead, it hops from the first line of each paragraphs in both directions. Why is it doing this? Are there hidden ASCI characters in the page?

1

1 Answer 1

16

Vim is not really jumping paragraphs... These are actually really long lines.

The default behavior is for Vim to wrap long lines, so they might end up taking multiple lines in your screen, but they're really just long single lines.

You can tweak some settings to actually be able to see that more clearly. For example, you can use :set nowrap to have Vim stop wrapping long lines, which would show them as the long single lines they actually are. Navigating right would actually shift your screen in that direction.

Another option is to use :set number to show line numbers in the left margin, which would actually show you the line number only on screen lines where an actual line is starting, which also makes it pretty visible that line wrapping is what's happening here.

You might also like to learn about the gj and gk commands, which will navigate down and up in screen lines and can be pretty helpful to navigate these very long lines when there's wrapping.

6
  • 2
    yes, ":set number" is very useful also. Is there a way to configure vim just to be like that? Jan 18 at 1:58
  • Just add that command to your vimrc file, typically ~/.vimrc on Linux/MacOS or %HOME%\_vimrc on Windows. On your vimrc file, you can omit the initial :, though it still works fine if you keep it around. See also :help vimrc for more details.
    – filbranden
    Jan 18 at 2:52
  • i'm using fedora and it sure ain't in the home folder, help should tell me what to do though, maybe man vim also works Jan 18 at 3:25
  • 1
    you have to create the .vimrc file nowadays as i found from stack overflow, but yes just enter in the command and it words, now every doc i have opens with line numbers down the side Jan 18 at 3:40
  • 1
    I have these lines in my ~/.vimrc so I can use the up and down arrow keys to move by screen lines: noremap <Up> gk inoremap <Up> <C-o>gk noremap <Down> gj inoremap <Down> <C-o>gj
    – Nefrubyr
    Jan 18 at 11:33

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.