feat: add terminalcursor option (#2441)

This commit is contained in:
CatsDeservePets authored and GitHub committed 2026-03-19 01:43:30 +01:00
1 parent 29baa994de
commit bf8486f617
7 files changed
+60 -1

No files matched your search

+1
View File
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- Emoji sequences containing Zero Width Joiner characters are now displayed as a single combined glyph (#2286).
- A new field `.All` is added to the `ruler` file to display the number of all files (i.e. visible + hidden) in the current working directory (#2376).
- A new option `numbercursorfmt` is added to further customize the appearance of line numbers (#2395).
- A new option `terminalcursor` is added to customize the appearance of the terminal cursor (#2441).
- The `loading...` message delay of 100 milliseconds for file previews is now applied to directories as well (#2410).
- `lf` will now automatically change to the parent directory if the current directory no longer exists and the `watch` option is enabled (#2424).
+2
View File
@@ -407,6 +407,8 @@ func completeCmd(s string) (matches []compMatch, longest string) {
matches, longest = matchWord(f[2], []string{"binary", "decimal"})
case "sortby":
matches, longest = matchWord(f[2], []string{"atime", "btime", "ctime", "custom", "ext", "name", "natural", "size", "time"})
case "terminalcursor":
matches, longest = matchWord(f[2], []string{"default", "block", "underline", "bar", "blinkblock", "blinkunderline", "blinkbar"})
default:
if slices.Contains(gOptWords, f[1]+"!") {
matches, longest = matchWord(f[2], []string{"false", "true"})
+6
View File
@@ -320,6 +320,7 @@ The following options can be used to customize the behavior of lf:
tabstop int (default 8)
tagfmt string (default "\033[31m")
tempmarks string (default '')
terminalcursor string (default 'default')
timefmt string (default 'Mon Jan _2 15:04:05 2006')
truncatechar string (default '~')
truncatepct int (default 100)
@@ -1250,6 +1251,11 @@ Marks to be considered temporary (e.g. `abc` refers to marks `a`, `b`, and `c`).
These marks are not synced to other clients and they are not saved in the bookmarks file.
Note that the special bookmark `` ` `` is always treated as temporary and it does not need to be specified.
## terminalcursor (string) (default `default`)
Set the appearance of the terminal cursor for prompts shown in the bottom line.
Currently supported values are `default`, `block`, `underline`, `bar`, `blinkblock`, `blinkunderline` and `blinkbar`.
## timefmt (string) (default `Mon Jan _2 15:04:05 2006`)
Format string of the file modification time shown in the bottom line.
+7
View File
@@ -332,6 +332,7 @@ The following options can be used to customize the behavior of lf:
tabstop int (default 8)
tagfmt string (default "\033[31m")
tempmarks string (default '')
terminalcursor string (default 'default')
timefmt string (default 'Mon Jan _2 15:04:05 2006')
truncatechar string (default '~')
truncatepct int (default 100)
@@ -1364,6 +1365,12 @@ These marks are not synced to other clients and they are not saved in
the bookmarks file. Note that the special bookmark ` is always treated
as temporary and it does not need to be specified.
terminalcursor (string) (default default)
Set the appearance of the terminal cursor for prompts shown in the
bottom line. Currently supported values are default, block, underline,
bar, blinkblock, blinkunderline and blinkbar.
timefmt (string) (default Mon Jan _2 15:04:05 2006)
Format string of the file modification time shown in the bottom line.
+22
View File
@@ -414,6 +414,28 @@ func (e *setExpr) eval(app *app, _ []string) {
gOpts.tagfmt = e.val
case "tempmarks":
gOpts.tempmarks = "'" + e.val
case "terminalcursor":
style := cursorStyle(e.val)
switch style {
case defaultCursor:
app.ui.screen.SetCursorStyle(tcell.CursorStyleDefault)
case blockCursor:
app.ui.screen.SetCursorStyle(tcell.CursorStyleSteadyBlock)
case underlineCursor:
app.ui.screen.SetCursorStyle(tcell.CursorStyleSteadyUnderline)
case barCursor:
app.ui.screen.SetCursorStyle(tcell.CursorStyleSteadyBar)
case blinkBlockCursor:
app.ui.screen.SetCursorStyle(tcell.CursorStyleBlinkingBlock)
case blinkUnderlineCursor:
app.ui.screen.SetCursorStyle(tcell.CursorStyleBlinkingUnderline)
case blinkBarCursor:
app.ui.screen.SetCursorStyle(tcell.CursorStyleBlinkingBar)
default:
app.ui.echoerr("terminalcursor: value should either be 'default', 'block', 'underline', 'bar', 'blinkblock', 'blinkunderline' or 'blinkbar'")
return
}
gOpts.terminalcursor = style
case "timefmt":
gOpts.timefmt = e.val
case "truncatechar":
+8 -1
View File
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.7.0.2
.\"
.TH "LF" "1" "2026\-03\-17" "r42" "DOCUMENTATION"
.TH "LF" "1" "2026\-03\-18" "r42" "DOCUMENTATION"
.SH NAME
lf \- terminal file manager
.SH SYNOPSIS
@@ -344,6 +344,7 @@ statfmt string (default \(dq\(rs033[36m%p\(rs033[0m| %c| %u| %g| %S
tabstop int (default 8)
tagfmt string (default \(dq\(rs033[31m\(dq)
tempmarks string (default \(aq\(aq)
terminalcursor string (default \(aqdefault\(aq)
timefmt string (default \(aqMon Jan _2 15:04:05 2006\(aq)
truncatechar string (default \(aq\(ti\(aq)
truncatepct int (default 100)
@@ -1217,6 +1218,12 @@ These marks are not synced to other clients and they are not saved in
the bookmarks file.
Note that the special bookmark \f[CR]\(ga\f[R] is always treated as
temporary and it does not need to be specified.
.SS terminalcursor (string) (default \f[CR]default\f[R])
Set the appearance of the terminal cursor for prompts shown in the
bottom line.
Currently supported values are \f[CR]default\f[R], \f[CR]block\f[R],
\f[CR]underline\f[R], \f[CR]bar\f[R], \f[CR]blinkblock\f[R],
\f[CR]blinkunderline\f[R] and \f[CR]blinkbar\f[R].
.SS timefmt (string) (default \f[CR]Mon Jan _2 15:04:05 2006\f[R])
Format string of the file modification time shown in the bottom line.
.SS truncatechar (string) (default \f[CR]\(ti\f[R])
+14
View File
@@ -38,6 +38,18 @@ const (
regexSearch searchMethod = "regex"
)
type cursorStyle string
const (
defaultCursor cursorStyle = "default"
blockCursor cursorStyle = "block"
underlineCursor cursorStyle = "underline"
barCursor cursorStyle = "bar"
blinkBlockCursor cursorStyle = "blinkblock"
blinkUnderlineCursor cursorStyle = "blinkunderline"
blinkBarCursor cursorStyle = "blinkbar"
)
var gOpts struct {
anchorfind bool
autoquit bool
@@ -106,6 +118,7 @@ var gOpts struct {
tabstop int
tagfmt string
tempmarks string
terminalcursor cursorStyle
timefmt string
truncatechar string
truncatepct int
@@ -248,6 +261,7 @@ func init() {
gOpts.tabstop = 8
gOpts.tagfmt = "\033[31m"
gOpts.tempmarks = "'"
gOpts.terminalcursor = defaultCursor
gOpts.timefmt = time.ANSIC
gOpts.truncatechar = "~"
gOpts.truncatepct = 100