Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c86577b95 | ||
|
|
4dbc15e4b0 | ||
|
|
c0dfb3c4f5 | ||
|
|
55ad40ac0a | ||
|
|
c1583032aa | ||
|
|
eb84772032 | ||
|
|
821b2fcd51 | ||
|
|
734f11d61b | ||
|
|
28b550a7ec | ||
|
|
1e1486fc02 | ||
|
|
bb45d15b83 | ||
|
|
b5c83dbf7a | ||
|
|
27d316c006 | ||
|
|
83af3e1cb0 | ||
|
|
27ab67aab7 | ||
|
|
3ae67fc361 | ||
|
|
f563263add | ||
|
|
70171adf40 | ||
|
|
11caeddb35 | ||
|
|
6ffc4a4c8a | ||
|
|
0eddc1e724 | ||
|
|
43fced28e3 | ||
|
|
68e2433d48 | ||
|
|
25288fd90b | ||
|
|
122dee1f45 | ||
|
|
8652707299 | ||
|
|
41cdd02572 | ||
|
|
207de6a506 | ||
|
|
acb5693b11 | ||
|
|
85512625f8 | ||
|
|
0bf17dd3f0 | ||
|
|
db9de4d4de | ||
|
|
9440b1b319 | ||
|
|
a85ce898a1 | ||
|
|
9f1428582f | ||
|
|
bcd058ace2 | ||
|
|
382534c4ba | ||
|
|
c2cbc39ce5 | ||
|
|
a8e95ae40a | ||
|
|
3fc1db5d14 | ||
|
|
7a7e81e88c | ||
|
|
b02fd42df4 | ||
|
|
752f059068 | ||
|
|
326930f46f | ||
|
|
6c3366eec4 | ||
|
|
28936c7506 | ||
|
|
960f23c288 | ||
|
|
95a6f9584f | ||
|
|
cae576bb1d | ||
|
|
6afefa5d09 | ||
|
|
c0c85f206f | ||
|
|
530ab2c40a | ||
|
|
4a443cae58 | ||
|
|
0b99aaed4e | ||
|
|
6440281e82 | ||
|
|
2fe5e4d54e | ||
|
|
a4fa5d36c9 |
No files matched your search
@@ -0,0 +1,10 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
@@ -14,14 +14,14 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.18
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./...
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
- name: Test
|
||||
run: go test -v ./...
|
||||
|
||||
- uses: dominikh/staticcheck-action@v1.2.0
|
||||
- uses: dominikh/staticcheck-action@v1.3.0
|
||||
with:
|
||||
version: "2022.1.3"
|
||||
install-go: false
|
||||
@@ -37,12 +37,12 @@ jobs:
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.19
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.18
|
||||
|
||||
- name: Build
|
||||
run: gen/xbuild.sh
|
||||
@@ -26,3 +26,14 @@ jobs:
|
||||
files: dist/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
winget:
|
||||
runs-on: windows-latest # Action can only run on Windows
|
||||
needs: build
|
||||
steps:
|
||||
- uses: vedantmgoyal2009/winget-releaser@v2
|
||||
with:
|
||||
identifier: gokcehan.lf
|
||||
version: ${{ github.ref_name }}
|
||||
installers-regex: '-windows-\w+\.zip$'
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
@@ -31,6 +31,7 @@ See [faq](https://github.com/gokcehan/lf/wiki/FAQ) for more information and [tut
|
||||
|
||||
- Tabs or windows (better handled by window manager or terminal multiplexer)
|
||||
- Builtin pager/editor (better handled by your pager/editor of choice)
|
||||
- Builtin commands for file operations (better handled by the underlying shell tools including but not limited to `mkdir`, `touch`, `chmod`, `chown`, `chgrp`, and `ln`)
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -40,42 +41,20 @@ See [releases](https://github.com/gokcehan/lf/releases) for pre-built binaries.
|
||||
|
||||
Building from the source requires [Go](https://go.dev/).
|
||||
|
||||
On Unix (Go version < 1.17):
|
||||
|
||||
```bash
|
||||
env CGO_ENABLED=0 GO111MODULE=on go get -u -ldflags="-s -w" github.com/gokcehan/lf
|
||||
```
|
||||
|
||||
On Unix (Go version >= 1.17):
|
||||
On Unix:
|
||||
|
||||
```bash
|
||||
env CGO_ENABLED=0 go install -ldflags="-s -w" github.com/gokcehan/lf@latest
|
||||
```
|
||||
|
||||
On Windows `cmd` (Go version < 1.17):
|
||||
|
||||
```cmd
|
||||
set CGO_ENABLED=0
|
||||
set GO111MODULE=on
|
||||
go get -u -ldflags="-s -w" github.com/gokcehan/lf
|
||||
```
|
||||
|
||||
On Windows `cmd` (Go version >= 1.17):
|
||||
On Windows `cmd`:
|
||||
|
||||
```cmd
|
||||
set CGO_ENABLED=0
|
||||
go install -ldflags="-s -w" github.com/gokcehan/lf@latest
|
||||
```
|
||||
|
||||
On Windows `powershell` (Go version < 1.17):
|
||||
|
||||
```powershell
|
||||
$env:CGO_ENABLED = '0'
|
||||
$env:GO111MODULE = 'on'
|
||||
go get -u -ldflags="-s -w" github.com/gokcehan/lf
|
||||
```
|
||||
|
||||
On Windows `powershell` (Go version >= 1.17):
|
||||
On Windows `powershell`:
|
||||
|
||||
```powershell
|
||||
$env:CGO_ENABLED = '0'
|
||||
|
||||
@@ -467,10 +467,17 @@ func (app *app) loop() {
|
||||
app.nav.renew()
|
||||
app.ui.loadFile(app, false)
|
||||
app.ui.draw(app.nav)
|
||||
case <-app.nav.previewTimer.C:
|
||||
app.nav.previewLoading = true
|
||||
app.ui.draw(app.nav)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type cleanFunc func()
|
||||
|
||||
var noopCleanFunc = func() {}
|
||||
|
||||
// This function is used to run a shell command. Modes are as follows:
|
||||
//
|
||||
// Prefix Wait Async Stdin Stdout Stderr UI action
|
||||
@@ -478,7 +485,8 @@ func (app *app) loop() {
|
||||
// % No No Yes Yes Yes Statline for input/output
|
||||
// ! Yes No Yes Yes Yes Pause and then resume
|
||||
// & No Yes No No No Do nothing
|
||||
func (app *app) runShell(s string, args []string, prefix string) {
|
||||
// $| No No Pipe Yes Yes Pause, Pipe execute, return cleanup to resume
|
||||
func (app *app) runShell(s string, args []string, prefix string) cleanFunc {
|
||||
app.nav.exportFiles()
|
||||
app.ui.exportSizes()
|
||||
exportOpts()
|
||||
@@ -488,6 +496,24 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
||||
var out io.Reader
|
||||
var err error
|
||||
switch prefix {
|
||||
case "$|":
|
||||
var stdin io.WriteCloser
|
||||
stdin, err = cmd.StdinPipe()
|
||||
if err != nil {
|
||||
log.Printf("writing stdin: %s", err)
|
||||
}
|
||||
app.cmdIn = stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
app.nav.previewChan <- ""
|
||||
app.nav.dirPreviewChan <- nil
|
||||
|
||||
if err := app.ui.suspend(); err != nil {
|
||||
log.Printf("suspend: %s", err)
|
||||
}
|
||||
|
||||
err = cmd.Start()
|
||||
case "$", "!":
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
@@ -512,7 +538,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
||||
case "%":
|
||||
shellSetPG(cmd)
|
||||
if app.ui.cmdPrefix == ">" {
|
||||
return
|
||||
return noopCleanFunc
|
||||
}
|
||||
stdin, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
@@ -540,7 +566,11 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
||||
anyKey()
|
||||
}
|
||||
|
||||
app.ui.loadFile(app, true)
|
||||
// Asynchronous shell invocations return immediately without waiting for the
|
||||
// command to finish, so there is no point refreshing the preview if nothing
|
||||
// has changed yet.
|
||||
volatile := prefix != "&"
|
||||
app.ui.loadFile(app, volatile)
|
||||
|
||||
switch prefix {
|
||||
case "%":
|
||||
@@ -585,5 +615,17 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
||||
log.Printf("running shell: %s", err)
|
||||
}
|
||||
}()
|
||||
case "$|":
|
||||
return func() {
|
||||
if err := cmd.Wait(); err != nil {
|
||||
log.Printf("running shell: %s", err)
|
||||
}
|
||||
app.nav.renew()
|
||||
if err := app.ui.resume(); err != nil {
|
||||
app.quit()
|
||||
os.Exit(3)
|
||||
}
|
||||
}
|
||||
}
|
||||
return noopCleanFunc
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
@@ -34,7 +33,7 @@ func run() {
|
||||
defer f.Close()
|
||||
log.SetOutput(f)
|
||||
} else {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
log.SetOutput(io.Discard)
|
||||
}
|
||||
|
||||
log.Print("hi!")
|
||||
|
||||
+21
-14
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -13,7 +12,9 @@ var (
|
||||
gCmdWords = []string{
|
||||
"set",
|
||||
"map",
|
||||
"maps",
|
||||
"cmap",
|
||||
"cmaps",
|
||||
"cmd",
|
||||
"quit",
|
||||
"up",
|
||||
@@ -35,6 +36,7 @@ var (
|
||||
"low",
|
||||
"toggle",
|
||||
"invert",
|
||||
"invert-below",
|
||||
"unselect",
|
||||
"glob-select",
|
||||
"glob-unselect",
|
||||
@@ -113,6 +115,9 @@ var (
|
||||
"autoquit",
|
||||
"noautoquit",
|
||||
"autoquit!",
|
||||
"cursoractivefmt",
|
||||
"cursorparentfmt",
|
||||
"cursorpreviewfmt",
|
||||
"dircache",
|
||||
"nodircache",
|
||||
"dircache!",
|
||||
@@ -167,6 +172,7 @@ var (
|
||||
"reverse",
|
||||
"noreverse",
|
||||
"reverse!",
|
||||
"ruler",
|
||||
"smartcase",
|
||||
"nosmartcase",
|
||||
"smartcase!",
|
||||
@@ -190,6 +196,7 @@ var (
|
||||
"history",
|
||||
"ifs",
|
||||
"info",
|
||||
"numberfmt",
|
||||
"previewer",
|
||||
"cleaner",
|
||||
"promptfmt",
|
||||
@@ -249,7 +256,7 @@ func matchExec(s string) (matches []string, longest []rune) {
|
||||
continue
|
||||
}
|
||||
|
||||
files, err := ioutil.ReadDir(p)
|
||||
files, err := os.ReadDir(p)
|
||||
if err != nil {
|
||||
log.Printf("reading path: %s", err)
|
||||
}
|
||||
@@ -259,18 +266,18 @@ func matchExec(s string) (matches []string, longest []rune) {
|
||||
continue
|
||||
}
|
||||
|
||||
f, err = os.Stat(filepath.Join(p, f.Name()))
|
||||
finfo, err := f.Info()
|
||||
if err != nil {
|
||||
log.Printf("getting file information: %s", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if !f.Mode().IsRegular() || !isExecutable(f) {
|
||||
if !finfo.Mode().IsRegular() || !isExecutable(finfo) {
|
||||
continue
|
||||
}
|
||||
|
||||
log.Print(f.Name())
|
||||
words = append(words, f.Name())
|
||||
log.Print(finfo.Name())
|
||||
words = append(words, finfo.Name())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +310,7 @@ func matchFile(s string) (matches []string, longest []rune) {
|
||||
|
||||
dir = filepath.Dir(unescape(dir))
|
||||
|
||||
files, err := ioutil.ReadDir(dir)
|
||||
files, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
log.Printf("reading directory: %s", err)
|
||||
}
|
||||
@@ -334,14 +341,14 @@ func matchFile(s string) (matches []string, longest []rune) {
|
||||
}
|
||||
matches = append(matches, item)
|
||||
|
||||
if longest != nil {
|
||||
longest = matchLongest(longest, []rune(name))
|
||||
} else if s != "" {
|
||||
if longest == nil {
|
||||
if f.Mode().IsRegular() {
|
||||
longest = []rune(name + " ")
|
||||
} else {
|
||||
longest = []rune(name + escape(string(filepath.Separator)))
|
||||
}
|
||||
} else {
|
||||
longest = matchLongest(longest, []rune(name))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +428,7 @@ func completeFile(acc []rune) (matches []string, longestAcc []rune) {
|
||||
log.Printf("getting current directory: %s", err)
|
||||
}
|
||||
|
||||
files, err := ioutil.ReadDir(wd)
|
||||
files, err := os.ReadDir(wd)
|
||||
if err != nil {
|
||||
log.Printf("reading directory: %s", err)
|
||||
}
|
||||
@@ -433,10 +440,10 @@ func completeFile(acc []rune) (matches []string, longestAcc []rune) {
|
||||
|
||||
matches = append(matches, f.Name())
|
||||
|
||||
if longestAcc != nil {
|
||||
longestAcc = matchLongest(longestAcc, []rune(f.Name()))
|
||||
} else if s != "" {
|
||||
if longestAcc == nil {
|
||||
longestAcc = []rune(f.Name())
|
||||
} else {
|
||||
longestAcc = matchLongest(longestAcc, []rune(f.Name()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ The following commands are provided by lf:
|
||||
low (default 'L')
|
||||
toggle
|
||||
invert (default 'v')
|
||||
invert-below
|
||||
unselect (default 'u')
|
||||
glob-select
|
||||
glob-unselect
|
||||
@@ -78,6 +79,8 @@ The following commands are provided by lf:
|
||||
mark-remove (modal) (default '"')
|
||||
tag
|
||||
tag-toggle (default 't')
|
||||
maps
|
||||
cmaps
|
||||
|
||||
The following command line commands are provided by lf:
|
||||
|
||||
@@ -88,8 +91,8 @@ The following command line commands are provided by lf:
|
||||
cmd-menu-accept
|
||||
cmd-enter (default '<c-j>' and '<enter>')
|
||||
cmd-interrupt (default '<c-c>')
|
||||
cmd-history-next (default '<c-n>')
|
||||
cmd-history-prev (default '<c-p>')
|
||||
cmd-history-next (default '<c-n>' and '<down>')
|
||||
cmd-history-prev (default '<c-p>' and '<up>')
|
||||
cmd-left (default '<c-b>' and '<left>')
|
||||
cmd-right (default '<c-f>' and '<right>')
|
||||
cmd-home (default '<c-a>' and '<home>')
|
||||
@@ -111,57 +114,62 @@ The following command line commands are provided by lf:
|
||||
|
||||
The following options can be used to customize the behavior of lf:
|
||||
|
||||
anchorfind bool (default on)
|
||||
autoquit bool (default off)
|
||||
cleaner string (default '')
|
||||
dircache bool (default on)
|
||||
dircounts bool (default off)
|
||||
dirfirst bool (default on)
|
||||
dironly bool (default off)
|
||||
dirpreviews bool (default off)
|
||||
drawbox bool (default off)
|
||||
errorfmt string (default "\033[7;31;47m%s\033[0m")
|
||||
filesep string (default "\n")
|
||||
findlen int (default 1)
|
||||
globsearch bool (default off)
|
||||
hidden bool (default off)
|
||||
hiddenfiles []string (default '.*')
|
||||
history bool (default on)
|
||||
icons bool (default off)
|
||||
ifs string (default '')
|
||||
ignorecase bool (default on)
|
||||
ignoredia bool (default on)
|
||||
incfilter bool (default off)
|
||||
incsearch bool (default off)
|
||||
info []string (default '')
|
||||
infotimefmtnew string (default 'Jan _2 15:04')
|
||||
infotimefmtold string (default 'Jan _2 2006')
|
||||
mouse bool (default off)
|
||||
number bool (default off)
|
||||
period int (default 0)
|
||||
preview bool (default on)
|
||||
previewer string (default '')
|
||||
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
||||
ratios []int (default '1:2:3')
|
||||
relativenumber bool (default off)
|
||||
reverse bool (default off)
|
||||
scrolloff int (default 0)
|
||||
selmode string (default 'all')
|
||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default on)
|
||||
smartdia bool (default off)
|
||||
sortby string (default 'natural')
|
||||
tabstop int (default 8)
|
||||
tagfmt string (default "\033[31m%s\033[0m")
|
||||
tempmarks string (default '')
|
||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||
truncatechar string (default '~')
|
||||
waitmsg string (default 'Press any key to continue')
|
||||
wrapscan bool (default on)
|
||||
wrapscroll bool (default off)
|
||||
user_{option} string (default none)
|
||||
anchorfind bool (default true)
|
||||
autoquit bool (default false)
|
||||
cleaner string (default '')
|
||||
cursoractivefmt string (default "\033[7m")
|
||||
cursorparentfmt string (default "\033[7m")
|
||||
cursorpreviewfmt string (default "\033[4m")
|
||||
dircache bool (default true)
|
||||
dircounts bool (default false)
|
||||
dirfirst bool (default true)
|
||||
dironly bool (default false)
|
||||
dirpreviews bool (default false)
|
||||
drawbox bool (default false)
|
||||
errorfmt string (default "\033[7;31;47m")
|
||||
filesep string (default "\n")
|
||||
findlen int (default 1)
|
||||
globsearch bool (default false)
|
||||
hidden bool (default false)
|
||||
hiddenfiles []string (default '.*')
|
||||
history bool (default true)
|
||||
icons bool (default false)
|
||||
ifs string (default '')
|
||||
ignorecase bool (default true)
|
||||
ignoredia bool (default true)
|
||||
incfilter bool (default false)
|
||||
incsearch bool (default false)
|
||||
info []string (default '')
|
||||
infotimefmtnew string (default 'Jan _2 15:04')
|
||||
infotimefmtold string (default 'Jan _2 2006')
|
||||
mouse bool (default false)
|
||||
number bool (default false)
|
||||
numberfmt string (default "\033[33m")
|
||||
period int (default 0)
|
||||
preview bool (default true)
|
||||
previewer string (default '')
|
||||
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
||||
ratios []int (default '1:2:3')
|
||||
relativenumber bool (default false)
|
||||
reverse bool (default false)
|
||||
ruler []string (default 'acc:progress:selection:ind')
|
||||
scrolloff int (default 0)
|
||||
selmode string (default 'all')
|
||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default true)
|
||||
smartdia bool (default false)
|
||||
sortby string (default 'natural')
|
||||
tabstop int (default 8)
|
||||
tagfmt string (default "\033[31m")
|
||||
tempmarks string (default '')
|
||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||
truncatechar string (default '~')
|
||||
waitmsg string (default 'Press any key to continue')
|
||||
wrapscan bool (default true)
|
||||
wrapscroll bool (default false)
|
||||
user_{option} string (default none)
|
||||
|
||||
The following environment variables are exported for shell commands:
|
||||
|
||||
@@ -173,13 +181,16 @@ The following environment variables are exported for shell commands:
|
||||
OLDPWD
|
||||
LF_LEVEL
|
||||
OPENER
|
||||
VISUAL
|
||||
EDITOR
|
||||
PAGER
|
||||
SHELL
|
||||
lf
|
||||
lf_{option}
|
||||
lf_user_{option}
|
||||
lf_width
|
||||
lf_height
|
||||
lf_count
|
||||
|
||||
The following special shell commands are used to customize the behavior of lf when defined:
|
||||
|
||||
@@ -226,7 +237,7 @@ If the 'mouse' option is enabled, mouse buttons have the following default effec
|
||||
Enter a directory or open a file. Also works on the preview window.
|
||||
|
||||
Scroll wheel
|
||||
Scroll up or down.
|
||||
Move up or down. If Ctrl is pressed, scroll up or down.
|
||||
|
||||
# Configuration
|
||||
|
||||
@@ -317,6 +328,7 @@ Change the current working directory to the next/previous jumplist item.
|
||||
bottom (default 'G' and '<end>')
|
||||
|
||||
Move the current file selection to the top/bottom of the directory.
|
||||
A count can be specified to move to a specific line, for example use `3G` to move to the third line.
|
||||
|
||||
high (default 'H')
|
||||
middle (default 'M')
|
||||
@@ -334,6 +346,17 @@ Reverse the selection of all files in the current directory (i.e. 'toggle' all f
|
||||
Selections in other directories are not effected by this command.
|
||||
You can define a new command to select all files in the directory by combining 'invert' with 'unselect' (i.e. 'cmd select-all :unselect; invert'), though this will also remove selections in other directories.
|
||||
|
||||
invert-below
|
||||
|
||||
Reverse the selection (i.e. 'toggle') of all files at or after the current file in the current directory.
|
||||
|
||||
To select a contiguous block of files, use this command on the first file you want to select.
|
||||
Then, move down to the first file you do *not* want to select (the one after the end of the desired selection) and use this command again.
|
||||
This achieves an effect similar to the visual mode in vim.
|
||||
|
||||
This command is experimental and may be removed once a better replacement for the visual mode is implemented in 'lf'.
|
||||
If you'd like to experiment with using this command, you should bind it to a key (e.g. 'V') for a better experience.
|
||||
|
||||
unselect (default 'u')
|
||||
|
||||
Remove the selection of all files in all directories.
|
||||
@@ -528,8 +551,8 @@ Execute the current line.
|
||||
|
||||
Interrupt the current shell-pipe command and return to the normal mode.
|
||||
|
||||
cmd-history-next (default '<c-n>')
|
||||
cmd-history-prev (default '<c-p>')
|
||||
cmd-history-next (default '<c-n>' and '<down>')
|
||||
cmd-history-prev (default '<c-p>' and '<up>')
|
||||
|
||||
Go to next/previous item in the history.
|
||||
|
||||
@@ -585,16 +608,21 @@ Delete the next word in forward direction.
|
||||
|
||||
Capitalize/uppercase/lowercase the current word and jump to the next word.
|
||||
|
||||
maps
|
||||
cmaps
|
||||
|
||||
List all key mappings in normal mode or command-line editing mode.
|
||||
|
||||
# Options
|
||||
|
||||
This section shows information about options to customize the behavior.
|
||||
Character ':' is used as the separator for list options '[]int' and '[]string'.
|
||||
|
||||
anchorfind bool (default on)
|
||||
anchorfind bool (default true)
|
||||
|
||||
When this option is enabled, find command starts matching patterns from the beginning of file names, otherwise, it can match at an arbitrary position.
|
||||
|
||||
autoquit bool (default off)
|
||||
autoquit bool (default false)
|
||||
|
||||
Automatically quit server when there are no clients left connected.
|
||||
|
||||
@@ -606,11 +634,27 @@ This file is called if previewing is enabled, the previewer is set, and the prev
|
||||
Five arguments are passed to the file, (1) current file name, (2) width, (3) height, (4) horizontal position, and (5) vertical position of preview pane respectively.
|
||||
Preview clearing is disabled when the value of this option is left empty.
|
||||
|
||||
dircache bool (default on)
|
||||
cursoractivefmt string (default "\033[7m")
|
||||
cursorparentfmt string (default "\033[7m")
|
||||
cursorpreviewfmt string (default "\033[4m")
|
||||
|
||||
Format strings for highlighting the cursor.
|
||||
`cursoractivefmt` applies in the current directory pane,
|
||||
`cursorparentfmt` applies in panes that show parents of the current directory,
|
||||
and `cursorpreviewfmt` applies in panes that preview directories.
|
||||
|
||||
The default is to make the active cursor and the parent directory cursor inverted. The preview cursor is underlined.
|
||||
|
||||
Some other possibilities to consider for the preview or parent cursors: an empty string for no cursor, "\033[7;2m" for dimmed inverted text (visibility varies by terminal), "\033[7;90m" for inverted text with grey (aka "brightblack") background.
|
||||
|
||||
If the format string contains the characters `%s`, it is interpreted as a format string for `fmt.Sprintf`. Such a string should end with the terminal reset sequence.
|
||||
For example, "\033[4m%s\033[0m" has the same effect as "\033[4m".
|
||||
|
||||
dircache bool (default true)
|
||||
|
||||
Cache directory contents.
|
||||
|
||||
dircounts bool (default off)
|
||||
dircounts bool (default false)
|
||||
|
||||
When this option is enabled, directory sizes show the number of items inside instead of the total size of the directory, which needs to be calculated for each directory using 'calcdirsize'.
|
||||
This information needs to be calculated by reading the directory and counting the items inside.
|
||||
@@ -618,26 +662,29 @@ Therefore, this option is disabled by default for performance reasons.
|
||||
This option only has an effect when 'info' has a 'size' field and the pane is wide enough to show the information.
|
||||
999 items are counted per directory at most, and bigger directories are shown as '999+'.
|
||||
|
||||
dirfirst bool (default on)
|
||||
dirfirst bool (default true)
|
||||
|
||||
Show directories first above regular files.
|
||||
|
||||
dironly bool (default off)
|
||||
|
||||
If enabled, directories will also be passed to the previewer script. This allows custom previews for directories.
|
||||
|
||||
dirpreviews bool (default off)
|
||||
dironly bool (default false)
|
||||
|
||||
Show only directories.
|
||||
|
||||
drawbox bool (default off)
|
||||
dirpreviews bool (default false)
|
||||
|
||||
If enabled, directories will also be passed to the previewer script. This allows custom previews for directories.
|
||||
|
||||
drawbox bool (default false)
|
||||
|
||||
Draw boxes around panes with box drawing characters.
|
||||
|
||||
errorfmt string (default "\033[7;31;47m%s\033[0m")
|
||||
errorfmt string (default "\033[7;31;47m")
|
||||
|
||||
Format string of error messages shown in the bottom message line.
|
||||
|
||||
If the format string contains the characters `%s`, it is interpreted as a format string for `fmt.Sprintf`. Such a string should end with the terminal reset sequence.
|
||||
For example, "\033[4m%s\033[0m" has the same effect as "\033[4m".
|
||||
|
||||
filesep string (default "\n")
|
||||
|
||||
File separator used in environment variables 'fs' and 'fx'.
|
||||
@@ -647,13 +694,13 @@ File separator used in environment variables 'fs' and 'fx'.
|
||||
Number of characters prompted for the find command.
|
||||
When this value is set to 0, find command prompts until there is only a single match left.
|
||||
|
||||
globsearch bool (default off)
|
||||
globsearch bool (default false)
|
||||
|
||||
When this option is enabled, search command patterns are considered as globs, otherwise they are literals.
|
||||
With globbing, '*' matches any sequence, '?' matches any character, and '[...]' or '[^...] matches character sets or ranges.
|
||||
With globbing, '*' matches any sequence, '?' matches any character, and '[...]' or '[^...]' matches character sets or ranges.
|
||||
Otherwise, these characters are interpreted as they are.
|
||||
|
||||
hidden bool (default off)
|
||||
hidden bool (default false)
|
||||
|
||||
Show hidden files.
|
||||
On Unix systems, hidden files are determined by the value of 'hiddenfiles'.
|
||||
@@ -663,14 +710,14 @@ On Windows, only files with hidden attributes are considered hidden files.
|
||||
|
||||
List of hidden file glob patterns.
|
||||
Patterns can be given as relative or absolute paths.
|
||||
Globbing supports the usual special characters, '*' to match any sequence, '?' to match any character, and '[...]' or '[^...] to match character sets or ranges.
|
||||
In addition, if a pattern starts with '!', then its matches are excluded from hidden files.
|
||||
Globbing supports the usual special characters, '*' to match any sequence, '?' to match any character, and '[...]' or '[^...]' to match character sets or ranges.
|
||||
In addition, if a pattern starts with '!', then its matches are excluded from hidden files. To add multiple patterns, use ':' as a separator. Example: '.*:lost+found:*.bak'
|
||||
|
||||
history bool (default on)
|
||||
history bool (default true)
|
||||
|
||||
Save command history.
|
||||
|
||||
icons bool (default off)
|
||||
icons bool (default false)
|
||||
|
||||
Show icons before each item in the list.
|
||||
|
||||
@@ -683,19 +730,19 @@ This method assumes a POSIX shell syntax and so it can fail for non-POSIX shells
|
||||
This option has no effect when the value is left empty.
|
||||
This option does not have any effect on Windows.
|
||||
|
||||
ignorecase bool (default on)
|
||||
ignorecase bool (default true)
|
||||
|
||||
Ignore case in sorting and search patterns.
|
||||
|
||||
ignoredia bool (default on)
|
||||
ignoredia bool (default true)
|
||||
|
||||
Ignore diacritics in sorting and search patterns.
|
||||
|
||||
incsearch bool (default off)
|
||||
incsearch bool (default false)
|
||||
|
||||
Jump to the first match after each keystroke during searching.
|
||||
|
||||
incfilter bool (default off)
|
||||
incfilter bool (default false)
|
||||
|
||||
Apply filter pattern after each keystroke during filtering.
|
||||
|
||||
@@ -713,15 +760,19 @@ Format string of the file time shown in the info column when it matches this yea
|
||||
|
||||
Format string of the file time shown in the info column when it doesn't match this year.
|
||||
|
||||
mouse bool (default off)
|
||||
mouse bool (default false)
|
||||
|
||||
Send mouse events as input.
|
||||
|
||||
number bool (default off)
|
||||
number bool (default false)
|
||||
|
||||
Show the position number for directory items at the left side of pane.
|
||||
When 'relativenumber' option is enabled, only the current line shows the absolute position and relative positions are shown for the rest.
|
||||
|
||||
numberfmt string (default "\033[33m")
|
||||
|
||||
Format string of the position number for each line.
|
||||
|
||||
period int (default 0)
|
||||
|
||||
Set the interval in seconds for periodic checks of directory updates.
|
||||
@@ -730,7 +781,7 @@ Note that directories are already updated automatically in many cases.
|
||||
This option can be useful when there is an external process changing the displayed directory and you are not doing anything in lf.
|
||||
Periodic checks are disabled when the value of this option is set to zero.
|
||||
|
||||
preview bool (default on)
|
||||
preview bool (default true)
|
||||
|
||||
Show previews of files and directories at the right most pane.
|
||||
If the file has more lines than the preview pane, rest of the lines are not read.
|
||||
@@ -759,15 +810,20 @@ List of ratios of pane widths.
|
||||
Number of items in the list determines the number of panes in the ui.
|
||||
When 'preview' option is enabled, the right most number is used for the width of preview pane.
|
||||
|
||||
relativenumber bool (default off)
|
||||
relativenumber bool (default false)
|
||||
|
||||
Show the position number relative to the current line.
|
||||
When 'number' is enabled, current line shows the absolute position, otherwise nothing is shown.
|
||||
|
||||
reverse bool (default off)
|
||||
reverse bool (default false)
|
||||
|
||||
Reverse the direction of sort.
|
||||
|
||||
ruler []string (default 'acc:progress:selection:ind')
|
||||
|
||||
List of information shown in status line ruler.
|
||||
Currently supported information types are 'acc', 'progress', 'selection', 'ind' and 'df'.
|
||||
|
||||
selmode string (default 'all')
|
||||
|
||||
Selection mode for commands.
|
||||
@@ -793,12 +849,12 @@ Command line flag used to pass shell commands.
|
||||
|
||||
List of shell options to pass to the shell executable.
|
||||
|
||||
smartcase bool (default on)
|
||||
smartcase bool (default true)
|
||||
|
||||
Override 'ignorecase' option when the pattern contains an uppercase character.
|
||||
This option has no effect when 'ignorecase' is disabled.
|
||||
|
||||
smartdia bool (default off)
|
||||
smartdia bool (default false)
|
||||
|
||||
Override 'ignoredia' option when the pattern contains a character with diacritic.
|
||||
This option has no effect when 'ignoredia' is disabled.
|
||||
@@ -812,10 +868,13 @@ Currently supported sort types are 'natural', 'name', 'size', 'time', 'ctime', '
|
||||
|
||||
Number of space characters to show for horizontal tabulation (U+0009) character.
|
||||
|
||||
tagfmt string (default "\033[31m%s\033[0m")
|
||||
tagfmt string (default "\033[31m")
|
||||
|
||||
Format string of the tags.
|
||||
|
||||
If the format string contains the characters `%s`, it is interpreted as a format string for `fmt.Sprintf`. Such a string should end with the terminal reset sequence.
|
||||
For example, "\033[4m%s\033[0m" has the same effect as "\033[4m".
|
||||
|
||||
tempmarks string (default '')
|
||||
|
||||
Marks to be considered temporary (e.g. 'abc' refers to marks 'a', 'b', and 'c').
|
||||
@@ -834,11 +893,11 @@ Truncate character shown at the end when the file name does not fit to the pane.
|
||||
|
||||
String shown after commands of shell-wait type.
|
||||
|
||||
wrapscan bool (default on)
|
||||
wrapscan bool (default true)
|
||||
|
||||
Searching can wrap around the file list.
|
||||
|
||||
wrapscroll bool (default off)
|
||||
wrapscroll bool (default false)
|
||||
|
||||
Scrolling can wrap around the file list.
|
||||
|
||||
@@ -885,19 +944,23 @@ For example, with POSIX shells, you can use '[ -n "$LF_LEVEL" ] && PS1="$PS1""(l
|
||||
|
||||
OPENER
|
||||
|
||||
If this variable is set in the environment, use the same value, otherwise set the value to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
||||
If this variable is set in the environment, use the same value. Otherwise, this is set to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
||||
|
||||
EDITOR
|
||||
|
||||
If this variable is set in the environment, use the same value, otherwise set the value to 'vi' on Unix, 'notepad' in Windows.
|
||||
If VISUAL is set in the environment, use its value. Otherwise, use the value of the environment variable EDITOR. If neither variable is set, this is set to 'vi' on Unix, 'notepad' in Windows.
|
||||
|
||||
PAGER
|
||||
|
||||
If this variable is set in the environment, use the same value, otherwise set the value to 'less' on Unix, 'more' in Windows.
|
||||
If this variable is set in the environment, use the same value. Otherwise, this is set to 'less' on Unix, 'more' in Windows.
|
||||
|
||||
SHELL
|
||||
|
||||
If this variable is set in the environment, use the same value, otherwise set the value to 'sh' on Unix, 'cmd' in Windows.
|
||||
If this variable is set in the environment, use the same value. Otherwise, this is set to 'sh' on Unix, 'cmd' in Windows.
|
||||
|
||||
lf
|
||||
|
||||
Absolute path to the currently running lf binary, if it can be found. Otherwise, this is set to the string 'lf'.
|
||||
|
||||
lf_{option}
|
||||
|
||||
@@ -912,6 +975,10 @@ Value of the user_{option}.
|
||||
|
||||
Width/Height of the terminal.
|
||||
|
||||
lf_count
|
||||
|
||||
Value of the count associated with the current command.
|
||||
|
||||
# Special Commands
|
||||
|
||||
This section shows information about special shell commands.
|
||||
@@ -973,8 +1040,10 @@ There are four special commands ('set', 'map', 'cmap', and 'cmd') for configurat
|
||||
|
||||
Command 'set' is used to set an option which can be boolean, integer, or string:
|
||||
|
||||
set hidden # boolean on
|
||||
set nohidden # boolean off
|
||||
set hidden # boolean enable
|
||||
set hidden true # boolean enable
|
||||
set nohidden # boolean disable
|
||||
set hidden false # boolean disable
|
||||
set hidden! # boolean toggle
|
||||
set scrolloff 10 # integer value
|
||||
set sortby time # string value w/o quotes
|
||||
|
||||
+183
-100
@@ -39,6 +39,7 @@ The following commands are provided by lf:
|
||||
low (default 'L')
|
||||
toggle
|
||||
invert (default 'v')
|
||||
invert-below
|
||||
unselect (default 'u')
|
||||
glob-select
|
||||
glob-unselect
|
||||
@@ -81,6 +82,8 @@ The following commands are provided by lf:
|
||||
mark-remove (modal) (default '"')
|
||||
tag
|
||||
tag-toggle (default 't')
|
||||
maps
|
||||
cmaps
|
||||
|
||||
The following command line commands are provided by lf:
|
||||
|
||||
@@ -91,8 +94,8 @@ The following command line commands are provided by lf:
|
||||
cmd-menu-accept
|
||||
cmd-enter (default '<c-j>' and '<enter>')
|
||||
cmd-interrupt (default '<c-c>')
|
||||
cmd-history-next (default '<c-n>')
|
||||
cmd-history-prev (default '<c-p>')
|
||||
cmd-history-next (default '<c-n>' and '<down>')
|
||||
cmd-history-prev (default '<c-p>' and '<up>')
|
||||
cmd-left (default '<c-b>' and '<left>')
|
||||
cmd-right (default '<c-f>' and '<right>')
|
||||
cmd-home (default '<c-a>' and '<home>')
|
||||
@@ -114,57 +117,62 @@ The following command line commands are provided by lf:
|
||||
|
||||
The following options can be used to customize the behavior of lf:
|
||||
|
||||
anchorfind bool (default on)
|
||||
autoquit bool (default off)
|
||||
cleaner string (default '')
|
||||
dircache bool (default on)
|
||||
dircounts bool (default off)
|
||||
dirfirst bool (default on)
|
||||
dironly bool (default off)
|
||||
dirpreviews bool (default off)
|
||||
drawbox bool (default off)
|
||||
errorfmt string (default "\033[7;31;47m%s\033[0m")
|
||||
filesep string (default "\n")
|
||||
findlen int (default 1)
|
||||
globsearch bool (default off)
|
||||
hidden bool (default off)
|
||||
hiddenfiles []string (default '.*')
|
||||
history bool (default on)
|
||||
icons bool (default off)
|
||||
ifs string (default '')
|
||||
ignorecase bool (default on)
|
||||
ignoredia bool (default on)
|
||||
incfilter bool (default off)
|
||||
incsearch bool (default off)
|
||||
info []string (default '')
|
||||
infotimefmtnew string (default 'Jan _2 15:04')
|
||||
infotimefmtold string (default 'Jan _2 2006')
|
||||
mouse bool (default off)
|
||||
number bool (default off)
|
||||
period int (default 0)
|
||||
preview bool (default on)
|
||||
previewer string (default '')
|
||||
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
||||
ratios []int (default '1:2:3')
|
||||
relativenumber bool (default off)
|
||||
reverse bool (default off)
|
||||
scrolloff int (default 0)
|
||||
selmode string (default 'all')
|
||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default on)
|
||||
smartdia bool (default off)
|
||||
sortby string (default 'natural')
|
||||
tabstop int (default 8)
|
||||
tagfmt string (default "\033[31m%s\033[0m")
|
||||
tempmarks string (default '')
|
||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||
truncatechar string (default '~')
|
||||
waitmsg string (default 'Press any key to continue')
|
||||
wrapscan bool (default on)
|
||||
wrapscroll bool (default off)
|
||||
user_{option} string (default none)
|
||||
anchorfind bool (default true)
|
||||
autoquit bool (default false)
|
||||
cleaner string (default '')
|
||||
cursoractivefmt string (default "\033[7m")
|
||||
cursorparentfmt string (default "\033[7m")
|
||||
cursorpreviewfmt string (default "\033[4m")
|
||||
dircache bool (default true)
|
||||
dircounts bool (default false)
|
||||
dirfirst bool (default true)
|
||||
dironly bool (default false)
|
||||
dirpreviews bool (default false)
|
||||
drawbox bool (default false)
|
||||
errorfmt string (default "\033[7;31;47m")
|
||||
filesep string (default "\n")
|
||||
findlen int (default 1)
|
||||
globsearch bool (default false)
|
||||
hidden bool (default false)
|
||||
hiddenfiles []string (default '.*')
|
||||
history bool (default true)
|
||||
icons bool (default false)
|
||||
ifs string (default '')
|
||||
ignorecase bool (default true)
|
||||
ignoredia bool (default true)
|
||||
incfilter bool (default false)
|
||||
incsearch bool (default false)
|
||||
info []string (default '')
|
||||
infotimefmtnew string (default 'Jan _2 15:04')
|
||||
infotimefmtold string (default 'Jan _2 2006')
|
||||
mouse bool (default false)
|
||||
number bool (default false)
|
||||
numberfmt string (default "\033[33m")
|
||||
period int (default 0)
|
||||
preview bool (default true)
|
||||
previewer string (default '')
|
||||
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
||||
ratios []int (default '1:2:3')
|
||||
relativenumber bool (default false)
|
||||
reverse bool (default false)
|
||||
ruler []string (default 'acc:progress:selection:ind')
|
||||
scrolloff int (default 0)
|
||||
selmode string (default 'all')
|
||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default true)
|
||||
smartdia bool (default false)
|
||||
sortby string (default 'natural')
|
||||
tabstop int (default 8)
|
||||
tagfmt string (default "\033[31m")
|
||||
tempmarks string (default '')
|
||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||
truncatechar string (default '~')
|
||||
waitmsg string (default 'Press any key to continue')
|
||||
wrapscan bool (default true)
|
||||
wrapscroll bool (default false)
|
||||
user_{option} string (default none)
|
||||
|
||||
The following environment variables are exported for shell commands:
|
||||
|
||||
@@ -176,13 +184,16 @@ The following environment variables are exported for shell commands:
|
||||
OLDPWD
|
||||
LF_LEVEL
|
||||
OPENER
|
||||
VISUAL
|
||||
EDITOR
|
||||
PAGER
|
||||
SHELL
|
||||
lf
|
||||
lf_{option}
|
||||
lf_user_{option}
|
||||
lf_width
|
||||
lf_height
|
||||
lf_count
|
||||
|
||||
The following special shell commands are used to customize the behavior of lf
|
||||
when defined:
|
||||
@@ -231,7 +242,7 @@ effects:
|
||||
Enter a directory or open a file. Also works on the preview window.
|
||||
|
||||
Scroll wheel
|
||||
Scroll up or down.
|
||||
Move up or down. If Ctrl is pressed, scroll up or down.
|
||||
|
||||
# Configuration
|
||||
|
||||
@@ -325,7 +336,9 @@ Change the current working directory to the next/previous jumplist item.
|
||||
top (default 'gg' and '<home>')
|
||||
bottom (default 'G' and '<end>')
|
||||
|
||||
Move the current file selection to the top/bottom of the directory.
|
||||
Move the current file selection to the top/bottom of the directory. A count can
|
||||
be specified to move to a specific line, for example use '3G' to move to the
|
||||
third line.
|
||||
|
||||
high (default 'H')
|
||||
middle (default 'M')
|
||||
@@ -345,6 +358,20 @@ You can define a new command to select all files in the directory by combining
|
||||
'invert' with 'unselect' (i.e. 'cmd select-all :unselect; invert'), though this
|
||||
will also remove selections in other directories.
|
||||
|
||||
invert-below
|
||||
|
||||
Reverse the selection (i.e. 'toggle') of all files at or after the current file
|
||||
in the current directory.
|
||||
|
||||
To select a contiguous block of files, use this command on the first file you
|
||||
want to select. Then, move down to the first file you do *not* want to select
|
||||
(the one after the end of the desired selection) and use this command again.
|
||||
This achieves an effect similar to the visual mode in vim.
|
||||
|
||||
This command is experimental and may be removed once a better replacement for
|
||||
the visual mode is implemented in 'lf'. If you'd like to experiment with using
|
||||
this command, you should bind it to a key (e.g. 'V') for a better experience.
|
||||
|
||||
unselect (default 'u')
|
||||
|
||||
Remove the selection of all files in all directories.
|
||||
@@ -552,8 +579,8 @@ Execute the current line.
|
||||
|
||||
Interrupt the current shell-pipe command and return to the normal mode.
|
||||
|
||||
cmd-history-next (default '<c-n>')
|
||||
cmd-history-prev (default '<c-p>')
|
||||
cmd-history-next (default '<c-n>' and '<down>')
|
||||
cmd-history-prev (default '<c-p>' and '<up>')
|
||||
|
||||
Go to next/previous item in the history.
|
||||
|
||||
@@ -609,17 +636,22 @@ Delete the next word in forward direction.
|
||||
|
||||
Capitalize/uppercase/lowercase the current word and jump to the next word.
|
||||
|
||||
maps
|
||||
cmaps
|
||||
|
||||
List all key mappings in normal mode or command-line editing mode.
|
||||
|
||||
# Options
|
||||
|
||||
This section shows information about options to customize the behavior.
|
||||
Character ':' is used as the separator for list options '[]int' and '[]string'.
|
||||
|
||||
anchorfind bool (default on)
|
||||
anchorfind bool (default true)
|
||||
|
||||
When this option is enabled, find command starts matching patterns from the
|
||||
beginning of file names, otherwise, it can match at an arbitrary position.
|
||||
|
||||
autoquit bool (default off)
|
||||
autoquit bool (default false)
|
||||
|
||||
Automatically quit server when there are no clients left connected.
|
||||
|
||||
@@ -632,11 +664,32 @@ file, (1) current file name, (2) width, (3) height, (4) horizontal position,
|
||||
and (5) vertical position of preview pane respectively. Preview clearing is
|
||||
disabled when the value of this option is left empty.
|
||||
|
||||
dircache bool (default on)
|
||||
cursoractivefmt string (default "\033[7m")
|
||||
cursorparentfmt string (default "\033[7m")
|
||||
cursorpreviewfmt string (default "\033[4m")
|
||||
|
||||
Format strings for highlighting the cursor. 'cursoractivefmt' applies in the
|
||||
current directory pane, 'cursorparentfmt' applies in panes that show parents
|
||||
of the current directory, and 'cursorpreviewfmt' applies in panes that preview
|
||||
directories.
|
||||
|
||||
The default is to make the active cursor and the parent directory cursor
|
||||
inverted. The preview cursor is underlined.
|
||||
|
||||
Some other possibilities to consider for the preview or parent cursors: an empty
|
||||
string for no cursor, "\033[7;2m" for dimmed inverted text (visibility varies
|
||||
by terminal), "\033[7;90m" for inverted text with grey (aka "brightblack")
|
||||
background.
|
||||
|
||||
If the format string contains the characters '%s', it is interpreted as a format
|
||||
string for 'fmt.Sprintf'. Such a string should end with the terminal reset
|
||||
sequence. For example, "\033[4m%s\033[0m" has the same effect as "\033[4m".
|
||||
|
||||
dircache bool (default true)
|
||||
|
||||
Cache directory contents.
|
||||
|
||||
dircounts bool (default off)
|
||||
dircounts bool (default false)
|
||||
|
||||
When this option is enabled, directory sizes show the number of items inside
|
||||
instead of the total size of the directory, which needs to be calculated for
|
||||
@@ -647,27 +700,31 @@ disabled by default for performance reasons. This option only has an effect when
|
||||
999 items are counted per directory at most, and bigger directories are shown as
|
||||
'999+'.
|
||||
|
||||
dirfirst bool (default on)
|
||||
dirfirst bool (default true)
|
||||
|
||||
Show directories first above regular files.
|
||||
|
||||
dironly bool (default off)
|
||||
dironly bool (default false)
|
||||
|
||||
Show only directories.
|
||||
|
||||
dirpreviews bool (default false)
|
||||
|
||||
If enabled, directories will also be passed to the previewer script. This allows
|
||||
custom previews for directories.
|
||||
|
||||
dirpreviews bool (default off)
|
||||
|
||||
Show only directories.
|
||||
|
||||
drawbox bool (default off)
|
||||
drawbox bool (default false)
|
||||
|
||||
Draw boxes around panes with box drawing characters.
|
||||
|
||||
errorfmt string (default "\033[7;31;47m%s\033[0m")
|
||||
errorfmt string (default "\033[7;31;47m")
|
||||
|
||||
Format string of error messages shown in the bottom message line.
|
||||
|
||||
If the format string contains the characters '%s', it is interpreted as a format
|
||||
string for 'fmt.Sprintf'. Such a string should end with the terminal reset
|
||||
sequence. For example, "\033[4m%s\033[0m" has the same effect as "\033[4m".
|
||||
|
||||
filesep string (default "\n")
|
||||
|
||||
File separator used in environment variables 'fs' and 'fx'.
|
||||
@@ -677,14 +734,14 @@ File separator used in environment variables 'fs' and 'fx'.
|
||||
Number of characters prompted for the find command. When this value is set to 0,
|
||||
find command prompts until there is only a single match left.
|
||||
|
||||
globsearch bool (default off)
|
||||
globsearch bool (default false)
|
||||
|
||||
When this option is enabled, search command patterns are considered as globs,
|
||||
otherwise they are literals. With globbing, '*' matches any sequence, '?'
|
||||
matches any character, and '[...]' or '[^...] matches character sets or ranges.
|
||||
matches any character, and '[...]' or '[^...]' matches character sets or ranges.
|
||||
Otherwise, these characters are interpreted as they are.
|
||||
|
||||
hidden bool (default off)
|
||||
hidden bool (default false)
|
||||
|
||||
Show hidden files. On Unix systems, hidden files are determined by the value
|
||||
of 'hiddenfiles'. On Windows, only files with hidden attributes are considered
|
||||
@@ -694,15 +751,16 @@ hidden files.
|
||||
|
||||
List of hidden file glob patterns. Patterns can be given as relative or
|
||||
absolute paths. Globbing supports the usual special characters, '*' to match any
|
||||
sequence, '?' to match any character, and '[...]' or '[^...] to match character
|
||||
sequence, '?' to match any character, and '[...]' or '[^...]' to match character
|
||||
sets or ranges. In addition, if a pattern starts with '!', then its matches are
|
||||
excluded from hidden files.
|
||||
excluded from hidden files. To add multiple patterns, use ':' as a separator.
|
||||
Example: '.*:lost+found:*.bak'
|
||||
|
||||
history bool (default on)
|
||||
history bool (default true)
|
||||
|
||||
Save command history.
|
||||
|
||||
icons bool (default off)
|
||||
icons bool (default false)
|
||||
|
||||
Show icons before each item in the list.
|
||||
|
||||
@@ -715,19 +773,19 @@ a POSIX shell syntax and so it can fail for non-POSIX shells. This option has
|
||||
no effect when the value is left empty. This option does not have any effect on
|
||||
Windows.
|
||||
|
||||
ignorecase bool (default on)
|
||||
ignorecase bool (default true)
|
||||
|
||||
Ignore case in sorting and search patterns.
|
||||
|
||||
ignoredia bool (default on)
|
||||
ignoredia bool (default true)
|
||||
|
||||
Ignore diacritics in sorting and search patterns.
|
||||
|
||||
incsearch bool (default off)
|
||||
incsearch bool (default false)
|
||||
|
||||
Jump to the first match after each keystroke during searching.
|
||||
|
||||
incfilter bool (default off)
|
||||
incfilter bool (default false)
|
||||
|
||||
Apply filter pattern after each keystroke during filtering.
|
||||
|
||||
@@ -748,16 +806,20 @@ year.
|
||||
Format string of the file time shown in the info column when it doesn't match
|
||||
this year.
|
||||
|
||||
mouse bool (default off)
|
||||
mouse bool (default false)
|
||||
|
||||
Send mouse events as input.
|
||||
|
||||
number bool (default off)
|
||||
number bool (default false)
|
||||
|
||||
Show the position number for directory items at the left side of pane. When
|
||||
'relativenumber' option is enabled, only the current line shows the absolute
|
||||
position and relative positions are shown for the rest.
|
||||
|
||||
numberfmt string (default "\033[33m")
|
||||
|
||||
Format string of the position number for each line.
|
||||
|
||||
period int (default 0)
|
||||
|
||||
Set the interval in seconds for periodic checks of directory updates. This works
|
||||
@@ -767,7 +829,7 @@ external process changing the displayed directory and you are not doing anything
|
||||
in lf. Periodic checks are disabled when the value of this option is set to
|
||||
zero.
|
||||
|
||||
preview bool (default on)
|
||||
preview bool (default true)
|
||||
|
||||
Show previews of files and directories at the right most pane. If the file
|
||||
has more lines than the preview pane, rest of the lines are not read. Files
|
||||
@@ -803,15 +865,20 @@ List of ratios of pane widths. Number of items in the list determines the number
|
||||
of panes in the ui. When 'preview' option is enabled, the right most number is
|
||||
used for the width of preview pane.
|
||||
|
||||
relativenumber bool (default off)
|
||||
relativenumber bool (default false)
|
||||
|
||||
Show the position number relative to the current line. When 'number' is enabled,
|
||||
current line shows the absolute position, otherwise nothing is shown.
|
||||
|
||||
reverse bool (default off)
|
||||
reverse bool (default false)
|
||||
|
||||
Reverse the direction of sort.
|
||||
|
||||
ruler []string (default 'acc:progress:selection:ind')
|
||||
|
||||
List of information shown in status line ruler. Currently supported information
|
||||
types are 'acc', 'progress', 'selection', 'ind' and 'df'.
|
||||
|
||||
selmode string (default 'all')
|
||||
|
||||
Selection mode for commands. When set to 'all' it will use the selected files
|
||||
@@ -839,12 +906,12 @@ Command line flag used to pass shell commands.
|
||||
|
||||
List of shell options to pass to the shell executable.
|
||||
|
||||
smartcase bool (default on)
|
||||
smartcase bool (default true)
|
||||
|
||||
Override 'ignorecase' option when the pattern contains an uppercase character.
|
||||
This option has no effect when 'ignorecase' is disabled.
|
||||
|
||||
smartdia bool (default off)
|
||||
smartdia bool (default false)
|
||||
|
||||
Override 'ignoredia' option when the pattern contains a character with
|
||||
diacritic. This option has no effect when 'ignoredia' is disabled.
|
||||
@@ -858,10 +925,14 @@ Sort type for directories. Currently supported sort types are 'natural', 'name',
|
||||
|
||||
Number of space characters to show for horizontal tabulation (U+0009) character.
|
||||
|
||||
tagfmt string (default "\033[31m%s\033[0m")
|
||||
tagfmt string (default "\033[31m")
|
||||
|
||||
Format string of the tags.
|
||||
|
||||
If the format string contains the characters '%s', it is interpreted as a format
|
||||
string for 'fmt.Sprintf'. Such a string should end with the terminal reset
|
||||
sequence. For example, "\033[4m%s\033[0m" has the same effect as "\033[4m".
|
||||
|
||||
tempmarks string (default '')
|
||||
|
||||
Marks to be considered temporary (e.g. 'abc' refers to marks 'a', 'b',
|
||||
@@ -881,11 +952,11 @@ Truncate character shown at the end when the file name does not fit to the pane.
|
||||
|
||||
String shown after commands of shell-wait type.
|
||||
|
||||
wrapscan bool (default on)
|
||||
wrapscan bool (default true)
|
||||
|
||||
Searching can wrap around the file list.
|
||||
|
||||
wrapscroll bool (default off)
|
||||
wrapscroll bool (default false)
|
||||
|
||||
Scrolling can wrap around the file list.
|
||||
|
||||
@@ -937,23 +1008,29 @@ $LF_LEVEL) "' in your shell configuration file (e.g. '~/.bashrc').
|
||||
|
||||
OPENER
|
||||
|
||||
If this variable is set in the environment, use the same value, otherwise set
|
||||
the value to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
||||
If this variable is set in the environment, use the same value. Otherwise,
|
||||
this is set to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
||||
|
||||
EDITOR
|
||||
|
||||
If this variable is set in the environment, use the same value, otherwise set
|
||||
the value to 'vi' on Unix, 'notepad' in Windows.
|
||||
If VISUAL is set in the environment, use its value. Otherwise, use the value of
|
||||
the environment variable EDITOR. If neither variable is set, this is set to 'vi'
|
||||
on Unix, 'notepad' in Windows.
|
||||
|
||||
PAGER
|
||||
|
||||
If this variable is set in the environment, use the same value, otherwise set
|
||||
the value to 'less' on Unix, 'more' in Windows.
|
||||
If this variable is set in the environment, use the same value. Otherwise,
|
||||
this is set to 'less' on Unix, 'more' in Windows.
|
||||
|
||||
SHELL
|
||||
|
||||
If this variable is set in the environment, use the same value, otherwise set
|
||||
the value to 'sh' on Unix, 'cmd' in Windows.
|
||||
If this variable is set in the environment, use the same value. Otherwise,
|
||||
this is set to 'sh' on Unix, 'cmd' in Windows.
|
||||
|
||||
lf
|
||||
|
||||
Absolute path to the currently running lf binary, if it can be found. Otherwise,
|
||||
this is set to the string 'lf'.
|
||||
|
||||
lf_{option}
|
||||
|
||||
@@ -968,6 +1045,10 @@ Value of the user_{option}.
|
||||
|
||||
Width/Height of the terminal.
|
||||
|
||||
lf_count
|
||||
|
||||
Value of the count associated with the current command.
|
||||
|
||||
# Special Commands
|
||||
|
||||
This section shows information about special shell commands.
|
||||
@@ -1031,8 +1112,10 @@ configuration.
|
||||
|
||||
Command 'set' is used to set an option which can be boolean, integer, or string:
|
||||
|
||||
set hidden # boolean on
|
||||
set nohidden # boolean off
|
||||
set hidden # boolean enable
|
||||
set hidden true # boolean enable
|
||||
set nohidden # boolean disable
|
||||
set hidden false # boolean disable
|
||||
set hidden! # boolean toggle
|
||||
set scrolloff 10 # integer value
|
||||
set sortby time # string value w/o quotes
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ fi # FILE
|
||||
*.tsx
|
||||
*.jl
|
||||
*.pp
|
||||
*.vue ﵂
|
||||
*.vue
|
||||
*.elm
|
||||
*.swift
|
||||
*.xcplayground
|
||||
|
||||
+3
-2
@@ -5,7 +5,7 @@
|
||||
# mkdir -p ~/.config/fish/functions
|
||||
# ln -s "/path/to/lfcd.fish" ~/.config/fish/functions
|
||||
#
|
||||
# You may also like to assign a key to this command:
|
||||
# You may also like to assign a key (Ctrl-O) to this command:
|
||||
#
|
||||
# bind \co 'set old_tty (stty -g); stty sane; lfcd; stty $old_tty; commandline -f repaint'
|
||||
#
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
function lfcd
|
||||
set tmp (mktemp)
|
||||
lf -last-dir-path=$tmp $argv
|
||||
# `command` is needed in case `lfcd` is aliased to `lf`
|
||||
command lf -last-dir-path=$tmp $argv
|
||||
if test -f "$tmp"
|
||||
set dir (cat $tmp)
|
||||
rm -f $tmp
|
||||
|
||||
+3
-2
@@ -8,7 +8,7 @@
|
||||
# source "$LFCD"
|
||||
# fi
|
||||
#
|
||||
# You may also like to assign a key to this command:
|
||||
# You may also like to assign a key (Ctrl-O) to this command:
|
||||
#
|
||||
# bind '"\C-o":"lfcd\C-m"' # bash
|
||||
# bindkey -s '^o' 'lfcd\n' # zsh
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
lfcd () {
|
||||
tmp="$(mktemp)"
|
||||
lf -last-dir-path="$tmp" "$@"
|
||||
# `command` is needed in case `lfcd` is aliased to `lf`
|
||||
command lf -last-dir-path="$tmp" "$@"
|
||||
if [ -f "$tmp" ]; then
|
||||
dir="$(cat "$tmp")"
|
||||
rm -f "$tmp"
|
||||
|
||||
@@ -20,9 +20,15 @@ set ifs "\n"
|
||||
# leave some space at the top and the bottom of the screen
|
||||
set scrolloff 10
|
||||
|
||||
# Use the `dim` attribute instead of underline for the cursor in the preview pane
|
||||
set cursorpreviewfmt "\033[7;2m"
|
||||
|
||||
# use enter for shell commands
|
||||
map <enter> shell
|
||||
|
||||
# show the result of execution of previous commands
|
||||
map ` !true
|
||||
|
||||
# execute current file (must be executable)
|
||||
map x $$f
|
||||
map X !$f
|
||||
@@ -42,6 +48,9 @@ cmd open &{{
|
||||
esac
|
||||
}}
|
||||
|
||||
# mkdir command. See wiki if you want it to select created dir
|
||||
map a :push %mkdir<space>
|
||||
|
||||
# define a custom 'rename' command without prompt for overwrite
|
||||
# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
|
||||
# map r push :rename<space>
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
module github.com/gokcehan/lf
|
||||
|
||||
go 1.12
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/gdamore/tcell/v2 v2.5.4-0.20221019011350-d3cbfcfb7aa3
|
||||
github.com/mattn/go-runewidth v0.0.14
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
|
||||
github.com/djherbis/times v1.5.0
|
||||
github.com/gdamore/tcell/v2 v2.6.0
|
||||
github.com/mattn/go-runewidth v0.0.14
|
||||
golang.org/x/sys v0.7.0
|
||||
golang.org/x/term v0.7.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/gdamore/encoding v1.0.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.3 // indirect
|
||||
golang.org/x/text v0.7.0 // indirect
|
||||
)
|
||||
@@ -1,13 +1,16 @@
|
||||
github.com/djherbis/times v1.5.0 h1:79myA211VwPhFTqUk8xehWrsEO+zcIZj0zT8mXPVARU=
|
||||
github.com/djherbis/times v1.5.0/go.mod h1:5q7FDLvbNg1L/KaBmPcWlVR9NmoKo3+ucqUA3ijQhA0=
|
||||
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell/v2 v2.5.4-0.20221019011350-d3cbfcfb7aa3 h1:e5DXSPPfOBDJY9Z0geFZjEDok0/cUEI5QlPeTmqPV4I=
|
||||
github.com/gdamore/tcell/v2 v2.5.4-0.20221019011350-d3cbfcfb7aa3/go.mod h1:XmCynGHvvGG7UFI6az9zzoEHBvZB1PGf5APwOJMFUyE=
|
||||
github.com/gdamore/tcell/v2 v2.6.0 h1:OKbluoP9VYmJwZwq/iLb4BxwKcwGthaa1YNBJIyCySg=
|
||||
github.com/gdamore/tcell/v2 v2.6.0/go.mod h1:be9omFATkdr0D9qewWW3d+MEvl5dha+Etb5y65J2H8Y=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
|
||||
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
@@ -21,19 +24,21 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
|
||||
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
github.com/djherbis/times v1.5.0 h1:79myA211VwPhFTqUk8xehWrsEO+zcIZj0zT8mXPVARU=
|
||||
github.com/djherbis/times v1.5.0/go.mod h1:5q7FDLvbNg1L/KaBmPcWlVR9NmoKo3+ucqUA3ijQhA0=
|
||||
@@ -51,6 +51,7 @@ The following commands are provided by lf:
|
||||
low (default 'L')
|
||||
toggle
|
||||
invert (default 'v')
|
||||
invert-below
|
||||
unselect (default 'u')
|
||||
glob-select
|
||||
glob-unselect
|
||||
@@ -93,6 +94,8 @@ The following commands are provided by lf:
|
||||
mark-remove (modal) (default '"')
|
||||
tag
|
||||
tag-toggle (default 't')
|
||||
maps
|
||||
cmaps
|
||||
.EE
|
||||
.PP
|
||||
The following command line commands are provided by lf:
|
||||
@@ -105,8 +108,8 @@ The following command line commands are provided by lf:
|
||||
cmd-menu-accept
|
||||
cmd-enter (default '<c-j>' and '<enter>')
|
||||
cmd-interrupt (default '<c-c>')
|
||||
cmd-history-next (default '<c-n>')
|
||||
cmd-history-prev (default '<c-p>')
|
||||
cmd-history-next (default '<c-n>' and '<down>')
|
||||
cmd-history-prev (default '<c-p>' and '<up>')
|
||||
cmd-left (default '<c-b>' and '<left>')
|
||||
cmd-right (default '<c-f>' and '<right>')
|
||||
cmd-home (default '<c-a>' and '<home>')
|
||||
@@ -130,57 +133,62 @@ The following command line commands are provided by lf:
|
||||
The following options can be used to customize the behavior of lf:
|
||||
.PP
|
||||
.EX
|
||||
anchorfind bool (default on)
|
||||
autoquit bool (default off)
|
||||
cleaner string (default '')
|
||||
dircache bool (default on)
|
||||
dircounts bool (default off)
|
||||
dirfirst bool (default on)
|
||||
dironly bool (default off)
|
||||
dirpreviews bool (default off)
|
||||
drawbox bool (default off)
|
||||
errorfmt string (default "\e033[7;31;47m%s\e033[0m")
|
||||
filesep string (default "\en")
|
||||
findlen int (default 1)
|
||||
globsearch bool (default off)
|
||||
hidden bool (default off)
|
||||
hiddenfiles []string (default '.*')
|
||||
history bool (default on)
|
||||
icons bool (default off)
|
||||
ifs string (default '')
|
||||
ignorecase bool (default on)
|
||||
ignoredia bool (default on)
|
||||
incfilter bool (default off)
|
||||
incsearch bool (default off)
|
||||
info []string (default '')
|
||||
infotimefmtnew string (default 'Jan _2 15:04')
|
||||
infotimefmtold string (default 'Jan _2 2006')
|
||||
mouse bool (default off)
|
||||
number bool (default off)
|
||||
period int (default 0)
|
||||
preview bool (default on)
|
||||
previewer string (default '')
|
||||
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m")
|
||||
ratios []int (default '1:2:3')
|
||||
relativenumber bool (default off)
|
||||
reverse bool (default off)
|
||||
scrolloff int (default 0)
|
||||
selmode string (default 'all')
|
||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default on)
|
||||
smartdia bool (default off)
|
||||
sortby string (default 'natural')
|
||||
tabstop int (default 8)
|
||||
tagfmt string (default "\e033[31m%s\e033[0m")
|
||||
tempmarks string (default '')
|
||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||
truncatechar string (default '~')
|
||||
waitmsg string (default 'Press any key to continue')
|
||||
wrapscan bool (default on)
|
||||
wrapscroll bool (default off)
|
||||
user_{option} string (default none)
|
||||
anchorfind bool (default true)
|
||||
autoquit bool (default false)
|
||||
cleaner string (default '')
|
||||
cursoractivefmt string (default "\e033[7m")
|
||||
cursorparentfmt string (default "\e033[7m")
|
||||
cursorpreviewfmt string (default "\e033[4m")
|
||||
dircache bool (default true)
|
||||
dircounts bool (default false)
|
||||
dirfirst bool (default true)
|
||||
dironly bool (default false)
|
||||
dirpreviews bool (default false)
|
||||
drawbox bool (default false)
|
||||
errorfmt string (default "\e033[7;31;47m")
|
||||
filesep string (default "\en")
|
||||
findlen int (default 1)
|
||||
globsearch bool (default false)
|
||||
hidden bool (default false)
|
||||
hiddenfiles []string (default '.*')
|
||||
history bool (default true)
|
||||
icons bool (default false)
|
||||
ifs string (default '')
|
||||
ignorecase bool (default true)
|
||||
ignoredia bool (default true)
|
||||
incfilter bool (default false)
|
||||
incsearch bool (default false)
|
||||
info []string (default '')
|
||||
infotimefmtnew string (default 'Jan _2 15:04')
|
||||
infotimefmtold string (default 'Jan _2 2006')
|
||||
mouse bool (default false)
|
||||
number bool (default false)
|
||||
numberfmt string (default "\e033[33m")
|
||||
period int (default 0)
|
||||
preview bool (default true)
|
||||
previewer string (default '')
|
||||
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m")
|
||||
ratios []int (default '1:2:3')
|
||||
relativenumber bool (default false)
|
||||
reverse bool (default false)
|
||||
ruler []string (default 'acc:progress:selection:ind')
|
||||
scrolloff int (default 0)
|
||||
selmode string (default 'all')
|
||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default true)
|
||||
smartdia bool (default false)
|
||||
sortby string (default 'natural')
|
||||
tabstop int (default 8)
|
||||
tagfmt string (default "\e033[31m")
|
||||
tempmarks string (default '')
|
||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||
truncatechar string (default '~')
|
||||
waitmsg string (default 'Press any key to continue')
|
||||
wrapscan bool (default true)
|
||||
wrapscroll bool (default false)
|
||||
user_{option} string (default none)
|
||||
.EE
|
||||
.PP
|
||||
The following environment variables are exported for shell commands:
|
||||
@@ -194,13 +202,16 @@ The following environment variables are exported for shell commands:
|
||||
OLDPWD
|
||||
LF_LEVEL
|
||||
OPENER
|
||||
VISUAL
|
||||
EDITOR
|
||||
PAGER
|
||||
SHELL
|
||||
lf
|
||||
lf_{option}
|
||||
lf_user_{option}
|
||||
lf_width
|
||||
lf_height
|
||||
lf_count
|
||||
.EE
|
||||
.PP
|
||||
The following special shell commands are used to customize the behavior of lf when defined:
|
||||
@@ -259,7 +270,7 @@ If the 'mouse' option is enabled, mouse buttons have the following default effec
|
||||
.PP
|
||||
.EX
|
||||
Scroll wheel
|
||||
Scroll up or down.
|
||||
Move up or down. If Ctrl is pressed, scroll up or down.
|
||||
.EE
|
||||
.SH CONFIGURATION
|
||||
Configuration files should be located at:
|
||||
@@ -370,7 +381,7 @@ Change the current working directory to the next/previous jumplist item.
|
||||
bottom (default 'G' and '<end>')
|
||||
.EE
|
||||
.PP
|
||||
Move the current file selection to the top/bottom of the directory.
|
||||
Move the current file selection to the top/bottom of the directory. A count can be specified to move to a specific line, for example use `3G` to move to the third line.
|
||||
.PP
|
||||
.EX
|
||||
high (default 'H')
|
||||
@@ -392,6 +403,16 @@ Toggle the selection of the current file or files given as arguments.
|
||||
.PP
|
||||
Reverse the selection of all files in the current directory (i.e. 'toggle' all files). Selections in other directories are not effected by this command. You can define a new command to select all files in the directory by combining 'invert' with 'unselect' (i.e. 'cmd select-all :unselect; invert'), though this will also remove selections in other directories.
|
||||
.PP
|
||||
.EX
|
||||
invert-below
|
||||
.EE
|
||||
.PP
|
||||
Reverse the selection (i.e. 'toggle') of all files at or after the current file in the current directory.
|
||||
.PP
|
||||
To select a contiguous block of files, use this command on the first file you want to select. Then, move down to the first file you do *not* want to select (the one after the end of the desired selection) and use this command again. This achieves an effect similar to the visual mode in vim.
|
||||
.PP
|
||||
This command is experimental and may be removed once a better replacement for the visual mode is implemented in 'lf'. If you'd like to experiment with using this command, you should bind it to a key (e.g. 'V') for a better experience.
|
||||
.PP
|
||||
.EX
|
||||
unselect (default 'u')
|
||||
.EE
|
||||
@@ -648,8 +669,8 @@ Execute the current line.
|
||||
Interrupt the current shell-pipe command and return to the normal mode.
|
||||
.PP
|
||||
.EX
|
||||
cmd-history-next (default '<c-n>')
|
||||
cmd-history-prev (default '<c-p>')
|
||||
cmd-history-next (default '<c-n>' and '<down>')
|
||||
cmd-history-prev (default '<c-p>' and '<up>')
|
||||
.EE
|
||||
.PP
|
||||
Go to next/previous item in the history.
|
||||
@@ -726,17 +747,24 @@ Delete the next word in forward direction.
|
||||
.EE
|
||||
.PP
|
||||
Capitalize/uppercase/lowercase the current word and jump to the next word.
|
||||
.PP
|
||||
.EX
|
||||
maps
|
||||
cmaps
|
||||
.EE
|
||||
.PP
|
||||
List all key mappings in normal mode or command-line editing mode.
|
||||
.SH OPTIONS
|
||||
This section shows information about options to customize the behavior. Character ':' is used as the separator for list options '[]int' and '[]string'.
|
||||
.PP
|
||||
.EX
|
||||
anchorfind bool (default on)
|
||||
anchorfind bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
When this option is enabled, find command starts matching patterns from the beginning of file names, otherwise, it can match at an arbitrary position.
|
||||
.PP
|
||||
.EX
|
||||
autoquit bool (default off)
|
||||
autoquit bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Automatically quit server when there are no clients left connected.
|
||||
@@ -748,47 +776,63 @@ Automatically quit server when there are no clients left connected.
|
||||
Set the path of a cleaner file. The file should be executable. This file is called if previewing is enabled, the previewer is set, and the previously selected file had its preview cache disabled. Five arguments are passed to the file, (1) current file name, (2) width, (3) height, (4) horizontal position, and (5) vertical position of preview pane respectively. Preview clearing is disabled when the value of this option is left empty.
|
||||
.PP
|
||||
.EX
|
||||
dircache bool (default on)
|
||||
cursoractivefmt string (default "\e033[7m")
|
||||
cursorparentfmt string (default "\e033[7m")
|
||||
cursorpreviewfmt string (default "\e033[4m")
|
||||
.EE
|
||||
.PP
|
||||
Format strings for highlighting the cursor. `cursoractivefmt` applies in the current directory pane, `cursorparentfmt` applies in panes that show parents of the current directory, and `cursorpreviewfmt` applies in panes that preview directories.
|
||||
.PP
|
||||
The default is to make the active cursor and the parent directory cursor inverted. The preview cursor is underlined.
|
||||
.PP
|
||||
Some other possibilities to consider for the preview or parent cursors: an empty string for no cursor, "\e033[7;2m" for dimmed inverted text (visibility varies by terminal), "\e033[7;90m" for inverted text with grey (aka "brightblack") background.
|
||||
.PP
|
||||
If the format string contains the characters `%s`, it is interpreted as a format string for `fmt.Sprintf`. Such a string should end with the terminal reset sequence. For example, "\e033[4m%s\e033[0m" has the same effect as "\e033[4m".
|
||||
.PP
|
||||
.EX
|
||||
dircache bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
Cache directory contents.
|
||||
.PP
|
||||
.EX
|
||||
dircounts bool (default off)
|
||||
dircounts bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
When this option is enabled, directory sizes show the number of items inside instead of the total size of the directory, which needs to be calculated for each directory using 'calcdirsize'. This information needs to be calculated by reading the directory and counting the items inside. Therefore, this option is disabled by default for performance reasons. This option only has an effect when 'info' has a 'size' field and the pane is wide enough to show the information. 999 items are counted per directory at most, and bigger directories are shown as '999+'.
|
||||
.PP
|
||||
.EX
|
||||
dirfirst bool (default on)
|
||||
dirfirst bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
Show directories first above regular files.
|
||||
.PP
|
||||
.EX
|
||||
dironly bool (default off)
|
||||
.EE
|
||||
.PP
|
||||
If enabled, directories will also be passed to the previewer script. This allows custom previews for directories.
|
||||
.PP
|
||||
.EX
|
||||
dirpreviews bool (default off)
|
||||
dironly bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Show only directories.
|
||||
.PP
|
||||
.EX
|
||||
drawbox bool (default off)
|
||||
dirpreviews bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
If enabled, directories will also be passed to the previewer script. This allows custom previews for directories.
|
||||
.PP
|
||||
.EX
|
||||
drawbox bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Draw boxes around panes with box drawing characters.
|
||||
.PP
|
||||
.EX
|
||||
errorfmt string (default "\e033[7;31;47m%s\e033[0m")
|
||||
errorfmt string (default "\e033[7;31;47m")
|
||||
.EE
|
||||
.PP
|
||||
Format string of error messages shown in the bottom message line.
|
||||
.PP
|
||||
If the format string contains the characters `%s`, it is interpreted as a format string for `fmt.Sprintf`. Such a string should end with the terminal reset sequence. For example, "\e033[4m%s\e033[0m" has the same effect as "\e033[4m".
|
||||
.PP
|
||||
.EX
|
||||
filesep string (default "\en")
|
||||
.EE
|
||||
@@ -802,13 +846,13 @@ File separator used in environment variables 'fs' and 'fx'.
|
||||
Number of characters prompted for the find command. When this value is set to 0, find command prompts until there is only a single match left.
|
||||
.PP
|
||||
.EX
|
||||
globsearch bool (default off)
|
||||
globsearch bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
When this option is enabled, search command patterns are considered as globs, otherwise they are literals. With globbing, '*' matches any sequence, '?' matches any character, and '[...]' or '[^...] matches character sets or ranges. Otherwise, these characters are interpreted as they are.
|
||||
When this option is enabled, search command patterns are considered as globs, otherwise they are literals. With globbing, '*' matches any sequence, '?' matches any character, and '[...]' or '[^...]' matches character sets or ranges. Otherwise, these characters are interpreted as they are.
|
||||
.PP
|
||||
.EX
|
||||
hidden bool (default off)
|
||||
hidden bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Show hidden files. On Unix systems, hidden files are determined by the value of 'hiddenfiles'. On Windows, only files with hidden attributes are considered hidden files.
|
||||
@@ -817,16 +861,16 @@ Show hidden files. On Unix systems, hidden files are determined by the value of
|
||||
hiddenfiles []string (default '.*')
|
||||
.EE
|
||||
.PP
|
||||
List of hidden file glob patterns. Patterns can be given as relative or absolute paths. Globbing supports the usual special characters, '*' to match any sequence, '?' to match any character, and '[...]' or '[^...] to match character sets or ranges. In addition, if a pattern starts with '!', then its matches are excluded from hidden files.
|
||||
List of hidden file glob patterns. Patterns can be given as relative or absolute paths. Globbing supports the usual special characters, '*' to match any sequence, '?' to match any character, and '[...]' or '[^...]' to match character sets or ranges. In addition, if a pattern starts with '!', then its matches are excluded from hidden files. To add multiple patterns, use ':' as a separator. Example: '.*:lost+found:*.bak'
|
||||
.PP
|
||||
.EX
|
||||
history bool (default on)
|
||||
history bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
Save command history.
|
||||
.PP
|
||||
.EX
|
||||
icons bool (default off)
|
||||
icons bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Show icons before each item in the list.
|
||||
@@ -838,25 +882,25 @@ Show icons before each item in the list.
|
||||
Sets 'IFS' variable in shell commands. It works by adding the assignment to the beginning of the command string as "IFS='...'; ...". The reason is that 'IFS' variable is not inherited by the shell for security reasons. This method assumes a POSIX shell syntax and so it can fail for non-POSIX shells. This option has no effect when the value is left empty. This option does not have any effect on Windows.
|
||||
.PP
|
||||
.EX
|
||||
ignorecase bool (default on)
|
||||
ignorecase bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
Ignore case in sorting and search patterns.
|
||||
.PP
|
||||
.EX
|
||||
ignoredia bool (default on)
|
||||
ignoredia bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
Ignore diacritics in sorting and search patterns.
|
||||
.PP
|
||||
.EX
|
||||
incsearch bool (default off)
|
||||
incsearch bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Jump to the first match after each keystroke during searching.
|
||||
.PP
|
||||
.EX
|
||||
incfilter bool (default off)
|
||||
incfilter bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Apply filter pattern after each keystroke during filtering.
|
||||
@@ -880,17 +924,23 @@ Format string of the file time shown in the info column when it matches this yea
|
||||
Format string of the file time shown in the info column when it doesn't match this year.
|
||||
.PP
|
||||
.EX
|
||||
mouse bool (default off)
|
||||
mouse bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Send mouse events as input.
|
||||
.PP
|
||||
.EX
|
||||
number bool (default off)
|
||||
number bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Show the position number for directory items at the left side of pane. When 'relativenumber' option is enabled, only the current line shows the absolute position and relative positions are shown for the rest.
|
||||
.PP
|
||||
.EX
|
||||
numberfmt string (default "\e033[33m")
|
||||
.EE
|
||||
.PP
|
||||
Format string of the position number for each line.
|
||||
.PP
|
||||
.EX
|
||||
period int (default 0)
|
||||
.EE
|
||||
@@ -898,7 +948,7 @@ Show the position number for directory items at the left side of pane. When 'rel
|
||||
Set the interval in seconds for periodic checks of directory updates. This works by periodically calling the 'load' command. Note that directories are already updated automatically in many cases. This option can be useful when there is an external process changing the displayed directory and you are not doing anything in lf. Periodic checks are disabled when the value of this option is set to zero.
|
||||
.PP
|
||||
.EX
|
||||
preview bool (default on)
|
||||
preview bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
Show previews of files and directories at the right most pane. If the file has more lines than the preview pane, rest of the lines are not read. Files containing the null character (U+0000) in the read portion are considered binary files and displayed as 'binary'.
|
||||
@@ -922,17 +972,23 @@ Format string of the prompt shown in the top line. Special expansions are provid
|
||||
List of ratios of pane widths. Number of items in the list determines the number of panes in the ui. When 'preview' option is enabled, the right most number is used for the width of preview pane.
|
||||
.PP
|
||||
.EX
|
||||
relativenumber bool (default off)
|
||||
relativenumber bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Show the position number relative to the current line. When 'number' is enabled, current line shows the absolute position, otherwise nothing is shown.
|
||||
.PP
|
||||
.EX
|
||||
reverse bool (default off)
|
||||
reverse bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Reverse the direction of sort.
|
||||
.PP
|
||||
.EX
|
||||
ruler []string (default 'acc:progress:selection:ind')
|
||||
.EE
|
||||
.PP
|
||||
List of information shown in status line ruler. Currently supported information types are 'acc', 'progress', 'selection', 'ind' and 'df'.
|
||||
.PP
|
||||
.EX
|
||||
selmode string (default 'all')
|
||||
.EE
|
||||
@@ -964,13 +1020,13 @@ Command line flag used to pass shell commands.
|
||||
List of shell options to pass to the shell executable.
|
||||
.PP
|
||||
.EX
|
||||
smartcase bool (default on)
|
||||
smartcase bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
Override 'ignorecase' option when the pattern contains an uppercase character. This option has no effect when 'ignorecase' is disabled.
|
||||
.PP
|
||||
.EX
|
||||
smartdia bool (default off)
|
||||
smartdia bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Override 'ignoredia' option when the pattern contains a character with diacritic. This option has no effect when 'ignoredia' is disabled.
|
||||
@@ -988,11 +1044,13 @@ Sort type for directories. Currently supported sort types are 'natural', 'name',
|
||||
Number of space characters to show for horizontal tabulation (U+0009) character.
|
||||
.PP
|
||||
.EX
|
||||
tagfmt string (default "\e033[31m%s\e033[0m")
|
||||
tagfmt string (default "\e033[31m")
|
||||
.EE
|
||||
.PP
|
||||
Format string of the tags.
|
||||
.PP
|
||||
If the format string contains the characters `%s`, it is interpreted as a format string for `fmt.Sprintf`. Such a string should end with the terminal reset sequence. For example, "\e033[4m%s\e033[0m" has the same effect as "\e033[4m".
|
||||
.PP
|
||||
.EX
|
||||
tempmarks string (default '')
|
||||
.EE
|
||||
@@ -1018,13 +1076,13 @@ Truncate character shown at the end when the file name does not fit to the pane.
|
||||
String shown after commands of shell-wait type.
|
||||
.PP
|
||||
.EX
|
||||
wrapscan bool (default on)
|
||||
wrapscan bool (default true)
|
||||
.EE
|
||||
.PP
|
||||
Searching can wrap around the file list.
|
||||
.PP
|
||||
.EX
|
||||
wrapscroll bool (default off)
|
||||
wrapscroll bool (default false)
|
||||
.EE
|
||||
.PP
|
||||
Scrolling can wrap around the file list.
|
||||
@@ -1083,25 +1141,31 @@ The value of this variable is set to the current nesting level when you run lf f
|
||||
OPENER
|
||||
.EE
|
||||
.PP
|
||||
If this variable is set in the environment, use the same value, otherwise set the value to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
||||
If this variable is set in the environment, use the same value. Otherwise, this is set to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
||||
.PP
|
||||
.EX
|
||||
EDITOR
|
||||
.EE
|
||||
.PP
|
||||
If this variable is set in the environment, use the same value, otherwise set the value to 'vi' on Unix, 'notepad' in Windows.
|
||||
If VISUAL is set in the environment, use its value. Otherwise, use the value of the environment variable EDITOR. If neither variable is set, this is set to 'vi' on Unix, 'notepad' in Windows.
|
||||
.PP
|
||||
.EX
|
||||
PAGER
|
||||
.EE
|
||||
.PP
|
||||
If this variable is set in the environment, use the same value, otherwise set the value to 'less' on Unix, 'more' in Windows.
|
||||
If this variable is set in the environment, use the same value. Otherwise, this is set to 'less' on Unix, 'more' in Windows.
|
||||
.PP
|
||||
.EX
|
||||
SHELL
|
||||
.EE
|
||||
.PP
|
||||
If this variable is set in the environment, use the same value, otherwise set the value to 'sh' on Unix, 'cmd' in Windows.
|
||||
If this variable is set in the environment, use the same value. Otherwise, this is set to 'sh' on Unix, 'cmd' in Windows.
|
||||
.PP
|
||||
.EX
|
||||
lf
|
||||
.EE
|
||||
.PP
|
||||
Absolute path to the currently running lf binary, if it can be found. Otherwise, this is set to the string 'lf'.
|
||||
.PP
|
||||
.EX
|
||||
lf_{option}
|
||||
@@ -1121,6 +1185,12 @@ Value of the user_{option}.
|
||||
.EE
|
||||
.PP
|
||||
Width/Height of the terminal.
|
||||
.PP
|
||||
.EX
|
||||
lf_count
|
||||
.EE
|
||||
.PP
|
||||
Value of the count associated with the current command.
|
||||
.SH SPECIAL COMMANDS
|
||||
This section shows information about special shell commands.
|
||||
.PP
|
||||
@@ -1195,8 +1265,10 @@ There are four special commands ('set', 'map', 'cmap', and 'cmd') for configurat
|
||||
Command 'set' is used to set an option which can be boolean, integer, or string:
|
||||
.PP
|
||||
.EX
|
||||
set hidden # boolean on
|
||||
set nohidden # boolean off
|
||||
set hidden # boolean enable
|
||||
set hidden true # boolean enable
|
||||
set nohidden # boolean disable
|
||||
set hidden false # boolean disable
|
||||
set hidden! # boolean toggle
|
||||
set scrolloff 10 # integer value
|
||||
set sortby time # string value w/o quotes
|
||||
|
||||
@@ -79,6 +79,13 @@ func exportEnvVars() {
|
||||
level++
|
||||
|
||||
os.Setenv("LF_LEVEL", strconv.Itoa(level))
|
||||
|
||||
lfPath, err := os.Executable()
|
||||
if err != nil {
|
||||
log.Printf("getting path to lf binary: %s", err)
|
||||
lfPath = "lf"
|
||||
}
|
||||
os.Setenv("lf", lfPath)
|
||||
}
|
||||
|
||||
// used by exportOpts below
|
||||
|
||||
@@ -388,11 +388,15 @@ type nav struct {
|
||||
searchPos int
|
||||
prevFilter []string
|
||||
volatilePreview bool
|
||||
previewTimer *time.Timer
|
||||
previewLoading bool
|
||||
jumpList []string
|
||||
jumpListInd int
|
||||
}
|
||||
|
||||
func (nav *nav) loadDirInternal(path string) *dir {
|
||||
nav.startPreview()
|
||||
|
||||
d := &dir{
|
||||
loading: true,
|
||||
loadTime: time.Now(),
|
||||
@@ -448,6 +452,7 @@ func (nav *nav) checkDir(dir *dir) {
|
||||
return
|
||||
}
|
||||
|
||||
nav.startPreview()
|
||||
dir.loading = true
|
||||
dir.loadTime = now
|
||||
go func() {
|
||||
@@ -465,10 +470,11 @@ func (nav *nav) checkDir(dir *dir) {
|
||||
dir.ignorecase != gOpts.ignorecase ||
|
||||
dir.ignoredia != gOpts.ignoredia:
|
||||
dir.loading = true
|
||||
sd := *dir
|
||||
go func() {
|
||||
dir.sort()
|
||||
dir.loading = false
|
||||
nav.dirChan <- dir
|
||||
sd.sort()
|
||||
sd.loading = false
|
||||
nav.dirChan <- &sd
|
||||
}()
|
||||
}
|
||||
}
|
||||
@@ -511,6 +517,7 @@ func newNav(height int) *nav {
|
||||
tags: make(map[string]string),
|
||||
selectionInd: 0,
|
||||
height: height,
|
||||
previewTimer: time.NewTimer(0),
|
||||
jumpList: make([]string, 0),
|
||||
jumpListInd: -1,
|
||||
}
|
||||
@@ -534,7 +541,6 @@ func (nav *nav) addJumpList() {
|
||||
}
|
||||
|
||||
func (nav *nav) cdJumpListPrev() {
|
||||
// currPath := nav.currDir().path
|
||||
if nav.jumpListInd > 0 {
|
||||
nav.jumpListInd -= 1
|
||||
nav.cd(nav.jumpList[nav.jumpListInd])
|
||||
@@ -814,6 +820,7 @@ func (nav *nav) loadReg(path string, volatile bool) *reg {
|
||||
if !ok || (volatile && r.volatile) {
|
||||
r := ®{loading: true, loadTime: time.Now(), path: path, volatile: true}
|
||||
nav.regCache[path] = r
|
||||
nav.startPreview()
|
||||
nav.previewChan <- path
|
||||
return r
|
||||
}
|
||||
@@ -839,10 +846,17 @@ func (nav *nav) checkReg(reg *reg) {
|
||||
|
||||
if s.ModTime().After(reg.loadTime) {
|
||||
reg.loadTime = now
|
||||
nav.startPreview()
|
||||
nav.previewChan <- reg.path
|
||||
}
|
||||
}
|
||||
|
||||
func (nav *nav) startPreview() {
|
||||
nav.previewTimer.Stop()
|
||||
nav.previewLoading = false
|
||||
nav.previewTimer.Reset(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
func (nav *nav) sort() {
|
||||
for _, d := range nav.dirs {
|
||||
name := d.name()
|
||||
@@ -912,11 +926,13 @@ func (nav *nav) down(dist int) bool {
|
||||
dir.ind = min(maxind, dir.ind)
|
||||
|
||||
dir.pos += dist
|
||||
edge := min(min(nav.height/2, gOpts.scrolloff), maxind-dir.ind)
|
||||
|
||||
// use a smaller value when the height is even and scrolloff is maxed
|
||||
// in order to stay at the same row as much as possible while up/down
|
||||
edge = min(edge, nav.height/2+nav.height%2-1)
|
||||
// use a smaller value for half when the height is even and scrolloff is
|
||||
// maxed in order to stay at the same row while scrolling up and down
|
||||
half := nav.height / 2
|
||||
if nav.height%2 == 0 {
|
||||
half--
|
||||
}
|
||||
edge := min(min(half, gOpts.scrolloff), maxind-dir.ind)
|
||||
|
||||
dir.pos = min(dir.pos, nav.height-edge-1)
|
||||
dir.pos = min(dir.pos, maxind)
|
||||
@@ -1086,6 +1102,19 @@ func (nav *nav) low() bool {
|
||||
return old != dir.ind
|
||||
}
|
||||
|
||||
func (nav *nav) move(index int) bool {
|
||||
old := nav.currDir().ind
|
||||
|
||||
switch {
|
||||
case index < old:
|
||||
return nav.up(old - index)
|
||||
case index > old:
|
||||
return nav.down(index - old)
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (nav *nav) toggleSelection(path string) {
|
||||
if _, ok := nav.selections[path]; ok {
|
||||
delete(nav.selections, path)
|
||||
@@ -1149,14 +1178,22 @@ func (nav *nav) tag(tag string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (nav *nav) invert() {
|
||||
func (nav *nav) invertAfter(ix int) {
|
||||
dir := nav.currDir()
|
||||
for _, f := range dir.files {
|
||||
for _, f := range dir.files[ix:] {
|
||||
path := filepath.Join(dir.path, f.Name())
|
||||
nav.toggleSelection(path)
|
||||
}
|
||||
}
|
||||
|
||||
func (nav *nav) invert() {
|
||||
nav.invertAfter(0)
|
||||
}
|
||||
|
||||
func (nav *nav) invertBelow() {
|
||||
nav.invertAfter(nav.currDir().ind)
|
||||
}
|
||||
|
||||
func (nav *nav) unselect() {
|
||||
nav.selections = make(map[string]int)
|
||||
nav.selectionInd = 0
|
||||
@@ -1426,6 +1463,12 @@ func (nav *nav) rename() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// It is possible for newPath to already have cache entries if it previously
|
||||
// existed and was deleted. In this case the cache entries should be deleted
|
||||
// before loading newPath to prevent displaying a stale preview. However,
|
||||
// this clears only the current instance of lf, and not any other instances.
|
||||
delete(nav.regCache, newPath)
|
||||
delete(nav.dirCache, newPath)
|
||||
dir := nav.loadDir(filepath.Dir(newPath))
|
||||
|
||||
if dir.loading {
|
||||
|
||||
@@ -28,57 +28,62 @@ type sortType struct {
|
||||
}
|
||||
|
||||
var gOpts struct {
|
||||
anchorfind bool
|
||||
autoquit bool
|
||||
dircache bool
|
||||
dircounts bool
|
||||
dironly bool
|
||||
dirpreviews bool
|
||||
drawbox bool
|
||||
globsearch bool
|
||||
icons bool
|
||||
ignorecase bool
|
||||
ignoredia bool
|
||||
incfilter bool
|
||||
incsearch bool
|
||||
mouse bool
|
||||
number bool
|
||||
preview bool
|
||||
relativenumber bool
|
||||
smartcase bool
|
||||
smartdia bool
|
||||
waitmsg string
|
||||
wrapscan bool
|
||||
wrapscroll bool
|
||||
findlen int
|
||||
period int
|
||||
scrolloff int
|
||||
tabstop int
|
||||
errorfmt string
|
||||
filesep string
|
||||
ifs string
|
||||
previewer string
|
||||
cleaner string
|
||||
promptfmt string
|
||||
selmode string
|
||||
shell string
|
||||
shellflag string
|
||||
timefmt string
|
||||
infotimefmtnew string
|
||||
infotimefmtold string
|
||||
truncatechar string
|
||||
ratios []int
|
||||
hiddenfiles []string
|
||||
history bool
|
||||
info []string
|
||||
shellopts []string
|
||||
keys map[string]expr
|
||||
cmdkeys map[string]expr
|
||||
cmds map[string]expr
|
||||
user map[string]string
|
||||
sortType sortType
|
||||
tempmarks string
|
||||
tagfmt string
|
||||
anchorfind bool
|
||||
autoquit bool
|
||||
cursoractivefmt string
|
||||
cursorparentfmt string
|
||||
cursorpreviewfmt string
|
||||
dircache bool
|
||||
dircounts bool
|
||||
dironly bool
|
||||
dirpreviews bool
|
||||
drawbox bool
|
||||
globsearch bool
|
||||
icons bool
|
||||
ignorecase bool
|
||||
ignoredia bool
|
||||
incfilter bool
|
||||
incsearch bool
|
||||
mouse bool
|
||||
number bool
|
||||
preview bool
|
||||
relativenumber bool
|
||||
smartcase bool
|
||||
smartdia bool
|
||||
waitmsg string
|
||||
wrapscan bool
|
||||
wrapscroll bool
|
||||
findlen int
|
||||
period int
|
||||
scrolloff int
|
||||
tabstop int
|
||||
errorfmt string
|
||||
filesep string
|
||||
ifs string
|
||||
previewer string
|
||||
cleaner string
|
||||
promptfmt string
|
||||
selmode string
|
||||
shell string
|
||||
shellflag string
|
||||
timefmt string
|
||||
infotimefmtnew string
|
||||
infotimefmtold string
|
||||
truncatechar string
|
||||
ratios []int
|
||||
hiddenfiles []string
|
||||
history bool
|
||||
info []string
|
||||
ruler []string
|
||||
shellopts []string
|
||||
keys map[string]expr
|
||||
cmdkeys map[string]expr
|
||||
cmds map[string]expr
|
||||
user map[string]string
|
||||
sortType sortType
|
||||
tempmarks string
|
||||
numberfmt string
|
||||
tagfmt string
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -89,6 +94,9 @@ func init() {
|
||||
gOpts.dironly = false
|
||||
gOpts.dirpreviews = false
|
||||
gOpts.drawbox = false
|
||||
gOpts.cursoractivefmt = "\033[7m"
|
||||
gOpts.cursorparentfmt = "\033[7m"
|
||||
gOpts.cursorpreviewfmt = "\033[4m"
|
||||
gOpts.globsearch = false
|
||||
gOpts.icons = false
|
||||
gOpts.ignorecase = true
|
||||
@@ -108,7 +116,7 @@ func init() {
|
||||
gOpts.period = 0
|
||||
gOpts.scrolloff = 0
|
||||
gOpts.tabstop = 8
|
||||
gOpts.errorfmt = "\033[7;31;47m%s\033[0m"
|
||||
gOpts.errorfmt = "\033[7;31;47m"
|
||||
gOpts.filesep = "\n"
|
||||
gOpts.ifs = ""
|
||||
gOpts.previewer = ""
|
||||
@@ -125,10 +133,12 @@ func init() {
|
||||
gOpts.hiddenfiles = []string{".*"}
|
||||
gOpts.history = true
|
||||
gOpts.info = nil
|
||||
gOpts.ruler = []string{"acc", "progress", "selection", "ind"}
|
||||
gOpts.shellopts = nil
|
||||
gOpts.sortType = sortType{naturalSort, dirfirstSort}
|
||||
gOpts.tempmarks = "'"
|
||||
gOpts.tagfmt = "\033[31m%s\033[0m"
|
||||
gOpts.numberfmt = "\033[33m"
|
||||
gOpts.tagfmt = "\033[31m"
|
||||
|
||||
gOpts.keys = make(map[string]expr)
|
||||
|
||||
@@ -139,6 +149,7 @@ func init() {
|
||||
gOpts.keys["<c-b>"] = &callExpr{"page-up", nil, 1}
|
||||
gOpts.keys["<pgup>"] = &callExpr{"page-up", nil, 1}
|
||||
gOpts.keys["<c-y>"] = &callExpr{"scroll-up", nil, 1}
|
||||
gOpts.keys["<c-m-up>"] = &callExpr{"scroll-up", nil, 1}
|
||||
gOpts.keys["j"] = &callExpr{"down", nil, 1}
|
||||
gOpts.keys["<down>"] = &callExpr{"down", nil, 1}
|
||||
gOpts.keys["<m-down>"] = &callExpr{"down", nil, 1}
|
||||
@@ -146,15 +157,16 @@ func init() {
|
||||
gOpts.keys["<c-f>"] = &callExpr{"page-down", nil, 1}
|
||||
gOpts.keys["<pgdn>"] = &callExpr{"page-down", nil, 1}
|
||||
gOpts.keys["<c-e>"] = &callExpr{"scroll-down", nil, 1}
|
||||
gOpts.keys["<c-m-down>"] = &callExpr{"scroll-down", nil, 1}
|
||||
gOpts.keys["h"] = &callExpr{"updir", nil, 1}
|
||||
gOpts.keys["<left>"] = &callExpr{"updir", nil, 1}
|
||||
gOpts.keys["l"] = &callExpr{"open", nil, 1}
|
||||
gOpts.keys["<right>"] = &callExpr{"open", nil, 1}
|
||||
gOpts.keys["q"] = &callExpr{"quit", nil, 1}
|
||||
gOpts.keys["gg"] = &callExpr{"top", nil, 1}
|
||||
gOpts.keys["<home>"] = &callExpr{"top", nil, 1}
|
||||
gOpts.keys["G"] = &callExpr{"bottom", nil, 1}
|
||||
gOpts.keys["<end>"] = &callExpr{"bottom", nil, 1}
|
||||
gOpts.keys["gg"] = &callExpr{"top", nil, 0}
|
||||
gOpts.keys["<home>"] = &callExpr{"top", nil, 0}
|
||||
gOpts.keys["G"] = &callExpr{"bottom", nil, 0}
|
||||
gOpts.keys["<end>"] = &callExpr{"bottom", nil, 0}
|
||||
gOpts.keys["H"] = &callExpr{"high", nil, 1}
|
||||
gOpts.keys["M"] = &callExpr{"middle", nil, 1}
|
||||
gOpts.keys["L"] = &callExpr{"low", nil, 1}
|
||||
@@ -211,7 +223,9 @@ func init() {
|
||||
gOpts.cmdkeys["<tab>"] = &callExpr{"cmd-complete", nil, 1}
|
||||
gOpts.cmdkeys["<enter>"] = &callExpr{"cmd-enter", nil, 1}
|
||||
gOpts.cmdkeys["<c-j>"] = &callExpr{"cmd-enter", nil, 1}
|
||||
gOpts.cmdkeys["<down>"] = &callExpr{"cmd-history-next", nil, 1}
|
||||
gOpts.cmdkeys["<c-n>"] = &callExpr{"cmd-history-next", nil, 1}
|
||||
gOpts.cmdkeys["<up>"] = &callExpr{"cmd-history-prev", nil, 1}
|
||||
gOpts.cmdkeys["<c-p>"] = &callExpr{"cmd-history-prev", nil, 1}
|
||||
gOpts.cmdkeys["<delete>"] = &callExpr{"cmd-delete", nil, 1}
|
||||
gOpts.cmdkeys["<c-d>"] = &callExpr{"cmd-delete", nil, 1}
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
|
||||
var (
|
||||
envOpener = os.Getenv("OPENER")
|
||||
envEditor = os.Getenv("EDITOR")
|
||||
envEditor = os.Getenv("VISUAL")
|
||||
envPager = os.Getenv("PAGER")
|
||||
envShell = os.Getenv("SHELL")
|
||||
)
|
||||
@@ -51,7 +51,10 @@ func init() {
|
||||
}
|
||||
|
||||
if envEditor == "" {
|
||||
envEditor = "vi"
|
||||
envEditor = os.Getenv("EDITOR")
|
||||
if envEditor == "" {
|
||||
envEditor = "vi"
|
||||
}
|
||||
}
|
||||
|
||||
if envPager == "" {
|
||||
@@ -159,7 +162,7 @@ func setDefaults() {
|
||||
gOpts.keys["i"] = &execExpr{"$", `$PAGER "$f"`}
|
||||
gOpts.keys["w"] = &execExpr{"$", "$SHELL"}
|
||||
|
||||
gOpts.cmds["doc"] = &execExpr{"$", "lf -doc | $PAGER"}
|
||||
gOpts.cmds["doc"] = &execExpr{"$", `"$lf" -doc | $PAGER`}
|
||||
gOpts.keys["<f-1>"] = &callExpr{"doc", nil, 1}
|
||||
}
|
||||
|
||||
@@ -227,3 +230,14 @@ func exportFiles(f string, fs []string, pwd string) {
|
||||
os.Setenv("fx", envFiles)
|
||||
}
|
||||
}
|
||||
func diskFree(wd string) string {
|
||||
var stat unix.Statfs_t
|
||||
|
||||
if err := unix.Statfs(wd, &stat); err != nil {
|
||||
log.Printf("diskfree: %s", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
// Available blocks * size per block = available space in bytes
|
||||
return "df: " + humanize(int64(uint64(stat.Bavail)*uint64(stat.Bsize)))
|
||||
}
|
||||
+22
-3
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
var (
|
||||
envOpener = os.Getenv("OPENER")
|
||||
envEditor = os.Getenv("EDITOR")
|
||||
envEditor = os.Getenv("VISUAL")
|
||||
envPager = os.Getenv("PAGER")
|
||||
envShell = os.Getenv("SHELL")
|
||||
)
|
||||
@@ -45,7 +45,10 @@ func init() {
|
||||
}
|
||||
|
||||
if envEditor == "" {
|
||||
envEditor = "notepad"
|
||||
envEditor = os.Getenv("EDITOR")
|
||||
if envEditor == "" {
|
||||
envEditor = "notepad"
|
||||
}
|
||||
}
|
||||
|
||||
if envPager == "" {
|
||||
@@ -115,7 +118,7 @@ func setDefaults() {
|
||||
gOpts.keys["i"] = &execExpr{"!", "%PAGER% %f%"}
|
||||
gOpts.keys["w"] = &execExpr{"$", "%SHELL%"}
|
||||
|
||||
gOpts.cmds["doc"] = &execExpr{"!", "lf -doc | %PAGER%"}
|
||||
gOpts.cmds["doc"] = &execExpr{"!", "%lf% -doc | %PAGER%"}
|
||||
gOpts.keys["<f-1>"] = &callExpr{"doc", nil, 1}
|
||||
}
|
||||
|
||||
@@ -181,3 +184,19 @@ func exportFiles(f string, fs []string, pwd string) {
|
||||
os.Setenv("fx", envFiles)
|
||||
}
|
||||
}
|
||||
|
||||
func diskFree(wd string) string {
|
||||
var free uint64
|
||||
|
||||
pathPtr, err := windows.UTF16PtrFromString(wd)
|
||||
if err != nil {
|
||||
log.Printf("diskfree: %s", err)
|
||||
return ""
|
||||
}
|
||||
err = windows.GetDiskFreeSpaceEx(pathPtr, &free, nil, nil) // cwd, free, total, available
|
||||
if err != nil {
|
||||
log.Printf("diskfree: %s", err)
|
||||
return ""
|
||||
}
|
||||
return "df: " + humanize(int64(free))
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strconv"
|
||||
)
|
||||
@@ -38,7 +37,7 @@ type scanner struct {
|
||||
}
|
||||
|
||||
func newScanner(r io.Reader) *scanner {
|
||||
buf, err := ioutil.ReadAll(r)
|
||||
buf, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
log.Printf("scanning: %s", err)
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ func (win *win) printRight(screen tcell.Screen, y int, st tcell.Style, s string)
|
||||
win.print(screen, win.w-printLength(s), y, st, s)
|
||||
}
|
||||
|
||||
func (win *win) printReg(screen tcell.Screen, reg *reg) {
|
||||
func (win *win) printReg(screen tcell.Screen, reg *reg, previewLoading bool) {
|
||||
if reg == nil {
|
||||
return
|
||||
}
|
||||
@@ -260,8 +260,10 @@ func (win *win) printReg(screen tcell.Screen, reg *reg) {
|
||||
st := tcell.StyleDefault
|
||||
|
||||
if reg.loading {
|
||||
st = st.Reverse(true)
|
||||
win.print(screen, 2, 0, st, "loading...")
|
||||
if previewLoading {
|
||||
st = st.Reverse(true)
|
||||
win.print(screen, 2, 0, st, "loading...")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -330,19 +332,26 @@ type dirContext struct {
|
||||
tags map[string]string
|
||||
}
|
||||
|
||||
type dirRole byte
|
||||
|
||||
const (
|
||||
Active dirRole = iota
|
||||
Parent
|
||||
Preview
|
||||
)
|
||||
|
||||
type dirStyle struct {
|
||||
colors styleMap
|
||||
icons iconMap
|
||||
previewing bool
|
||||
colors styleMap
|
||||
icons iconMap
|
||||
role dirRole
|
||||
}
|
||||
|
||||
// These colors are not currently customizeable
|
||||
const LineNumberColor = tcell.ColorOlive
|
||||
const SelectionColor = tcell.ColorPurple
|
||||
const YankColor = tcell.ColorOlive
|
||||
const CutColor = tcell.ColorMaroon
|
||||
|
||||
func (win *win) printDir(screen tcell.Screen, dir *dir, context *dirContext, dirStyle *dirStyle) {
|
||||
func (win *win) printDir(screen tcell.Screen, dir *dir, context *dirContext, dirStyle *dirStyle, previewLoading bool) {
|
||||
if win.w < 5 || dir == nil {
|
||||
return
|
||||
}
|
||||
@@ -353,12 +362,14 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, context *dirContext, dir
|
||||
win.print(screen, 2, 0, messageStyle, "permission denied")
|
||||
return
|
||||
}
|
||||
if (dir.loading && len(dir.files) == 0) || (dirStyle.previewing && dir.loading && gOpts.dirpreviews) {
|
||||
win.print(screen, 2, 0, messageStyle, "loading...")
|
||||
if (dir.loading && len(dir.files) == 0) || (dirStyle.role == Preview && dir.loading && gOpts.dirpreviews) {
|
||||
if dirStyle.role != Preview || previewLoading {
|
||||
win.print(screen, 2, 0, messageStyle, "loading...")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if dirStyle.previewing && gOpts.dirpreviews && len(gOpts.previewer) > 0 {
|
||||
if dirStyle.role == Preview && gOpts.dirpreviews && len(gOpts.previewer) > 0 {
|
||||
// Print previewer result instead of default directory print operation.
|
||||
st := tcell.StyleDefault
|
||||
for i, l := range dir.lines {
|
||||
@@ -383,17 +394,15 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, context *dirContext, dir
|
||||
}
|
||||
|
||||
var lnwidth int
|
||||
var lnformat string
|
||||
|
||||
if gOpts.number || gOpts.relativenumber {
|
||||
lnwidth = 1
|
||||
if gOpts.number && gOpts.relativenumber {
|
||||
lnwidth++
|
||||
}
|
||||
for j := 10; j < len(dir.files); j *= 10 {
|
||||
for j := 10; j <= len(dir.files); j *= 10 {
|
||||
lnwidth++
|
||||
}
|
||||
lnformat = fmt.Sprintf("%%%d.d ", lnwidth)
|
||||
}
|
||||
|
||||
for i, f := range dir.files[beg:end] {
|
||||
@@ -403,21 +412,21 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, context *dirContext, dir
|
||||
var ln string
|
||||
|
||||
if gOpts.number && (!gOpts.relativenumber) {
|
||||
ln = fmt.Sprintf(lnformat, i+1+beg)
|
||||
ln = fmt.Sprintf("%*d", lnwidth, i+1+beg)
|
||||
} else if gOpts.relativenumber {
|
||||
switch {
|
||||
case i < dir.pos:
|
||||
ln = fmt.Sprintf(lnformat, dir.pos-i)
|
||||
ln = fmt.Sprintf("%*d", lnwidth, dir.pos-i)
|
||||
case i > dir.pos:
|
||||
ln = fmt.Sprintf(lnformat, i-dir.pos)
|
||||
ln = fmt.Sprintf("%*d", lnwidth, i-dir.pos)
|
||||
case gOpts.number:
|
||||
ln = fmt.Sprintf(fmt.Sprintf("%%%d.d ", lnwidth-1), i+1+beg)
|
||||
ln = fmt.Sprintf("%*d ", lnwidth-1, i+1+beg)
|
||||
default:
|
||||
ln = ""
|
||||
ln = fmt.Sprintf("%*d", lnwidth, 0)
|
||||
}
|
||||
}
|
||||
|
||||
win.print(screen, 0, i, tcell.StyleDefault.Foreground(LineNumberColor), ln)
|
||||
win.print(screen, 0, i, tcell.StyleDefault, fmt.Sprintf(optionToFmtstr(gOpts.numberfmt), ln))
|
||||
}
|
||||
|
||||
path := filepath.Join(dir.path, f.Name())
|
||||
@@ -432,20 +441,13 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, context *dirContext, dir
|
||||
}
|
||||
}
|
||||
|
||||
if i == dir.pos {
|
||||
st = st.Reverse(true)
|
||||
}
|
||||
|
||||
var s []rune
|
||||
|
||||
s = append(s, ' ')
|
||||
|
||||
var iwidth int
|
||||
|
||||
if gOpts.icons {
|
||||
s = append(s, []rune(dirStyle.icons.get(f))...)
|
||||
s = append(s, ' ')
|
||||
iwidth = 2
|
||||
}
|
||||
|
||||
for _, r := range f.Name() {
|
||||
@@ -454,39 +456,59 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, context *dirContext, dir
|
||||
|
||||
w := runeSliceWidth(s)
|
||||
|
||||
if w > win.w-3 {
|
||||
s = runeSliceWidthRange(s, 0, win.w-4)
|
||||
// make space for select marker, and leave another space at the end
|
||||
maxlength := win.w - lnwidth - 2
|
||||
// make extra space to separate windows if drawbox is not enabled
|
||||
if !gOpts.drawbox {
|
||||
maxlength -= 1
|
||||
}
|
||||
|
||||
if w > maxlength {
|
||||
s = runeSliceWidthRange(s, 0, maxlength-1)
|
||||
s = append(s, []rune(gOpts.truncatechar)...)
|
||||
} else {
|
||||
for i := 0; i < win.w-3-w; i++ {
|
||||
for i := 0; i < maxlength-w; i++ {
|
||||
s = append(s, ' ')
|
||||
}
|
||||
}
|
||||
|
||||
info := fileInfo(f, dir)
|
||||
|
||||
if len(info) > 0 && win.w-lnwidth-iwidth-2 > 2*len(info) {
|
||||
if win.w-2 > w+len(info) {
|
||||
s = runeSliceWidthRange(s, 0, win.w-3-len(info)-lnwidth)
|
||||
} else {
|
||||
s = runeSliceWidthRange(s, 0, win.w-4-len(info)-lnwidth)
|
||||
if len(info) > 0 && 2*len(info) < maxlength {
|
||||
if w+len(info) > maxlength {
|
||||
s = runeSliceWidthRange(s, 0, maxlength-len(info)-1)
|
||||
s = append(s, []rune(gOpts.truncatechar)...)
|
||||
} else {
|
||||
s = runeSliceWidthRange(s, 0, maxlength-len(info))
|
||||
}
|
||||
for _, r := range info {
|
||||
s = append(s, r)
|
||||
}
|
||||
}
|
||||
|
||||
s = append(s, ' ')
|
||||
ce := ""
|
||||
if i == dir.pos {
|
||||
switch dirStyle.role {
|
||||
case Active:
|
||||
ce = gOpts.cursoractivefmt
|
||||
case Parent:
|
||||
ce = gOpts.cursorparentfmt
|
||||
case Preview:
|
||||
ce = gOpts.cursorpreviewfmt
|
||||
}
|
||||
}
|
||||
cursorescapefmt := optionToFmtstr(ce)
|
||||
|
||||
win.print(screen, lnwidth+1, i, st, string(s))
|
||||
s = append(s, ' ')
|
||||
styledFilename := fmt.Sprintf(cursorescapefmt, string(s))
|
||||
win.print(screen, lnwidth+1, i, st, styledFilename)
|
||||
|
||||
tag, ok := context.tags[path]
|
||||
if ok {
|
||||
if i == dir.pos {
|
||||
win.print(screen, lnwidth+1, i, st, tag)
|
||||
win.print(screen, lnwidth+1, i, st, fmt.Sprintf(cursorescapefmt, tag))
|
||||
} else {
|
||||
win.print(screen, lnwidth+1, i, tcell.StyleDefault, fmt.Sprintf(gOpts.tagfmt, tag))
|
||||
win.print(screen, lnwidth+1, i, tcell.StyleDefault, fmt.Sprintf(optionToFmtstr(gOpts.tagfmt), tag))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -501,6 +523,10 @@ func getWidths(wtot int) []int {
|
||||
wlen := len(gOpts.ratios)
|
||||
widths := make([]int, wlen)
|
||||
|
||||
if gOpts.drawbox {
|
||||
wtot -= (wlen + 1)
|
||||
}
|
||||
|
||||
wsum := 0
|
||||
for i := 0; i < wlen-1; i++ {
|
||||
widths[i] = gOpts.ratios[i] * wtot / rsum
|
||||
@@ -508,10 +534,6 @@ func getWidths(wtot int) []int {
|
||||
}
|
||||
widths[wlen-1] = wtot - wsum
|
||||
|
||||
if gOpts.drawbox {
|
||||
widths[wlen-1]--
|
||||
}
|
||||
|
||||
return widths
|
||||
}
|
||||
|
||||
@@ -526,7 +548,8 @@ func getWins(screen tcell.Screen) []*win {
|
||||
wlen := len(widths)
|
||||
for i := 0; i < wlen; i++ {
|
||||
if gOpts.drawbox {
|
||||
wins = append(wins, newWin(widths[i], htot-4, wacc+1, 2))
|
||||
wacc++
|
||||
wins = append(wins, newWin(widths[i], htot-4, wacc, 2))
|
||||
} else {
|
||||
wins = append(wins, newWin(widths[i], htot-2, wacc, 1))
|
||||
}
|
||||
@@ -610,21 +633,9 @@ func (ui *ui) pollEvents() {
|
||||
}
|
||||
|
||||
func (ui *ui) renew() {
|
||||
ui.wins = getWins(ui.screen)
|
||||
|
||||
wtot, htot := ui.screen.Size()
|
||||
|
||||
widths := getWidths(wtot)
|
||||
|
||||
wacc := 0
|
||||
wlen := len(widths)
|
||||
for i := 0; i < wlen; i++ {
|
||||
if gOpts.drawbox {
|
||||
ui.wins[i].renew(widths[i], htot-4, wacc+1, 2)
|
||||
} else {
|
||||
ui.wins[i].renew(widths[i], htot-2, wacc, 1)
|
||||
}
|
||||
wacc += widths[i]
|
||||
}
|
||||
|
||||
ui.promptWin.renew(wtot, 1, 0, 0)
|
||||
ui.msgWin.renew(wtot, 1, 0, htot-1)
|
||||
ui.menuWin.renew(wtot, 1, 0, htot-2)
|
||||
@@ -652,8 +663,16 @@ func (ui *ui) echomsg(msg string) {
|
||||
log.Print(msg)
|
||||
}
|
||||
|
||||
func optionToFmtstr(optstr string) string {
|
||||
if !strings.Contains(optstr, "%s") {
|
||||
return optstr + "%s\033[0m"
|
||||
} else {
|
||||
return optstr
|
||||
}
|
||||
}
|
||||
|
||||
func (ui *ui) echoerr(msg string) {
|
||||
ui.msg = fmt.Sprintf(gOpts.errorfmt, msg)
|
||||
ui.msg = fmt.Sprintf(optionToFmtstr(gOpts.errorfmt), msg)
|
||||
log.Printf("error: %s", msg)
|
||||
}
|
||||
|
||||
@@ -679,11 +698,10 @@ func (ui *ui) loadFile(app *app, volatile bool) {
|
||||
return
|
||||
}
|
||||
|
||||
if curr.path == ui.currentFile {
|
||||
return
|
||||
if curr.path != ui.currentFile {
|
||||
ui.currentFile = curr.path
|
||||
onSelect(app)
|
||||
}
|
||||
ui.currentFile = curr.path
|
||||
onSelect(app)
|
||||
|
||||
if !gOpts.preview {
|
||||
return
|
||||
@@ -797,7 +815,7 @@ func (ui *ui) drawStatLine(nav *nav) {
|
||||
ind := min(dir.ind+1, tot)
|
||||
acc := string(ui.keyCount) + string(ui.keyAcc)
|
||||
|
||||
var selection string
|
||||
selection := []string{}
|
||||
|
||||
if len(nav.saves) > 0 {
|
||||
copy := 0
|
||||
@@ -810,40 +828,58 @@ func (ui *ui) drawStatLine(nav *nav) {
|
||||
}
|
||||
}
|
||||
if copy > 0 {
|
||||
selection += fmt.Sprintf(" \033[33;7m %d \033[0m", copy)
|
||||
selection = append(selection, fmt.Sprintf("\033[33;7m %d \033[0m", copy))
|
||||
}
|
||||
if move > 0 {
|
||||
selection += fmt.Sprintf(" \033[31;7m %d \033[0m", move)
|
||||
selection = append(selection, fmt.Sprintf("\033[31;7m %d \033[0m", move))
|
||||
}
|
||||
}
|
||||
|
||||
currSelections := nav.currSelections()
|
||||
if len(currSelections) > 0 {
|
||||
selection += fmt.Sprintf(" \033[35;7m %d \033[0m", len(currSelections))
|
||||
selection = append(selection, fmt.Sprintf("\033[35;7m %d \033[0m", len(currSelections)))
|
||||
}
|
||||
|
||||
if len(dir.filter) != 0 {
|
||||
selection += " \033[34;7m F \033[0m"
|
||||
selection = append(selection, "\033[34;7m F \033[0m")
|
||||
}
|
||||
|
||||
var progress string
|
||||
progress := []string{}
|
||||
|
||||
if nav.copyTotal > 0 {
|
||||
percentage := int((100 * float64(nav.copyBytes)) / float64(nav.copyTotal))
|
||||
progress += fmt.Sprintf(" [%d%%]", percentage)
|
||||
progress = append(progress, fmt.Sprintf("[%d%%]", percentage))
|
||||
}
|
||||
|
||||
if nav.moveTotal > 0 {
|
||||
progress += fmt.Sprintf(" [%d/%d]", nav.moveCount, nav.moveTotal)
|
||||
progress = append(progress, fmt.Sprintf("[%d/%d]", nav.moveCount, nav.moveTotal))
|
||||
}
|
||||
|
||||
if nav.deleteTotal > 0 {
|
||||
progress += fmt.Sprintf(" [%d/%d]", nav.deleteCount, nav.deleteTotal)
|
||||
progress = append(progress, fmt.Sprintf("[%d/%d]", nav.deleteCount, nav.deleteTotal))
|
||||
}
|
||||
|
||||
ruler := fmt.Sprintf("%s%s%s %d/%d", acc, progress, selection, ind, tot)
|
||||
ruler := []string{}
|
||||
for _, s := range gOpts.ruler {
|
||||
switch s {
|
||||
case "df":
|
||||
df := diskFree(dir.path)
|
||||
if df != "" {
|
||||
ruler = append(ruler, df)
|
||||
}
|
||||
case "acc":
|
||||
ruler = append(ruler, acc)
|
||||
case "progress":
|
||||
ruler = append(ruler, progress...)
|
||||
case "selection":
|
||||
ruler = append(ruler, selection...)
|
||||
case "ind":
|
||||
ruler = append(ruler, fmt.Sprintf("%d/%d", ind, tot))
|
||||
}
|
||||
|
||||
ui.msgWin.printRight(ui.screen, 0, st, ruler)
|
||||
}
|
||||
|
||||
ui.msgWin.printRight(ui.screen, 0, st, strings.Join(ruler, " "))
|
||||
}
|
||||
|
||||
func (ui *ui) drawBox() {
|
||||
@@ -852,28 +888,28 @@ func (ui *ui) drawBox() {
|
||||
w, h := ui.screen.Size()
|
||||
|
||||
for i := 1; i < w-1; i++ {
|
||||
ui.screen.SetContent(i, 1, '─', nil, st)
|
||||
ui.screen.SetContent(i, h-2, '─', nil, st)
|
||||
ui.screen.SetContent(i, 1, tcell.RuneHLine, nil, st)
|
||||
ui.screen.SetContent(i, h-2, tcell.RuneHLine, nil, st)
|
||||
}
|
||||
|
||||
for i := 2; i < h-2; i++ {
|
||||
ui.screen.SetContent(0, i, '│', nil, st)
|
||||
ui.screen.SetContent(w-1, i, '│', nil, st)
|
||||
ui.screen.SetContent(0, i, tcell.RuneVLine, nil, st)
|
||||
ui.screen.SetContent(w-1, i, tcell.RuneVLine, nil, st)
|
||||
}
|
||||
|
||||
ui.screen.SetContent(0, 1, '┌', nil, st)
|
||||
ui.screen.SetContent(w-1, 1, '┐', nil, st)
|
||||
ui.screen.SetContent(0, h-2, '└', nil, st)
|
||||
ui.screen.SetContent(w-1, h-2, '┘', nil, st)
|
||||
ui.screen.SetContent(0, 1, tcell.RuneULCorner, nil, st)
|
||||
ui.screen.SetContent(w-1, 1, tcell.RuneURCorner, nil, st)
|
||||
ui.screen.SetContent(0, h-2, tcell.RuneLLCorner, nil, st)
|
||||
ui.screen.SetContent(w-1, h-2, tcell.RuneLRCorner, nil, st)
|
||||
|
||||
wacc := 0
|
||||
for wind := 0; wind < len(ui.wins)-1; wind++ {
|
||||
wacc += ui.wins[wind].w
|
||||
ui.screen.SetContent(wacc, 1, '┬', nil, st)
|
||||
wacc += ui.wins[wind].w + 1
|
||||
ui.screen.SetContent(wacc, 1, tcell.RuneTTee, nil, st)
|
||||
for i := 2; i < h-2; i++ {
|
||||
ui.screen.SetContent(wacc, i, '│', nil, st)
|
||||
ui.screen.SetContent(wacc, i, tcell.RuneVLine, nil, st)
|
||||
}
|
||||
ui.screen.SetContent(wacc, h-2, '┴', nil, st)
|
||||
ui.screen.SetContent(wacc, h-2, tcell.RuneBTee, nil, st)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -893,6 +929,7 @@ func (ui *ui) draw(nav *nav) {
|
||||
st := tcell.StyleDefault
|
||||
context := dirContext{selections: nav.selections, saves: nav.saves, tags: nav.tags}
|
||||
|
||||
// XXX: manual clean without flush to avoid flicker on Windows
|
||||
wtot, htot := ui.screen.Size()
|
||||
for i := 0; i < wtot; i++ {
|
||||
for j := 0; j < htot; j++ {
|
||||
@@ -907,9 +944,14 @@ func (ui *ui) draw(nav *nav) {
|
||||
wins--
|
||||
}
|
||||
for i := 0; i < wins; i++ {
|
||||
role := Parent
|
||||
if i == wins-1 {
|
||||
role = Active
|
||||
}
|
||||
if dir := ui.dirOfWin(nav, i); dir != nil {
|
||||
ui.wins[i].printDir(ui.screen, dir, &context,
|
||||
&dirStyle{colors: ui.styles, icons: ui.icons, previewing: false})
|
||||
&dirStyle{colors: ui.styles, icons: ui.icons, role: role},
|
||||
nav.previewLoading)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -945,9 +987,10 @@ func (ui *ui) draw(nav *nav) {
|
||||
|
||||
if curr.IsDir() {
|
||||
preview.printDir(ui.screen, ui.dirPrev, &context,
|
||||
&dirStyle{colors: ui.styles, icons: ui.icons, previewing: true})
|
||||
&dirStyle{colors: ui.styles, icons: ui.icons, role: Preview},
|
||||
nav.previewLoading)
|
||||
} else if curr.Mode().IsRegular() {
|
||||
preview.printReg(ui.screen, ui.regPrev)
|
||||
preview.printReg(ui.screen, ui.regPrev, nav.previewLoading)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1182,12 +1225,18 @@ func (ui *ui) readNormalEvent(ev tcell.Event, nav *nav) expr {
|
||||
case tcell.ButtonNone:
|
||||
return nil
|
||||
}
|
||||
if tev.Modifiers() == tcell.ModCtrl {
|
||||
button = "<c-" + button[1:]
|
||||
}
|
||||
if expr, ok := gOpts.keys[button]; ok {
|
||||
return expr
|
||||
}
|
||||
|
||||
if tev.Buttons() != tcell.Button1 && tev.Buttons() != tcell.Button2 {
|
||||
return nil
|
||||
if button != "<m-1>" && button != "<m-2>" {
|
||||
ui.echoerrf("unknown mapping: %s", button)
|
||||
ui.keyAcc = nil
|
||||
ui.keyCount = nil
|
||||
ui.menuBuf = nil
|
||||
return draw
|
||||
}
|
||||
|
||||
x, y := tev.Position()
|
||||
@@ -1331,7 +1380,7 @@ func listMatches(screen tcell.Screen, matches []string, selectedInd int) *bytes.
|
||||
wcol = max(wcol, len(m))
|
||||
}
|
||||
wcol += gOpts.tabstop - wcol%gOpts.tabstop
|
||||
ncol := wtot / wcol
|
||||
ncol := max(wtot/wcol, 1)
|
||||
|
||||
b.WriteString("possible matches\n")
|
||||
|
||||
|
||||
Reference in new issue
Block a user