Add visual-mode (#2021)

- Add functionality for visually selecting files
- Add keymap for Visual mode, and supporting `nmap` and `vmap` commands
- Add mode column for `maps` command, also add `nmaps` and `vmaps` commands
- Add `visualfmt` option for configuring appearance for the visual selection
- Add `%m/%M` placeholders for displaying the mode
- Add marker indicating the number of visually selected files in the ruler
- Add `visual` as an identifier when exporting `lf_mode`
- Remove experimental `invert-below` command
This commit is contained in:
CatsDeservePets authored and GitHub committed 2025-07-05 11:33:45 +10:00
1 parent bf314a32f4
commit cb8026d627
15 files changed
+619 -239

No files matched your search

+9 -4
View File
@@ -14,6 +14,8 @@ var (
"set",
"setlocal",
"map",
"nmap",
"vmap",
"cmap",
"cmd",
"quit",
@@ -36,7 +38,6 @@ var (
"low",
"toggle",
"invert",
"invert-below",
"unselect",
"glob-select",
"glob-unselect",
@@ -110,6 +111,10 @@ var (
"cmd-capitalize-word",
"cmd-uppercase-word",
"cmd-lowercase-word",
"visual",
"visual-accept",
"visual-discard",
"visual-change",
}
gOptWords = getOptWords(gOpts)
@@ -329,7 +334,7 @@ func completeCmd(acc []rune) (matches []string, longestAcc []rune) {
case "set":
matches, longest = matchWord(f[1], gOptWords)
longestAcc = append(acc[:len(acc)-len([]rune(f[len(f)-1]))], longest...)
case "map", "cmap", "cmd":
case "map", "nmap", "vmap", "cmap", "cmd":
longestAcc = acc
default:
matches, longest = matchFile(f[len(f)-1])
@@ -340,7 +345,7 @@ func completeCmd(acc []rune) (matches []string, longestAcc []rune) {
case "setlocal":
matches, longest = matchWord(f[2], gLocalOptWords)
longestAcc = append(acc[:len(acc)-len([]rune(f[len(f)-1]))], longest...)
case "map", "cmap":
case "map", "nmap", "vmap", "cmap":
matches, longest = matchCmd(f[2])
longestAcc = append(acc[:len(acc)-len([]rune(f[len(f)-1]))], longest...)
case "addcustominfo":
@@ -351,7 +356,7 @@ func completeCmd(acc []rune) (matches []string, longestAcc []rune) {
}
default:
switch f[0] {
case "set", "setlocal", "map", "cmap", "cmd":
case "set", "setlocal", "map", "nmap", "vmap", "cmap", "cmd":
longestAcc = acc
default:
matches, longest = matchFile(f[len(f)-1])