diff --git a/client.go b/client.go index 8de32951..7d399245 100644 --- a/client.go +++ b/client.go @@ -68,7 +68,7 @@ func readExpr() <-chan expr { return ch } -func saveFiles(list []string, copy bool) error { +func saveFiles(list []string, cp bool) error { c, err := net.Dial(gSocketProt, gSocketPath) if err != nil { return fmt.Errorf("dialing to save files: %s", err) @@ -79,7 +79,7 @@ func saveFiles(list []string, copy bool) error { fmt.Fprintln(c, "save") - if copy { + if cp { fmt.Fprintln(c, "copy") } else { fmt.Fprintln(c, "move") @@ -93,7 +93,7 @@ func saveFiles(list []string, copy bool) error { return nil } -func loadFiles() (list []string, copy bool, err error) { +func loadFiles() (list []string, cp bool, err error) { c, e := net.Dial(gSocketProt, gSocketPath) if e != nil { err = fmt.Errorf("dialing to load files: %s", e) @@ -109,9 +109,9 @@ func loadFiles() (list []string, copy bool, err error) { switch s.Text() { case "copy": - copy = true + cp = true case "move": - copy = false + cp = false default: err = fmt.Errorf("unexpected option to copy file(s): %s", s.Text()) return diff --git a/complete.go b/complete.go index b65d3d66..e688b542 100644 --- a/complete.go +++ b/complete.go @@ -28,9 +28,9 @@ var ( "toggle", "invert", "unmark", - "yank", - "delete", - "put", + "copy", + "cut", + "paste", "clear", "draw", "redraw", diff --git a/doc.go b/doc.go index ee56ab54..942ee1b9 100644 --- a/doc.go +++ b/doc.go @@ -26,9 +26,9 @@ The following commands are provided by lf with default keybindings: toggle (default '') invert (default 'v') unmark (default 'u') - yank (default 'y') - delete (default 'd') - put (default 'p') + copy (default 'y') + cut (default 'd') + paste (default 'p') clear (default 'c') redraw (default '') reload (default '') @@ -46,7 +46,7 @@ The following commands are provided by lf without default keybindings: draw draw the ui load load modified files and directories - sync synchronizes yanked/deleted files with server + sync synchronizes copied/cut files with server echo prints its arguments to the message line cd changes working directory to its argument select changes current file selection to its argument @@ -463,19 +463,16 @@ should not be needed for users. File Operations lf uses the underlying 'cp' and 'mv' shell commands for file operations. For -this purpose, when you 'yank' (i.e. copy) a file, it doesn't actually copy the -file on the disk, but only records its name to memory. The actual file -operation takes place when you do the 'put' in which case the 'cp' command is -used. Similarly the 'mv' command is used for 'delete' (i.e. cut or kill) -followed by 'put'. These traditional names (e.g. 'yank', 'delete', and 'put') -are picked instead of the other common convention (e.g. copy and cut) to -resemble the default keybinds for these operations. +this purpose, when you 'copy' a file, it doesn't actually copy the file on the +disk, but only records its name to memory. The actual file operation takes +place when you 'paste' in which case the 'cp' command is used. Similarly the +'mv' command is used for 'cut' followed by 'paste'. -You can customize these operations by defining a 'put' command. This is a +You can customize these operations by defining a 'paste' command. This is a special command that is called when it is defined instead of the builtin implementation. The default behavior is similar to the following command: - cmd put ${{ + cmd paste ${{ load=$(lf -remote 'load') mode=$(echo "$load" | sed -n '1p') list=$(echo "$load" | sed '1d') diff --git a/docstring.go b/docstring.go index 01c1cb7c..a1ae728a 100644 --- a/docstring.go +++ b/docstring.go @@ -30,9 +30,9 @@ The following commands are provided by lf with default keybindings: toggle (default '') invert (default 'v') unmark (default 'u') - yank (default 'y') - delete (default 'd') - put (default 'p') + copy (default 'y') + cut (default 'd') + paste (default 'p') clear (default 'c') redraw (default '') reload (default '') @@ -50,7 +50,7 @@ The following commands are provided by lf without default keybindings: draw draw the ui load load modified files and directories - sync synchronizes yanked/deleted files with server + sync synchronizes copied/cut files with server echo prints its arguments to the message line cd changes working directory to its argument select changes current file selection to its argument @@ -487,19 +487,16 @@ should not be needed for users. File Operations lf uses the underlying 'cp' and 'mv' shell commands for file operations. For -this purpose, when you 'yank' (i.e. copy) a file, it doesn't actually copy -the file on the disk, but only records its name to memory. The actual file -operation takes place when you do the 'put' in which case the 'cp' command -is used. Similarly the 'mv' command is used for 'delete' (i.e. cut or kill) -followed by 'put'. These traditional names (e.g. 'yank', 'delete', and -'put') are picked instead of the other common convention (e.g. copy and cut) -to resemble the default keybinds for these operations. +this purpose, when you 'copy' a file, it doesn't actually copy the file on +the disk, but only records its name to memory. The actual file operation +takes place when you 'paste' in which case the 'cp' command is used. +Similarly the 'mv' command is used for 'cut' followed by 'paste'. -You can customize these operations by defining a 'put' command. This is a +You can customize these operations by defining a 'paste' command. This is a special command that is called when it is defined instead of the builtin implementation. The default behavior is similar to the following command: - cmd put ${{ + cmd paste ${{ load=$(lf -remote 'load') mode=$(echo "$load" | sed -n '1p') list=$(echo "$load" | sed '1d') diff --git a/etc/lfrc.example b/etc/lfrc.example index 0a590b4a..a76515e7 100644 --- a/etc/lfrc.example +++ b/etc/lfrc.example @@ -3,7 +3,7 @@ set shell sh # set '-eu' options for shell commands # These options are used to have safer shell commands. Option '-e' is used to -# exit on error and '-u' option is used to give error for unset variables. +# exit on error and option '-u' is used to give error for unset variables. # Option '-f' disables pathname expansion which can be useful when $f, $fs, and # $fx variables contain names with '*' or '?' characters. However, this option # is used selectively within individual commands as it can be limiting at diff --git a/eval.go b/eval.go index 01a69b8c..29f5c832 100644 --- a/eval.go +++ b/eval.go @@ -356,36 +356,36 @@ func (e *callExpr) eval(app *app, args []string) { app.nav.invert() case "unmark": app.nav.unmark() - case "yank": + case "copy": if err := app.nav.save(true); err != nil { - app.ui.printf("yank: %s", err) + app.ui.printf("copy: %s", err) return } app.nav.unmark() if err := sendRemote("send sync"); err != nil { - app.ui.printf("yank: %s", err) + app.ui.printf("copy: %s", err) } - case "delete": + case "cut": if err := app.nav.save(false); err != nil { - app.ui.printf("delete: %s", err) + app.ui.printf("cut: %s", err) return } app.nav.unmark() if err := sendRemote("send sync"); err != nil { - app.ui.printf("delete: %s", err) + app.ui.printf("cut: %s", err) } - case "put": - if cmd, ok := gOpts.cmds["put"]; ok { + case "paste": + if cmd, ok := gOpts.cmds["paste"]; ok { cmd.eval(app, e.args) - } else if err := app.nav.put(); err != nil { - app.ui.printf("put: %s", err) + } else if err := app.nav.paste(); err != nil { + app.ui.printf("paste: %s", err) return } if err := sendRemote("send load"); err != nil { - app.ui.printf("put: %s", err) + app.ui.printf("paste: %s", err) } if err := sendRemote("send sync"); err != nil { - app.ui.printf("put: %s", err) + app.ui.printf("paste: %s", err) } case "clear": if err := saveFiles(nil, false); err != nil { diff --git a/nav.go b/nav.go index a0fe782c..153eebfc 100644 --- a/nav.go +++ b/nav.go @@ -540,69 +540,69 @@ func (nav *nav) unmark() { nav.markInd = 0 } -func (nav *nav) save(copy bool) error { +func (nav *nav) save(cp bool) error { if len(nav.marks) == 0 { curr, err := nav.currFile() if err != nil { return errors.New("no file selected") } - if err := saveFiles([]string{curr.path}, copy); err != nil { + if err := saveFiles([]string{curr.path}, cp); err != nil { return err } nav.saves = make(map[string]bool) - nav.saves[curr.path] = copy + nav.saves[curr.path] = cp } else { marks := nav.currMarks() - if err := saveFiles(marks, copy); err != nil { + if err := saveFiles(marks, cp); err != nil { return err } nav.saves = make(map[string]bool) for f := range nav.marks { - nav.saves[f] = copy + nav.saves[f] = cp } } return nil } -func (nav *nav) put() error { - list, copy, err := loadFiles() +func (nav *nav) paste() error { + list, cp, err := loadFiles() if err != nil { return err } if len(list) == 0 { - return errors.New("no file in yank/delete buffer") + return errors.New("no file in copy/cut buffer") } dir := nav.currDir() - cmd := putCommand(list, dir, copy) + cmd := pasteCommand(list, dir, cp) if err := cmd.Run(); err != nil { - return fmt.Errorf("putting files: %s", err) + return fmt.Errorf("pasting files: %s", err) } if err := saveFiles(nil, false); err != nil { - return fmt.Errorf("clearing yank/delete buffer: %s", err) + return fmt.Errorf("clearing copy/cut buffer: %s", err) } return nil } func (nav *nav) sync() error { - list, copy, err := loadFiles() + list, cp, err := loadFiles() if err != nil { return err } nav.saves = make(map[string]bool) for _, f := range list { - nav.saves[f] = copy + nav.saves[f] = cp } return nil diff --git a/opts.go b/opts.go index 7aadb627..63bcd792 100644 --- a/opts.go +++ b/opts.go @@ -90,10 +90,10 @@ func init() { gOpts.keys[""] = &callExpr{"toggle", nil, 1} gOpts.keys["v"] = &callExpr{"invert", nil, 1} gOpts.keys["u"] = &callExpr{"unmark", nil, 1} - gOpts.keys["y"] = &callExpr{"yank", nil, 1} - gOpts.keys["d"] = &callExpr{"delete", nil, 1} + gOpts.keys["y"] = &callExpr{"copy", nil, 1} + gOpts.keys["d"] = &callExpr{"cut", nil, 1} gOpts.keys["c"] = &callExpr{"clear", nil, 1} - gOpts.keys["p"] = &callExpr{"put", nil, 1} + gOpts.keys["p"] = &callExpr{"paste", nil, 1} gOpts.keys[""] = &callExpr{"redraw", nil, 1} gOpts.keys[""] = &callExpr{"reload", nil, 1} gOpts.keys[":"] = &callExpr{"read", nil, 1} diff --git a/os.go b/os.go index 3d59c731..056c4ed1 100644 --- a/os.go +++ b/os.go @@ -70,11 +70,11 @@ func shellCommand(s string, args []string) *exec.Cmd { return exec.Command(gOpts.shell, args...) } -func putCommand(list []string, dir *dir, copy bool) *exec.Cmd { +func pasteCommand(list []string, dir *dir, cp bool) *exec.Cmd { var sh string var args []string - if copy { + if cp { sh = "cp" args = append(args, "-R") } else { diff --git a/os_windows.go b/os_windows.go index 565bff9d..7382775b 100644 --- a/os_windows.go +++ b/os_windows.go @@ -45,11 +45,11 @@ func shellCommand(s string, args []string) *exec.Cmd { return exec.Command(gOpts.shell, args...) } -func putCommand(list []string, dir *dir, copy bool) *exec.Cmd { +func pasteCommand(list []string, dir *dir, cp bool) *exec.Cmd { var args []string sh := "robocopy" - if !copy { + if !cp { args = []string{"/move"} } for _, f := range list { diff --git a/ui.go b/ui.go index e73dca31..754dfaf4 100644 --- a/ui.go +++ b/ui.go @@ -274,8 +274,8 @@ func (win *win) printDir(dir *dir, marks map[string]int, saves map[string]bool, if _, ok := marks[path]; ok { win.print(0, i, fg, termbox.ColorMagenta, " ") - } else if copy, ok := saves[path]; ok { - if copy { + } else if cp, ok := saves[path]; ok { + if cp { win.print(0, i, fg, termbox.ColorYellow, " ") } else { win.print(0, i, fg, termbox.ColorRed, " ")