Skip to content
Kward Search API index

Module: Kward::PromptInterface::EditorAutoIndent

Included in:
Kward::PromptInterface
Defined in:
lib/kward/prompt_interface/editor/auto_indent.rb

Overview

Lightweight syntax-based auto-indent for the built-in composer file editor.

Constant Summary collapse

C_LIKE_INDENT_LANGUAGES =
%i[javascript typescript json css scss go rust java csharp c cpp swift kotlin].freeze
PUNCTUATION_INDENT_LANGUAGES =
(C_LIKE_INDENT_LANGUAGES + %i[ruby python shell lua html]).freeze
RUBY_INDENT_KEYWORDS =
%w[begin case class def do else elsif ensure for if module rescue unless until while].freeze
SHELL_INDENT_KEYWORDS =
%w[case do else elif if select then until while].freeze
PYTHON_INDENT_KEYWORDS =
%w[class def elif else except finally for if try while with].freeze
LUA_INDENT_KEYWORDS =
%w[do else elseif for function if repeat then while].freeze
SHELL_DEDENT_KEYWORDS =
%w[fi done esac].freeze
PUNCTUATION_PAIRS =
{ "}" => "{", "]" => "[", ")" => "(" }.freeze
EDITOR_TAB_SEQUENCES =
TerminalKeys::TAB
EDITOR_SHIFT_TAB_SEQUENCES =
TerminalKeys::SHIFT_TAB