moe icon indicating copy to clipboard operation
moe copied to clipboard

Enhance Autoindent

Open uninhm opened this issue 3 years ago • 4 comments

Auto indent the next line when:

  • The line is var, let or const
  • The line finishes with or, and or object
  • The instruction isn't complete (eg: Parenthesis aren't closed)

And this: (<> represents the indentation, | the cursor)

fn main() {|}

<Return>

fn main() {
<>|
}

or

echo someFunc(|)

<Return>

echo someFunc(
<>|
)

See https://github.com/zah/nim.vim

uninhm avatar Jul 24 '20 21:07 uninhm

  1. Implement the same you did for {} but for () and [] 1.1) Edit: I saw you did it for other languages but not for Nim
  2. Indent when defining a function/procedure: proc a() =<return>

uninhm avatar Jul 20 '21 17:07 uninhm

@uninhm

Thank you for your feedback. I will fix them.

fox0430 avatar Jul 20 '21 20:07 fox0430

https://github.com/fox0430/moe/blob/develop/src/moepkg/editor.nim#L289

My question is, why not? It's not LISP...

At least in Python I'm pretty sure that the "standard" style is

function(
    arg1,
    arg2
)

(with a new line after the last parameter)

uninhm avatar Dec 25 '21 22:12 uninhm

@uninhm

Thank you for the advice. I don't use Python. Ok, I will fix it.

fox0430 avatar Dec 26 '21 18:12 fox0430