diff --git a/complete.go b/complete.go index 00ed30c4..b2336796 100644 --- a/complete.go +++ b/complete.go @@ -157,6 +157,7 @@ var ( "shellopts", "sortby", "timefmt", + "tempmarks", "truncatechar", } ) diff --git a/doc.go b/doc.go index 3e180da6..c6b0acf1 100644 --- a/doc.go +++ b/doc.go @@ -137,6 +137,7 @@ The following options can be used to customize the behavior of lf: smartdia bool (default off) sortby string (default 'natural') tabstop int (default 8) + tempmarks string (default '') timefmt string (default 'Mon Jan _2 15:04:05 2006') truncatechar string (default '~') waitmsg string (default 'Press any key to continue') @@ -708,6 +709,10 @@ Currently supported sort types are 'natural', 'name', 'size', 'time', 'ctime', ' Number of space characters to show for horizontal tabulation (U+0009) character. + tempmarks string (default '') + +A string that lists all marks to treat as temporary. They are not synced to other clients and are not saved in the bookmarks file. This option should be specified only in the global config file ("lfrc") as it may otherwise cause unintended side effects. Please note that the special bookmark "'" is always treated as temporary and does not need to be specified. + timefmt string (default 'Mon Jan _2 15:04:05 2006') Format string of the file modification time shown in the bottom line. diff --git a/docstring.go b/docstring.go index cd100dcc..e7880b53 100644 --- a/docstring.go +++ b/docstring.go @@ -141,6 +141,7 @@ The following options can be used to customize the behavior of lf: smartdia bool (default off) sortby string (default 'natural') tabstop int (default 8) + tempmarks string (default '') timefmt string (default 'Mon Jan _2 15:04:05 2006') truncatechar string (default '~') waitmsg string (default 'Press any key to continue') @@ -756,6 +757,14 @@ Sort type for directories. Currently supported sort types are 'natural', Number of space characters to show for horizontal tabulation (U+0009) character. + tempmarks string (default '') + +A string that lists all marks to treat as temporary. They are not synced to +other clients and are not saved in the bookmarks file. This option should be +specified only in the global config file ("lfrc") as it may otherwise cause +unintended side effects. Please note that the special bookmark "'" is always +treated as temporary and does not need to be specified. + timefmt string (default 'Mon Jan _2 15:04:05 2006') Format string of the file modification time shown in the bottom line. diff --git a/eval.go b/eval.go index 6dd87b6e..f8d3204a 100644 --- a/eval.go +++ b/eval.go @@ -410,6 +410,12 @@ func (e *setExpr) eval(app *app, args []string) { } app.nav.sort() app.ui.sort() + case "tempmarks": + if e.val != "" { + gOpts.tempmarks = "'" + e.val + } else { + gOpts.tempmarks = "'" + } case "timefmt": gOpts.timefmt = e.val case "truncatechar": diff --git a/lf.1 b/lf.1 index b2117e97..91cbbf09 100644 --- a/lf.1 +++ b/lf.1 @@ -156,6 +156,7 @@ The following options can be used to customize the behavior of lf: smartdia bool (default off) sortby string (default 'natural') tabstop int (default 8) + tempmarks string (default '') timefmt string (default 'Mon Jan _2 15:04:05 2006') truncatechar string (default '~') waitmsg string (default 'Press any key to continue') @@ -854,6 +855,12 @@ Sort type for directories. Currently supported sort types are 'natural', 'name', .PP Number of space characters to show for horizontal tabulation (U+0009) character. .PP +.EX + tempmarks string (default '') +.EE +.PP +A string that lists all marks to treat as temporary. They are not synced to other clients and are not saved in the bookmarks file. This option should be specified only in the global config file ("lfrc") as it may otherwise cause unintended side effects. Please note that the special bookmark "'" is always treated as temporary and does not need to be specified. +.PP .EX timefmt string (default 'Mon Jan _2 15:04:05 2006') .EE diff --git a/nav.go b/nav.go index 79838e44..1330b1e5 100644 --- a/nav.go +++ b/nav.go @@ -1136,12 +1136,14 @@ func (nav *nav) sync() error { nav.saves[f] = cp } - path, ok := nav.marks["'"] + oldmarks := nav.marks err = nav.readMarks() - if ok { - nav.marks["'"] = path + for _, ch := range gOpts.tempmarks { + tmp := string(ch) + if v, e := oldmarks[tmp]; e { + nav.marks[tmp] = v + } } - return err } @@ -1419,7 +1421,9 @@ func (nav *nav) writeMarks() error { var keys []string for k := range nav.marks { - keys = append(keys, k) + if !strings.Contains(gOpts.tempmarks, k) { + keys = append(keys, k) + } } sort.Strings(keys) diff --git a/opts.go b/opts.go index 724c93d3..e2a1d145 100644 --- a/opts.go +++ b/opts.go @@ -71,6 +71,7 @@ var gOpts struct { cmdkeys map[string]expr cmds map[string]expr sortType sortType + tempmarks string } func init() { @@ -114,6 +115,7 @@ func init() { gOpts.info = nil gOpts.shellopts = nil gOpts.sortType = sortType{naturalSort, dirfirstSort} + gOpts.tempmarks = "'" gOpts.keys = make(map[string]expr)