Sunday, February 16, 2020

Pressing Enter removes indentation

If I have a file "a.js" like this:

let a1 = [
];

and I press Enter at the end of the first line, a Tab is inserted. I do not
want this. I added setting "filetype indent off", but then if I have this:

let a1 = [
10,
20
];

I have to manually add tabs for each item. So I added another setting
"set autoindent". These two settings solve the existing problems, but introduce
a new problem. If I move the cursor to the start of one of the indented lines,
and press Enter, the indentation is removed.

Another option is to use "set smartindent", and redo the second example.
However after I press Enter, if I then press Up or Down, the indentation is
removed, repeating the problem. Can I change a setting to resolve this issue?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/5e49fc0e.1c69fb81.f1d79.d06c%40mx.google.com.

No comments:

Post a Comment