<commit_before>/*
 * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
 * Copyright (C) 2003-2020 The IdeaVim authors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 */

package com.maddyhome.idea.vim.option

import com.intellij.codeInsight.lookup.LookupEvent
import com.intellij.codeInsight.lookup.LookupListener
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.codeInsight.lookup.impl.LookupImpl
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.diagnostic.debug
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.ex.ExOutputModel
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.MessageHelper
import com.maddyhome.idea.vim.helper.Msg
import com.maddyhome.idea.vim.helper.hasVisualSelection
import com.maddyhome.idea.vim.helper.isBlockCaret
import com.maddyhome.idea.vim.helper.mode
import com.maddyhome.idea.vim.helper.subMode
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor
import org.jetbrains.annotations.Contract
import org.jetbrains.annotations.NonNls
import java.util.*
import kotlin.math.ceil
import kotlin.math.min

@Suppress("unused")
object OptionsManager {
  private val logger = Logger.getInstance(OptionsManager::class.java)

  private val options: MutableMap<String, Option<*>> = mutableMapOf()
  private val abbrevs: MutableMap<String, Option<*>> = mutableMapOf()

  val clipboard = addOption(ListOption(ClipboardOptionsData.name, ClipboardOptionsData.abbr, arrayOf(ClipboardOptionsData.ideaput, "autoselect,exclude:cons\\|linux"), null))
  val digraph = addOption(ToggleOption("digraph", "dg", false))
  val gdefault = addOption(ToggleOption("gdefault", "gd", false))
  val history = addOption(NumberOption("history", "hi", 20, 1, Int.MAX_VALUE))
  val hlsearch = addOption(ToggleOption("hlsearch", "hls", false))
  val ideamarks = addOption(IdeaMarkskOptionsData.option)
  val ignorecase = addOption(ToggleOption(IgnoreCaseOptionsData.name, IgnoreCaseOptionsData.abbr, false))
  val incsearch = addOption(ToggleOption("incsearch", "is", false))
  val iskeyword = addOption(KeywordOption("iskeyword", "isk", arrayOf("@", "48-57", "_")))
  val keymodel = addOption(KeyModelOptionData.option)
  val lookupKeys = addOption(ListOption(LookupKeysData.name, LookupKeysData.name, LookupKeysData.defaultValues, null))
  val matchpairs = addOption(ListOption("matchpairs", "mps", arrayOf("(:)", "{:}", "[:]"), ".:."))
  val more = addOption(ToggleOption("more", "more", true))
  val nrformats = addOption(BoundListOption("nrformats", "nf", arrayOf("hex"), arrayOf("octal", "hex", "alpha"))) // Octal is disabled as in neovim
  val number = addOption(ToggleOption("number", "nu", false))
  val relativenumber = addOption(ToggleOption("relativenumber", "rnu", false))
  val scroll = addOption(NumberOption("scroll", "scr", 0))
  val scrolljump = addOption(NumberOption(ScrollJumpData.name, "sj", 1, -100, Integer.MAX_VALUE))
  val scrolloff = addOption(NumberOption(ScrollOffData.name, "so", 0))
  val selection = addOption(BoundStringOption("selection", "sel", "inclusive", arrayOf("old", "inclusive", "exclusive")))
  val selectmode = addOption(SelectModeOptionData.option)
  val showcmd = addOption(ToggleOption("showcmd", "sc", true))  // Vim: Off by default on platforms with possibly slow tty. On by default elsewhere.
  val showmode = addOption(ToggleOption("showmode", "smd", false))
  val sidescroll = addOption(NumberOption("sidescroll", "ss", 0))
  val sidescrolloff = addOption(NumberOption("sidescrolloff", "siso", 0))
  val smartcase = addOption(ToggleOption(SmartCaseOptionsData.name, SmartCaseOptionsData.abbr, false))
  val ideajoin = addOption(IdeaJoinOptionsData.option)
  val timeout = addOption(ToggleOption("timeout", "to", true))
  val timeoutlen = addOption(NumberOption("timeoutlen", "tm", 1000, -1, Int.MAX_VALUE))
  val undolevels = addOption(NumberOption("undolevels", "ul", 1000, -1, Int.MAX_VALUE))<commit_msg>Update default for history to match Vim<commit_after>/*
 * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
 * Copyright (C) 2003-2020 The IdeaVim authors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 */

package com.maddyhome.idea.vim.option

import com.intellij.codeInsight.lookup.LookupEvent
import com.intellij.codeInsight.lookup.LookupListener
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.codeInsight.lookup.impl.LookupImpl
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.diagnostic.debug
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.ex.ExOutputModel
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.MessageHelper
import com.maddyhome.idea.vim.helper.Msg
import com.maddyhome.idea.vim.helper.hasVisualSelection
import com.maddyhome.idea.vim.helper.isBlockCaret
import com.maddyhome.idea.vim.helper.mode
import com.maddyhome.idea.vim.helper.subMode
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor
import org.jetbrains.annotations.Contract
import org.jetbrains.annotations.NonNls
import java.util.*
import kotlin.math.ceil
import kotlin.math.min

@Suppress("unused")
object OptionsManager {
  private val logger = Logger.getInstance(OptionsManager::class.java)

