StanAngeloff / php.vim

An up-to-date Vim syntax for PHP (7.x supported)
477 stars 69 forks source link

Indentation doesn't work when syntax is off #61

Closed wayneashleyberry closed 8 years ago

wayneashleyberry commented 8 years ago

I thought this might be a vim limitation, but when I have syntax off indentation works fine for javascript and Go.

With syntax off, indentation using the = key or using o to enter a new line doesn't indent at all.

StanAngeloff commented 8 years ago

How can I reproduce this? Did you turn syntax off with :syntax off<CR>?

What use case do you have for preserving indentation, but turning the syntax off?

wayneashleyberry commented 8 years ago

Yeah, by default my syntax is on... I used :syntax off to disable it. My use case is that I'm starting to leave syntax off in terminal vim for performance reasons. This really wouldn't bother me if not for finding other languages seem to work fine.

If you consider the following code:

<?php

function test() {
}

When my cursor is over function and I hit o, with syntax on my cursor moves here:

function test() {
    |
}

After disabling syntax and trying the same thing my cursor moves here:

function test() {
|
}

If I turn syntax back on and try again it works as expected and indents the cursor.

StanAngeloff commented 8 years ago

There isn't anything in this plug-in that relates to indentation. There are various hooks for folding. I wonder if another Vim built-in plugin relies on syntax groups being defined to perform the indentation?

EDIT: Looks like this is the case.

wayneashleyberry commented 8 years ago

That's it @StanAngeloff! I'll add an issue over there - thanks :)