elixir-editors / vim-elixir

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

Indent not working #486

Closed khipukamayuq closed 5 years ago

khipukamayuq commented 5 years ago

Filing a bug? Have you already tried updating vim-elixir? For indentation/highlighting bugs, please use the following template:

Actual

defmodule Indent do
def hello do
"world"
end
end

Expected

defmodule Indent do
  def hello do
    "world"
  end
end

Pretty new to vim. Using Vim 8's built-in plugin manager. I have nerdtree, nerdtree-git-plugin, vim-airline, vim-elixir, and vim-mix-format plugins installed. My .vimrc is still super minimal:

 " allows closing vim when NERDTree is only window left open
  1 autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  2 
  3 set nu " show line numbers
  4 set relativenumber " show relative line numbers
  5 
  6 inoremap jk <ESC>
  7 
  8 let mapleader="<Space>"

Poked around in some of the plugin files, but don't quite grasp much of vimL at this point. Any help appreciated.

jbodah commented 5 years ago

You need to set filetype plugin indent on in your vimrc. Let me know if that fixes it for you

Here's the vimrc we use for testing (it has a few hacks which are specific to the tests to work properly): https://github.com/elixir-editors/vim-elixir/blob/master/spec/spec_helper.rb#L249-L252

khipukamayuq commented 5 years ago

@jbodah that was it. Thanks so much!

More generally: Looked again at vim-elixir install instructions to make sure I didn't just overlook this. Did not see it. Am I missing a proper understanding of how to implement plugin features in vim? The syntax highlighting just worked out of the box. Where in plugin files should I be looking to find which features require this additional configuration step?

jbodah commented 5 years ago

It's not there, but it should be (I believe it was omitted simply because most people run into this issue immediately with any plugin-based indent). That should be the only config needed (the syntax/indent tests pass without anything else)

jbodah commented 5 years ago

Just to follow up for completion's sake after some info I found - filetype plugin indent on (and set nocompatible) should not be necessary for modern vims (vim8, neovim)

khipukamayuq commented 5 years ago

Interesting that my indent only worked after adding filetype plugin indent on. I do no have set nocompatible in my .vimrc. I'm in vim 8.0.