LnL7 / vim-nix

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

Lines starting with `#` break indentation #49

Open ppom0 opened 1 year ago

ppom0 commented 1 year ago

It seems like lines starting with # (either a nix comment or in a ''double apostrophe'' string, like a shebang for example) reset previous indentation.

{
    # bad indentation on this comment will propagate
    # to the next lines if typing `=i{`
  programs.fish.enable = true;
}

↓ (after typing =i{)

{
    # bad indentation on this comment will propagate
    # to the next lines if typing `=i{`
    programs.fish.enable = true;
  }

This makes it hard to apply the new indentation of a block, when surrounded by new {} for example.

qixiang-mft commented 1 year ago

same issue

hitsmaxft commented 1 year ago

I found it was effect by this code;

  " Skip indentation for single line comments explicitly, in case a
   " comment was just inserted (eg. visual block mode)
   if getline(v:lnum) =~ '^\s*#'
     return indent(v:lnum)
   endif

I 've commented that code , it seems works https://github.com/hitsmaxft/vim-nix/commit/7c5a324c76ce85e1501861adb68756f7966a57f7

AgrYpn1a commented 8 months ago

Any updates here? Has the fix been merged? I've installed the plugin directly from nix but I have the same problem.

bam80 commented 2 months ago

Ping?