Skip to content

Recreate electric-newline-and-maybe-indent #4

@bearylabs

Description

@bearylabs

Recreate the Emacs electric-newline-and-maybe-indent feature:

  • Insert a newline and, if auto-indent is off, also indent based on filetype/language.
  • Keybindings (VSCode/Vim equivalents):
    • <Shift+Enter>
    • <Ctrl+j>

Doom Help:

electric-newline-and-maybe-indent is an interactive and natively
compiled function defined in electric.el.gz.

Signature
(electric-newline-and-maybe-indent)

Documentation
Insert a newline.

If electric-indent-mode is enabled, that's that, but if it
is disabled then additionally indent according to major mode.
Indentation is done using the value of indent-line-function.
In programming language modes, this is the same as TAB.
In some text modes, where TAB inserts a tab, this command indents to the
column specified by the function current-left-margin.

Key Bindings
evil-insert-state-map S-
evil-insert-state-map S-RET
global-map C-j
help-quick-use-map C-j

Demos
[Add]

References
electric-newline-and-maybe-indent is unused in electric.el.gz.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions