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:
1 parent
bf314a32f4
commit
cb8026d627
15 files changed
+619
-239
No files matched your search
@@ -5,6 +5,8 @@ package main
|
||||
// Expr = SetExpr
|
||||
// | SetLocalExpr
|
||||
// | MapExpr
|
||||
// | NMapExpr
|
||||
// | VMapExpr
|
||||
// | CMapExpr
|
||||
// | CmdExpr
|
||||
// | CallExpr
|
||||
@@ -17,6 +19,10 @@ package main
|
||||
//
|
||||
// MapExpr = 'map' <keys> Expr
|
||||
//
|
||||
// NMapExpr = 'nmap' <keys> Expr
|
||||
//
|
||||
// VMapExpr = 'vmap' <keys> Expr
|
||||
//
|
||||
// CMapExpr = 'cmap' <key> Expr
|
||||
//
|
||||
// CmdExpr = 'cmd' <name> Expr
|
||||
@@ -68,6 +74,20 @@ type mapExpr struct {
|
||||
|
||||
func (e *mapExpr) String() string { return fmt.Sprintf("map %s %s", e.keys, e.expr) }
|
||||
|
||||
type nmapExpr struct {
|
||||
keys string
|
||||
expr expr
|
||||
}
|
||||
|
||||
func (e *nmapExpr) String() string { return fmt.Sprintf("nmap %s %s", e.keys, e.expr) }
|
||||
|
||||
type vmapExpr struct {
|
||||
keys string
|
||||
expr expr
|
||||
}
|
||||
|
||||
func (e *vmapExpr) String() string { return fmt.Sprintf("vmap %s %s", e.keys, e.expr) }
|
||||
|
||||
type cmapExpr struct {
|
||||
key string
|
||||
expr expr
|
||||
@@ -225,6 +245,34 @@ func (p *parser) parseExpr() expr {
|
||||
}
|
||||
|
||||
result = &mapExpr{keys, expr}
|
||||
case "nmap":
|
||||
var expr expr
|
||||
|
||||
s.scan()
|
||||
keys := s.tok
|
||||
|
||||
s.scan()
|
||||
if s.typ != tokenSemicolon {
|
||||
expr = p.parseExpr()
|
||||
} else {
|
||||
s.scan()
|
||||
}
|
||||
|
||||
result = &nmapExpr{keys, expr}
|
||||
case "vmap":
|
||||
var expr expr
|
||||
|
||||
s.scan()
|
||||
keys := s.tok
|
||||
|
||||
s.scan()
|
||||
if s.typ != tokenSemicolon {
|
||||
expr = p.parseExpr()
|
||||
} else {
|
||||
s.scan()
|
||||
}
|
||||
|
||||
result = &vmapExpr{keys, expr}
|
||||
case "cmap":
|
||||
var expr expr
|
||||
|
||||
|
||||
Reference in new issue
Block a user