LnL7 / vim-nix

Vim configuration files for Nix http://nixos.org/nix
MIT License
288 stars 26 forks source link

indent: don't do anything if current line is indented more then previous line #53

Closed Ma27 closed 1 year ago

Ma27 commented 1 year ago

Typical example

{
  attr = map
    f|
}

with | being the cursor. When entering , the code looks like this:

{
  attr = map
  f
  |
}

I.e. the (intentional) indentation of f was undone. This frequently happens because I indent a lot of expressions like this, for instance

map
  f
  xs

or

if cond
  then x1
  else x2

This has a few drawbacks, for instance bogus indentation now causes follow-up errors, e.g.

map
  f
  [
    1
      2
  ]|

on causes

map
  f
  [
    1
      2
    ]
    |

however, in that case the indent is already bogus.

Ma27 commented 1 year ago

cc @LnL7

Ma27 commented 1 year ago

This was a rather opinionated thing anyways and it doesn't do what I want it to do in all cases anyways, so I'm closing, sorry for the noise.