Daniel
Daniel

Reputation: 16216

Vim - Weird Behaviour

I just recently deleted my .vimrc, and since I've added a few things back in and added some plugins I get this weird behaviour.

  1. I click 'i' to place me in insert mode.
  2. I type a character (any character)
  3. Suddenly I get a newline break right where I started typing.

Extremely annoying! :) Any ideas on what this might be?

Upvotes: 5

Views: 1496

Answers (8)

Rook
Rook

Reputation: 62528

You could post your vimfiles + vimrc somewhere so others can take a look at it, and maybe determine the source of an error.

Saying that there is an error, without giving any concrete data, never resulted in anything.

Use some paste site, and post your vimrc, and a list of plugins (usually people use pretty much the same ones ... from www.vim.org).

Upvotes: 0

David Terei
David Terei

Reputation: 2035

There are quite a few things it could be given how customisable Vim is. However I think it might be your setting of 'textwidth'.

From Vim Help:

'textwidth' can be set to the maximum width for a line. When a line becomes too long when appending characters a line break is automatically inserted.

So check what 'textwidth' is set to and either increase it, or set it to 0 to disable this feature.

If this doesn't work, then try what everyone else said of just commenting out all your settings, checking this fixes the issue. Then slowly enabling settings again. Maybe use a binary search :)

Upvotes: 4

João Marcus
João Marcus

Reputation: 1608

You could try using vim script debugging: "vim -D file". Then you could try to add some breakpoints, etc.

Link: Debugging Vim Scripts

Upvotes: 1

Nippysaurus
Nippysaurus

Reputation: 20378

comment out line after line of your .vimrc until it starts working as expected.

Upvotes: 1

stefanB
stefanB

Reputation: 79780

You could back up your .vimrc file, remove the original and start up vim then create new vimrc:

:mkvimrc

Then you can start adding stuff from your old one and see which setting introduces the problem.

Same with plugins, move all your (not system) plugins out of your plugins directory and add one by one and see which one introduces the problem.

Upvotes: 1

Alan Haggai Alavi
Alan Haggai Alavi

Reputation: 74202

This calls for setting files like .vimrc to be under source control.

Upvotes: 0

John Kugelman
John Kugelman

Reputation: 361565

Sanity check. What happens if you run as vim -C (compatibility mode, behave like plain vi) or vim -u NONE (don't load any initialization files or plugins)?

Upvotes: 6

Jay Atkinson
Jay Atkinson

Reputation: 3287

No, but you could start taking things out of your .vimrc one at a time and see if the problem goes away. Whatever was last removed, may have been the culprit (not always because it could be conflicting plugins).

Upvotes: 4

Related Questions