  private val options: MutableMap<String, Option<*>> = mutableMapOf()
  private val abbrevs: MutableMap<String, Option<*>> = mutableMapOf()

  val clipboard = addOption(ListOption(ClipboardOptionsData.name, ClipboardOptionsData.abbr, arrayOf(ClipboardOptionsData.ideaput, "autoselect,exclude:cons\\|linux"), null))
  val digraph = addOption(ToggleOption("digraph", "dg", false))
  val gdefault = addOption(ToggleOption("gdefault", "gd", false))
  val history = addOption(NumberOption("history", "hi", 50, 1, Int.MAX_VALUE))
  val hlsearch = addOption(ToggleOption("hlsearch", "hls", false))
  val ideamarks = addOption(IdeaMarkskOptionsData.option)
  val ignorecase = addOption(ToggleOption(IgnoreCaseOptionsData.name, IgnoreCaseOptionsData.abbr, false))
  val incsearch = addOption(ToggleOption("incsearch", "is", false))
  val iskeyword = addOption(KeywordOption("iskeyword", "isk", arrayOf("@", "48-57", "_")))
  val keymodel = addOption(KeyModelOptionData.option)
  val lookupKeys = addOption(ListOption(LookupKeysData.name, LookupKeysData.name, LookupKeysData.defaultValues, null))
  val matchpairs = addOption(ListOption("matchpairs", "mps", arrayOf("(:)", "{:}", "[:]"), ".:."))
  val more = addOption(ToggleOption("more", "more", true))
  val nrformats = addOption(BoundListOption("nrformats", "nf", arrayOf("hex"), arrayOf("octal", "hex", "alpha"))) // Octal is disabled as in neovim
  val number = addOption(ToggleOption("number", "nu", false))
  val relativenumber = addOption(ToggleOption("relativenumber", "rnu", false))
  val scroll = addOption(NumberOption("scroll", "scr", 0))
  val scrolljump = addOption(NumberOption(ScrollJumpData.name, "sj", 1, -100, Integer.MAX_VALUE))
  val scrolloff = addOption(NumberOption(ScrollOffData.name, "so", 0))
  val selection = addOption(BoundStringOption("selection", "sel", "inclusive", arrayOf("old", "inclusive", "exclusive")))
  val selectmode = addOption(SelectModeOptionData.option)
  val showcmd = addOption(ToggleOption("showcmd", "sc", true))  // Vim: Off by default on platforms with possibly slow tty. On by default elsewhere.
  val showmode = addOption(ToggleOption("showmode", "smd", false))
  val sidescroll = addOption(NumberOption("sidescroll", "ss", 0))
  val sidescrolloff = addOption(NumberOption("sidescrolloff", "siso", 0))
  val smartcase = addOption(ToggleOption(SmartCaseOptionsData.name, SmartCaseOptionsData.abbr, false))
  val ideajoin = addOption(IdeaJoinOptionsData.option)
  val timeout = addOption(ToggleOption("timeout", "to", true))
  val timeoutlen = addOption(NumberOption("timeoutlen", "tm", 1000, -1, Int.MAX_VALUE))
  val undolevels = addOption(NumberOption("undolevels", "ul", 1000, -1, Int.MAX_VALUE))
{'fraction_non_alphanumeric': 0.12208067940552017, 'fraction_numerical': 0.007218683651804671, 'mean_word_length': 6.120937263794406, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1455995', 'n_tokens_mistral': 2974, 'n_tokens_neox': 2875, 'n_words': 731}