elixir-editors / vim-elixir

Vim configuration files for Elixir
http://elixir-lang.org/
Other
1.31k stars 153 forks source link

New lines are not being indented inside parentheses #151

Closed dantswain closed 8 years ago

dantswain commented 8 years ago

This could be intended behavior, but I don't think so? This is what I am getting:

defmodule Sample do
  def add(x, y) do
    x + y
  end

  def double(x) do
    add(x,
    y)
  end
end

Note the

add(x,
y)

I would expect y) to be indented - either a fixed number of spaces or (personal preference) aligned with the arguments on the previous line.

It could be that I have a setting in my vimrc that is clobbering this, but I've had no luck finding it.

dantswain commented 8 years ago

It looks like cino/cinoptions should control this, but it doesn't seem to work in the Elixir plugin for me: http://vimdoc.sourceforge.net/htmldoc/indent.html#cinoptions-values

dantswain commented 8 years ago

@kassio I'm now getting a single space indent:

defmodule Sample do
  def add(x, y) do
    x + y
  end

  def double(x) do
    add(x,
     y)
  end
end
kassio commented 8 years ago

@dantswain one question, why don't you use like:

defmodule Sample do
  def add(x, y) do
    x + y
  end

  def double(x) do
    add(
      x,
      y
    )
  end
end

My personal flavor. 😄

dantswain commented 8 years ago

That does work for me. It still seems weird that I would get a single space, and ideally I think it should honor cinoptions?

dantswain commented 8 years ago

I'm also now running into this:

defmodule Sample do
  defstruct([
    foo: nil
  ])
alias Foo.Bar

  def add(x, y) do
    x + y
  end

  def double(x) do
    add(
      x,
      y
    )
  end
end
kassio commented 8 years ago

I tried cinoptions, but it wasn't the bug. The counter of opening/closing symbols set this space, I'm not sure why.

kassio commented 8 years ago

This last example's a real problem. I'll work on that ASAP.