<commit_before>package edit

import (
	"errors"
	"fmt"
	"strings"

	"github.com/elves/elvish/eval"
)

var keyBindings = map[bufferMode]map[Key]string{
	modeCommand: map[Key]string{
		Key{'i', 0}:    "start-insert",
		Key{'h', 0}:    "move-dot-left",
		Key{'l', 0}:    "move-dot-right",
		Key{'D', 0}:    "kill-line-right",
		DefaultBinding: "default-command",
	},
	modeInsert: map[Key]string{
		Key{'[', Ctrl}:    "start-command",
		Key{'U', Ctrl}:    "kill-line-left",
		Key{'K', Ctrl}:    "kill-line-right",
		Key{'W', Ctrl}:    "kill-word-left",
		Key{Backspace, 0}: "kill-rune-left",
		// Some terminal send ^H on backspace
		Key{'H', Ctrl}:  "kill-rune-left",
		Key{Delete, 0}:  "kill-rune-right",
		Key{Left, 0}:    "move-dot-left",
		Key{Right, 0}:   "move-dot-right",
		Key{Up, 0}:      "move-dot-up",
		Key{Down, 0}:    "move-dot-down",
		Key{Enter, Alt}: "insert-key",
		Key{Enter, 0}:   "return-line",
		Key{'D', Ctrl}:  "return-eof",
		Key{Tab, 0}:     "start-completion",
		Key{PageUp, 0}:  "start-history",
		Key{'N', Ctrl}:  "start-navigation",
		DefaultBinding:  "default-insert",
	},
	modeCompletion: map[Key]string{
		Key{'[', Ctrl}: "cancel-completion",
		Key{Up, 0}:     "select-cand-up",
		Key{Down, 0}:   "select-cand-down",
		Key{Left, 0}:   "select-cand-left",
		Key{Right, 0}:  "select-cand-right",
		// Key{Tab, 0}:    "cycle-cand-right",
		DefaultBinding: "default-completion",
	},
	modeNavigation: map[Key]string{
		Key{Up, 0}:     "select-nav-up",
		Key{Down, 0}:   "select-nav-down",
		Key{Left, 0}:   "ascend-nav",
		Key{Right, 0}:  "descend-nav",
		DefaultBinding: "default-navigation",
	},
	modeHistory: map[Key]string{
		Key{'[', Ctrl}:   "start-insert",
		Key{PageUp, 0}:   "select-history-prev",
		Key{PageDown, 0}: "select-history-next",
		DefaultBinding:   "default-history",
	},
}

var (<commit_msg>Use up/down for history in default binding.<commit_after>package edit

import (
	"errors"
	"fmt"
	"strings"

	"github.com/elves/elvish/eval"
)

var keyBindings = map[bufferMode]map[Key]string{
	modeCommand: map[Key]string{
		Key{'i', 0}:    "start-insert",
		Key{'h', 0}:    "move-dot-left",
		Key{'l', 0}:    "move-dot-right",
		Key{'D', 0}:    "kill-line-right",
		DefaultBinding: "default-command",
	},
	modeInsert: map[Key]string{
		Key{'[', Ctrl}:    "start-command",
		Key{'U', Ctrl}:    "kill-line-left",
		Key{'K', Ctrl}:    "kill-line-right",
		Key{'W', Ctrl}:    "kill-word-left",
		Key{Backspace, 0}: "kill-rune-left",
		// Some terminal send ^H on backspace
		Key{'H', Ctrl}:  "kill-rune-left",
		Key{Delete, 0}:  "kill-rune-right",
		Key{Left, 0}:    "move-dot-left",
		Key{Right, 0}:   "move-dot-right",
		Key{Up, Alt}:    "move-dot-up",
		Key{Down, Alt}:  "move-dot-down",
		Key{Enter, Alt}: "insert-key",
		Key{Enter, 0}:   "return-line",
		Key{'D', Ctrl}:  "return-eof",
		Key{Tab, 0}:     "start-completion",
		Key{Up, 0}:      "start-history",
		Key{'N', Ctrl}:  "start-navigation",
		DefaultBinding:  "default-insert",
	},
	modeCompletion: map[Key]string{
		Key{'[', Ctrl}: "cancel-completion",
		Key{Up, 0}:     "select-cand-up",
		Key{Down, 0}:   "select-cand-down",
		Key{Left, 0}:   "select-cand-left",
		Key{Right, 0}:  "select-cand-right",
		// Key{Tab, 0}:    "cycle-cand-right",
		DefaultBinding: "default-completion",
	},
	modeNavigation: map[Key]string{
		Key{Up, 0}:     "select-nav-up",
		Key{Down, 0}:   "select-nav-down",
		Key{Left, 0}:   "ascend-nav",
		Key{Right, 0}:  "descend-nav",
		DefaultBinding: "default-navigation",
	},
	modeHistory: map[Key]string{
		Key{'[', Ctrl}: "start-insert",
		Key{Up, 0}:     "select-history-prev",
		Key{Down, 0}:   "select-history-next",
		DefaultBinding: "default-history",
	},
}

var (
{'fraction_non_alphanumeric': 0.22120064899945915, 'fraction_numerical': 0.012439156300703082, 'mean_word_length': 3.6528301886792454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1397583', 'n_tokens_mistral': 1629, 'n_tokens_neox': 1473, 'n_words': 284}