Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddu_vim/deps.ts>op.smartindent

Dark deno-powered UI framework for neovim/Vim
Go to Latest
variable op.smartindent
import { op } from "https://deno.land/x/ddu_vim@v4.0.0/deps.ts";
const { smartindent } = op;

Do smart autoindenting when starting a new line. Works for C-like programs, but can also be used for other languages. 'cindent' does something like this, works better in most cases, but is more strict, see C-indenting. When 'cindent' is on or 'indentexpr' is set, setting 'si' has no effect. 'indentexpr' is a more advanced alternative. Normally 'autoindent' should also be on when using 'smartindent'. An indent is automatically inserted:

  • After a line ending in '{'.
  • After a line starting with a keyword from 'cinwords'.
  • Before a line starting with '}' (only with the "O" command). When typing '}' as the first character in a new line, that line is given the same indent as the matching '{'. When typing '#' as the first character in a new line, the indent for that line is removed, the '#' is put in the first column. The indent is restored for the next line. If you don't want this, use this mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H. When using the ">>" command, lines starting with '#' are not shifted right. NOTE: This option is reset when 'compatible' is set. This option is reset when 'paste' is set and restored when 'paste' is reset.

(default off)

type

LocalOption<boolean>