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:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest]
|
os: [ubuntu-latest, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.18
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build -v ./...
|
run: go build -v ./...
|
||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
|
|
||||||
- uses: dominikh/staticcheck-action@v1.2.0
|
- uses: dominikh/staticcheck-action@v1.3.0
|
||||||
with:
|
with:
|
||||||
version: "2022.1.3"
|
version: "2022.1.3"
|
||||||
install-go: false
|
install-go: false
|
||||||
@@ -37,12 +37,12 @@ jobs:
|
|||||||
generate:
|
generate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.19
|
go-version: 1.19
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.18
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: gen/xbuild.sh
|
run: gen/xbuild.sh
|
||||||
@@ -26,3 +26,14 @@ jobs:
|
|||||||
files: dist/*
|
files: dist/*
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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)
|
- Tabs or windows (better handled by window manager or terminal multiplexer)
|
||||||
- Builtin pager/editor (better handled by your pager/editor of choice)
|
- 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
|
## 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/).
|
Building from the source requires [Go](https://go.dev/).
|
||||||
|
|
||||||
On Unix (Go version < 1.17):
|
On Unix:
|
||||||
|
|
||||||
```bash
|
|
||||||
env CGO_ENABLED=0 GO111MODULE=on go get -u -ldflags="-s -w" github.com/gokcehan/lf
|
|
||||||
```
|
|
||||||
|
|
||||||
On Unix (Go version >= 1.17):
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
env CGO_ENABLED=0 go install -ldflags="-s -w" github.com/gokcehan/lf@latest
|
env CGO_ENABLED=0 go install -ldflags="-s -w" github.com/gokcehan/lf@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
On Windows `cmd` (Go version < 1.17):
|
On Windows `cmd`:
|
||||||
|
|
||||||
```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):
|
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
set CGO_ENABLED=0
|
set CGO_ENABLED=0
|
||||||
go install -ldflags="-s -w" github.com/gokcehan/lf@latest
|
go install -ldflags="-s -w" github.com/gokcehan/lf@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
On Windows `powershell` (Go version < 1.17):
|
On Windows `powershell`:
|
||||||
|
|
||||||
```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):
|
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
$env:CGO_ENABLED = '0'
|
$env:CGO_ENABLED = '0'
|
||||||
|
|||||||
@@ -467,10 +467,17 @@ func (app *app) loop() {
|
|||||||
app.nav.renew()
|
app.nav.renew()
|
||||||
app.ui.loadFile(app, false)
|
app.ui.loadFile(app, false)
|
||||||
app.ui.draw(app.nav)
|
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:
|
// This function is used to run a shell command. Modes are as follows:
|
||||||
//
|
//
|
||||||
// Prefix Wait Async Stdin Stdout Stderr UI action
|
// 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
|
// % No No Yes Yes Yes Statline for input/output
|
||||||
// ! Yes No Yes Yes Yes Pause and then resume
|
// ! Yes No Yes Yes Yes Pause and then resume
|
||||||
// & No Yes No No No Do nothing
|
// & 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.nav.exportFiles()
|
||||||
app.ui.exportSizes()
|
app.ui.exportSizes()
|
||||||
exportOpts()
|
exportOpts()
|
||||||
@@ -488,6 +496,24 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
var out io.Reader
|
var out io.Reader
|
||||||
var err error
|
var err error
|
||||||
switch prefix {
|
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 "$", "!":
|
case "$", "!":
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
@@ -512,7 +538,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
case "%":
|
case "%":
|
||||||
shellSetPG(cmd)
|
shellSetPG(cmd)
|
||||||
if app.ui.cmdPrefix == ">" {
|
if app.ui.cmdPrefix == ">" {
|
||||||
return
|
return noopCleanFunc
|
||||||
}
|
}
|
||||||
stdin, err := cmd.StdinPipe()
|
stdin, err := cmd.StdinPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -540,7 +566,11 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
anyKey()
|
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 {
|
switch prefix {
|
||||||
case "%":
|
case "%":
|
||||||
@@ -585,5 +615,17 @@ func (app *app) runShell(s string, args []string, prefix string) {
|
|||||||
log.Printf("running shell: %s", err)
|
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"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
@@ -34,7 +33,7 @@ func run() {
|
|||||||
defer f.Close()
|
defer f.Close()
|
||||||
log.SetOutput(f)
|
log.SetOutput(f)
|
||||||
} else {
|
} else {
|
||||||
log.SetOutput(ioutil.Discard)
|
log.SetOutput(io.Discard)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Print("hi!")
|
log.Print("hi!")
|
||||||
|
|||||||
+21
-14
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -13,7 +12,9 @@ var (
|
|||||||
gCmdWords = []string{
|
gCmdWords = []string{
|
||||||
"set",
|
"set",
|
||||||
"map",
|
"map",
|
||||||
|
"maps",
|
||||||
"cmap",
|
"cmap",
|
||||||
|
"cmaps",
|
||||||
"cmd",
|
"cmd",
|
||||||
"quit",
|
"quit",
|
||||||
"up",
|
"up",
|
||||||
@@ -35,6 +36,7 @@ var (
|
|||||||
"low",
|
"low",
|
||||||
"toggle",
|
"toggle",
|
||||||
"invert",
|
"invert",
|
||||||
|
"invert-below",
|
||||||
"unselect",
|
"unselect",
|
||||||
"glob-select",
|
"glob-select",
|
||||||
"glob-unselect",
|
"glob-unselect",
|
||||||
@@ -113,6 +115,9 @@ var (
|
|||||||
"autoquit",
|
"autoquit",
|
||||||
"noautoquit",
|
"noautoquit",
|
||||||
"autoquit!",
|
"autoquit!",
|
||||||
|
"cursoractivefmt",
|
||||||
|
"cursorparentfmt",
|
||||||
|
"cursorpreviewfmt",
|
||||||
"dircache",
|
"dircache",
|
||||||
"nodircache",
|
"nodircache",
|
||||||
"dircache!",
|
"dircache!",
|
||||||
@@ -167,6 +172,7 @@ var (
|
|||||||
"reverse",
|
"reverse",
|
||||||
"noreverse",
|
"noreverse",
|
||||||
"reverse!",
|
"reverse!",
|
||||||
|
"ruler",
|
||||||
"smartcase",
|
"smartcase",
|
||||||
"nosmartcase",
|
"nosmartcase",
|
||||||
"smartcase!",
|
"smartcase!",
|
||||||
@@ -190,6 +196,7 @@ var (
|
|||||||
"history",
|
"history",
|
||||||
"ifs",
|
"ifs",
|
||||||
"info",
|
"info",
|
||||||
|
"numberfmt",
|
||||||
"previewer",
|
"previewer",
|
||||||
"cleaner",
|
"cleaner",
|
||||||
"promptfmt",
|
"promptfmt",
|
||||||
@@ -249,7 +256,7 @@ func matchExec(s string) (matches []string, longest []rune) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
files, err := ioutil.ReadDir(p)
|
files, err := os.ReadDir(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("reading path: %s", err)
|
log.Printf("reading path: %s", err)
|
||||||
}
|
}
|
||||||
@@ -259,18 +266,18 @@ func matchExec(s string) (matches []string, longest []rune) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err = os.Stat(filepath.Join(p, f.Name()))
|
finfo, err := f.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("getting file information: %s", err)
|
log.Printf("getting file information: %s", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if !f.Mode().IsRegular() || !isExecutable(f) {
|
if !finfo.Mode().IsRegular() || !isExecutable(finfo) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Print(f.Name())
|
log.Print(finfo.Name())
|
||||||
words = append(words, f.Name())
|
words = append(words, finfo.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,7 +310,7 @@ func matchFile(s string) (matches []string, longest []rune) {
|
|||||||
|
|
||||||
dir = filepath.Dir(unescape(dir))
|
dir = filepath.Dir(unescape(dir))
|
||||||
|
|
||||||
files, err := ioutil.ReadDir(dir)
|
files, err := os.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("reading directory: %s", err)
|
log.Printf("reading directory: %s", err)
|
||||||
}
|
}
|
||||||
@@ -334,14 +341,14 @@ func matchFile(s string) (matches []string, longest []rune) {
|
|||||||
}
|
}
|
||||||
matches = append(matches, item)
|
matches = append(matches, item)
|
||||||
|
|
||||||
if longest != nil {
|
if longest == nil {
|
||||||
longest = matchLongest(longest, []rune(name))
|
|
||||||
} else if s != "" {
|
|
||||||
if f.Mode().IsRegular() {
|
if f.Mode().IsRegular() {
|
||||||
longest = []rune(name + " ")
|
longest = []rune(name + " ")
|
||||||
} else {
|
} else {
|
||||||
longest = []rune(name + escape(string(filepath.Separator)))
|
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)
|
log.Printf("getting current directory: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
files, err := ioutil.ReadDir(wd)
|
files, err := os.ReadDir(wd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("reading directory: %s", err)
|
log.Printf("reading directory: %s", err)
|
||||||
}
|
}
|
||||||
@@ -433,10 +440,10 @@ func completeFile(acc []rune) (matches []string, longestAcc []rune) {
|
|||||||
|
|
||||||
matches = append(matches, f.Name())
|
matches = append(matches, f.Name())
|
||||||
|
|
||||||
if longestAcc != nil {
|
if longestAcc == nil {
|
||||||
longestAcc = matchLongest(longestAcc, []rune(f.Name()))
|
|
||||||
} else if s != "" {
|
|
||||||
longestAcc = []rune(f.Name())
|
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')
|
low (default 'L')
|
||||||
toggle
|
toggle
|
||||||
invert (default 'v')
|
invert (default 'v')
|
||||||
|
invert-below
|
||||||
unselect (default 'u')
|
unselect (default 'u')
|
||||||
glob-select
|
glob-select
|
||||||
glob-unselect
|
glob-unselect
|
||||||
@@ -78,6 +79,8 @@ The following commands are provided by lf:
|
|||||||
mark-remove (modal) (default '"')
|
mark-remove (modal) (default '"')
|
||||||
tag
|
tag
|
||||||
tag-toggle (default 't')
|
tag-toggle (default 't')
|
||||||
|
maps
|
||||||
|
cmaps
|
||||||
|
|
||||||
The following command line commands are provided by lf:
|
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-menu-accept
|
||||||
cmd-enter (default '<c-j>' and '<enter>')
|
cmd-enter (default '<c-j>' and '<enter>')
|
||||||
cmd-interrupt (default '<c-c>')
|
cmd-interrupt (default '<c-c>')
|
||||||
cmd-history-next (default '<c-n>')
|
cmd-history-next (default '<c-n>' and '<down>')
|
||||||
cmd-history-prev (default '<c-p>')
|
cmd-history-prev (default '<c-p>' and '<up>')
|
||||||
cmd-left (default '<c-b>' and '<left>')
|
cmd-left (default '<c-b>' and '<left>')
|
||||||
cmd-right (default '<c-f>' and '<right>')
|
cmd-right (default '<c-f>' and '<right>')
|
||||||
cmd-home (default '<c-a>' and '<home>')
|
cmd-home (default '<c-a>' and '<home>')
|
||||||
@@ -111,56 +114,61 @@ The following command line commands are provided by lf:
|
|||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
anchorfind bool (default on)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default off)
|
autoquit bool (default false)
|
||||||
cleaner string (default '')
|
cleaner string (default '')
|
||||||
dircache bool (default on)
|
cursoractivefmt string (default "\033[7m")
|
||||||
dircounts bool (default off)
|
cursorparentfmt string (default "\033[7m")
|
||||||
dirfirst bool (default on)
|
cursorpreviewfmt string (default "\033[4m")
|
||||||
dironly bool (default off)
|
dircache bool (default true)
|
||||||
dirpreviews bool (default off)
|
dircounts bool (default false)
|
||||||
drawbox bool (default off)
|
dirfirst bool (default true)
|
||||||
errorfmt string (default "\033[7;31;47m%s\033[0m")
|
dironly bool (default false)
|
||||||
|
dirpreviews bool (default false)
|
||||||
|
drawbox bool (default false)
|
||||||
|
errorfmt string (default "\033[7;31;47m")
|
||||||
filesep string (default "\n")
|
filesep string (default "\n")
|
||||||
findlen int (default 1)
|
findlen int (default 1)
|
||||||
globsearch bool (default off)
|
globsearch bool (default false)
|
||||||
hidden bool (default off)
|
hidden bool (default false)
|
||||||
hiddenfiles []string (default '.*')
|
hiddenfiles []string (default '.*')
|
||||||
history bool (default on)
|
history bool (default true)
|
||||||
icons bool (default off)
|
icons bool (default false)
|
||||||
ifs string (default '')
|
ifs string (default '')
|
||||||
ignorecase bool (default on)
|
ignorecase bool (default true)
|
||||||
ignoredia bool (default on)
|
ignoredia bool (default true)
|
||||||
incfilter bool (default off)
|
incfilter bool (default false)
|
||||||
incsearch bool (default off)
|
incsearch bool (default false)
|
||||||
info []string (default '')
|
info []string (default '')
|
||||||
infotimefmtnew string (default 'Jan _2 15:04')
|
infotimefmtnew string (default 'Jan _2 15:04')
|
||||||
infotimefmtold string (default 'Jan _2 2006')
|
infotimefmtold string (default 'Jan _2 2006')
|
||||||
mouse bool (default off)
|
mouse bool (default false)
|
||||||
number bool (default off)
|
number bool (default false)
|
||||||
|
numberfmt string (default "\033[33m")
|
||||||
period int (default 0)
|
period int (default 0)
|
||||||
preview bool (default on)
|
preview bool (default true)
|
||||||
previewer string (default '')
|
previewer string (default '')
|
||||||
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
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')
|
ratios []int (default '1:2:3')
|
||||||
relativenumber bool (default off)
|
relativenumber bool (default false)
|
||||||
reverse bool (default off)
|
reverse bool (default false)
|
||||||
|
ruler []string (default 'acc:progress:selection:ind')
|
||||||
scrolloff int (default 0)
|
scrolloff int (default 0)
|
||||||
selmode string (default 'all')
|
selmode string (default 'all')
|
||||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||||
shellopts []string (default '')
|
shellopts []string (default '')
|
||||||
smartcase bool (default on)
|
smartcase bool (default true)
|
||||||
smartdia bool (default off)
|
smartdia bool (default false)
|
||||||
sortby string (default 'natural')
|
sortby string (default 'natural')
|
||||||
tabstop int (default 8)
|
tabstop int (default 8)
|
||||||
tagfmt string (default "\033[31m%s\033[0m")
|
tagfmt string (default "\033[31m")
|
||||||
tempmarks string (default '')
|
tempmarks string (default '')
|
||||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||||
truncatechar string (default '~')
|
truncatechar string (default '~')
|
||||||
waitmsg string (default 'Press any key to continue')
|
waitmsg string (default 'Press any key to continue')
|
||||||
wrapscan bool (default on)
|
wrapscan bool (default true)
|
||||||
wrapscroll bool (default off)
|
wrapscroll bool (default false)
|
||||||
user_{option} string (default none)
|
user_{option} string (default none)
|
||||||
|
|
||||||
The following environment variables are exported for shell commands:
|
The following environment variables are exported for shell commands:
|
||||||
@@ -173,13 +181,16 @@ The following environment variables are exported for shell commands:
|
|||||||
OLDPWD
|
OLDPWD
|
||||||
LF_LEVEL
|
LF_LEVEL
|
||||||
OPENER
|
OPENER
|
||||||
|
VISUAL
|
||||||
EDITOR
|
EDITOR
|
||||||
PAGER
|
PAGER
|
||||||
SHELL
|
SHELL
|
||||||
|
lf
|
||||||
lf_{option}
|
lf_{option}
|
||||||
lf_user_{option}
|
lf_user_{option}
|
||||||
lf_width
|
lf_width
|
||||||
lf_height
|
lf_height
|
||||||
|
lf_count
|
||||||
|
|
||||||
The following special shell commands are used to customize the behavior of lf when defined:
|
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.
|
Enter a directory or open a file. Also works on the preview window.
|
||||||
|
|
||||||
Scroll wheel
|
Scroll wheel
|
||||||
Scroll up or down.
|
Move up or down. If Ctrl is pressed, scroll up or down.
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
@@ -317,6 +328,7 @@ Change the current working directory to the next/previous jumplist item.
|
|||||||
bottom (default 'G' and '<end>')
|
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')
|
high (default 'H')
|
||||||
middle (default 'M')
|
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.
|
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.
|
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')
|
unselect (default 'u')
|
||||||
|
|
||||||
Remove the selection of all files in all directories.
|
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.
|
Interrupt the current shell-pipe command and return to the normal mode.
|
||||||
|
|
||||||
cmd-history-next (default '<c-n>')
|
cmd-history-next (default '<c-n>' and '<down>')
|
||||||
cmd-history-prev (default '<c-p>')
|
cmd-history-prev (default '<c-p>' and '<up>')
|
||||||
|
|
||||||
Go to next/previous item in the history.
|
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.
|
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
|
# Options
|
||||||
|
|
||||||
This section shows information about options to customize the behavior.
|
This section shows information about options to customize the behavior.
|
||||||
Character ':' is used as the separator for list options '[]int' and '[]string'.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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'.
|
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.
|
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.
|
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+'.
|
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.
|
Show directories first above regular files.
|
||||||
|
|
||||||
dironly bool (default off)
|
dironly 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.
|
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.
|
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.
|
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")
|
filesep string (default "\n")
|
||||||
|
|
||||||
File separator used in environment variables 'fs' and 'fx'.
|
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.
|
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.
|
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.
|
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.
|
Otherwise, these characters are interpreted as they are.
|
||||||
|
|
||||||
hidden bool (default off)
|
hidden bool (default false)
|
||||||
|
|
||||||
Show hidden files.
|
Show hidden files.
|
||||||
On Unix systems, hidden files are determined by the value of 'hiddenfiles'.
|
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.
|
List of hidden file glob patterns.
|
||||||
Patterns can be given as relative or absolute paths.
|
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.
|
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.
|
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.
|
Save command history.
|
||||||
|
|
||||||
icons bool (default off)
|
icons bool (default false)
|
||||||
|
|
||||||
Show icons before each item in the list.
|
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 has no effect when the value is left empty.
|
||||||
This option does not have any effect on Windows.
|
This option does not have any effect on Windows.
|
||||||
|
|
||||||
ignorecase bool (default on)
|
ignorecase bool (default true)
|
||||||
|
|
||||||
Ignore case in sorting and search patterns.
|
Ignore case in sorting and search patterns.
|
||||||
|
|
||||||
ignoredia bool (default on)
|
ignoredia bool (default true)
|
||||||
|
|
||||||
Ignore diacritics in sorting and search patterns.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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)
|
period int (default 0)
|
||||||
|
|
||||||
Set the interval in seconds for periodic checks of directory updates.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
Show the position number relative to the current line.
|
||||||
When 'number' is enabled, current line shows the absolute position, otherwise nothing is shown.
|
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.
|
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')
|
selmode string (default 'all')
|
||||||
|
|
||||||
Selection mode for commands.
|
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.
|
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.
|
Override 'ignorecase' option when the pattern contains an uppercase character.
|
||||||
This option has no effect when 'ignorecase' is disabled.
|
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.
|
Override 'ignoredia' option when the pattern contains a character with diacritic.
|
||||||
This option has no effect when 'ignoredia' is disabled.
|
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.
|
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.
|
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 '')
|
tempmarks string (default '')
|
||||||
|
|
||||||
Marks to be considered temporary (e.g. 'abc' refers to marks 'a', 'b', and 'c').
|
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.
|
String shown after commands of shell-wait type.
|
||||||
|
|
||||||
wrapscan bool (default on)
|
wrapscan bool (default true)
|
||||||
|
|
||||||
Searching can wrap around the file list.
|
Searching can wrap around the file list.
|
||||||
|
|
||||||
wrapscroll bool (default off)
|
wrapscroll bool (default false)
|
||||||
|
|
||||||
Scrolling can wrap around the file list.
|
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
|
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
|
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
|
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
|
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}
|
lf_{option}
|
||||||
|
|
||||||
@@ -912,6 +975,10 @@ Value of the user_{option}.
|
|||||||
|
|
||||||
Width/Height of the terminal.
|
Width/Height of the terminal.
|
||||||
|
|
||||||
|
lf_count
|
||||||
|
|
||||||
|
Value of the count associated with the current command.
|
||||||
|
|
||||||
# Special Commands
|
# Special Commands
|
||||||
|
|
||||||
This section shows information about special shell 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:
|
Command 'set' is used to set an option which can be boolean, integer, or string:
|
||||||
|
|
||||||
set hidden # boolean on
|
set hidden # boolean enable
|
||||||
set nohidden # boolean off
|
set hidden true # boolean enable
|
||||||
|
set nohidden # boolean disable
|
||||||
|
set hidden false # boolean disable
|
||||||
set hidden! # boolean toggle
|
set hidden! # boolean toggle
|
||||||
set scrolloff 10 # integer value
|
set scrolloff 10 # integer value
|
||||||
set sortby time # string value w/o quotes
|
set sortby time # string value w/o quotes
|
||||||
|
|||||||
+159
-76
@@ -39,6 +39,7 @@ The following commands are provided by lf:
|
|||||||
low (default 'L')
|
low (default 'L')
|
||||||
toggle
|
toggle
|
||||||
invert (default 'v')
|
invert (default 'v')
|
||||||
|
invert-below
|
||||||
unselect (default 'u')
|
unselect (default 'u')
|
||||||
glob-select
|
glob-select
|
||||||
glob-unselect
|
glob-unselect
|
||||||
@@ -81,6 +82,8 @@ The following commands are provided by lf:
|
|||||||
mark-remove (modal) (default '"')
|
mark-remove (modal) (default '"')
|
||||||
tag
|
tag
|
||||||
tag-toggle (default 't')
|
tag-toggle (default 't')
|
||||||
|
maps
|
||||||
|
cmaps
|
||||||
|
|
||||||
The following command line commands are provided by lf:
|
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-menu-accept
|
||||||
cmd-enter (default '<c-j>' and '<enter>')
|
cmd-enter (default '<c-j>' and '<enter>')
|
||||||
cmd-interrupt (default '<c-c>')
|
cmd-interrupt (default '<c-c>')
|
||||||
cmd-history-next (default '<c-n>')
|
cmd-history-next (default '<c-n>' and '<down>')
|
||||||
cmd-history-prev (default '<c-p>')
|
cmd-history-prev (default '<c-p>' and '<up>')
|
||||||
cmd-left (default '<c-b>' and '<left>')
|
cmd-left (default '<c-b>' and '<left>')
|
||||||
cmd-right (default '<c-f>' and '<right>')
|
cmd-right (default '<c-f>' and '<right>')
|
||||||
cmd-home (default '<c-a>' and '<home>')
|
cmd-home (default '<c-a>' and '<home>')
|
||||||
@@ -114,56 +117,61 @@ The following command line commands are provided by lf:
|
|||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
anchorfind bool (default on)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default off)
|
autoquit bool (default false)
|
||||||
cleaner string (default '')
|
cleaner string (default '')
|
||||||
dircache bool (default on)
|
cursoractivefmt string (default "\033[7m")
|
||||||
dircounts bool (default off)
|
cursorparentfmt string (default "\033[7m")
|
||||||
dirfirst bool (default on)
|
cursorpreviewfmt string (default "\033[4m")
|
||||||
dironly bool (default off)
|
dircache bool (default true)
|
||||||
dirpreviews bool (default off)
|
dircounts bool (default false)
|
||||||
drawbox bool (default off)
|
dirfirst bool (default true)
|
||||||
errorfmt string (default "\033[7;31;47m%s\033[0m")
|
dironly bool (default false)
|
||||||
|
dirpreviews bool (default false)
|
||||||
|
drawbox bool (default false)
|
||||||
|
errorfmt string (default "\033[7;31;47m")
|
||||||
filesep string (default "\n")
|
filesep string (default "\n")
|
||||||
findlen int (default 1)
|
findlen int (default 1)
|
||||||
globsearch bool (default off)
|
globsearch bool (default false)
|
||||||
hidden bool (default off)
|
hidden bool (default false)
|
||||||
hiddenfiles []string (default '.*')
|
hiddenfiles []string (default '.*')
|
||||||
history bool (default on)
|
history bool (default true)
|
||||||
icons bool (default off)
|
icons bool (default false)
|
||||||
ifs string (default '')
|
ifs string (default '')
|
||||||
ignorecase bool (default on)
|
ignorecase bool (default true)
|
||||||
ignoredia bool (default on)
|
ignoredia bool (default true)
|
||||||
incfilter bool (default off)
|
incfilter bool (default false)
|
||||||
incsearch bool (default off)
|
incsearch bool (default false)
|
||||||
info []string (default '')
|
info []string (default '')
|
||||||
infotimefmtnew string (default 'Jan _2 15:04')
|
infotimefmtnew string (default 'Jan _2 15:04')
|
||||||
infotimefmtold string (default 'Jan _2 2006')
|
infotimefmtold string (default 'Jan _2 2006')
|
||||||
mouse bool (default off)
|
mouse bool (default false)
|
||||||
number bool (default off)
|
number bool (default false)
|
||||||
|
numberfmt string (default "\033[33m")
|
||||||
period int (default 0)
|
period int (default 0)
|
||||||
preview bool (default on)
|
preview bool (default true)
|
||||||
previewer string (default '')
|
previewer string (default '')
|
||||||
promptfmt string (default "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m")
|
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')
|
ratios []int (default '1:2:3')
|
||||||
relativenumber bool (default off)
|
relativenumber bool (default false)
|
||||||
reverse bool (default off)
|
reverse bool (default false)
|
||||||
|
ruler []string (default 'acc:progress:selection:ind')
|
||||||
scrolloff int (default 0)
|
scrolloff int (default 0)
|
||||||
selmode string (default 'all')
|
selmode string (default 'all')
|
||||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||||
shellopts []string (default '')
|
shellopts []string (default '')
|
||||||
smartcase bool (default on)
|
smartcase bool (default true)
|
||||||
smartdia bool (default off)
|
smartdia bool (default false)
|
||||||
sortby string (default 'natural')
|
sortby string (default 'natural')
|
||||||
tabstop int (default 8)
|
tabstop int (default 8)
|
||||||
tagfmt string (default "\033[31m%s\033[0m")
|
tagfmt string (default "\033[31m")
|
||||||
tempmarks string (default '')
|
tempmarks string (default '')
|
||||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||||
truncatechar string (default '~')
|
truncatechar string (default '~')
|
||||||
waitmsg string (default 'Press any key to continue')
|
waitmsg string (default 'Press any key to continue')
|
||||||
wrapscan bool (default on)
|
wrapscan bool (default true)
|
||||||
wrapscroll bool (default off)
|
wrapscroll bool (default false)
|
||||||
user_{option} string (default none)
|
user_{option} string (default none)
|
||||||
|
|
||||||
The following environment variables are exported for shell commands:
|
The following environment variables are exported for shell commands:
|
||||||
@@ -176,13 +184,16 @@ The following environment variables are exported for shell commands:
|
|||||||
OLDPWD
|
OLDPWD
|
||||||
LF_LEVEL
|
LF_LEVEL
|
||||||
OPENER
|
OPENER
|
||||||
|
VISUAL
|
||||||
EDITOR
|
EDITOR
|
||||||
PAGER
|
PAGER
|
||||||
SHELL
|
SHELL
|
||||||
|
lf
|
||||||
lf_{option}
|
lf_{option}
|
||||||
lf_user_{option}
|
lf_user_{option}
|
||||||
lf_width
|
lf_width
|
||||||
lf_height
|
lf_height
|
||||||
|
lf_count
|
||||||
|
|
||||||
The following special shell commands are used to customize the behavior of lf
|
The following special shell commands are used to customize the behavior of lf
|
||||||
when defined:
|
when defined:
|
||||||
@@ -231,7 +242,7 @@ effects:
|
|||||||
Enter a directory or open a file. Also works on the preview window.
|
Enter a directory or open a file. Also works on the preview window.
|
||||||
|
|
||||||
Scroll wheel
|
Scroll wheel
|
||||||
Scroll up or down.
|
Move up or down. If Ctrl is pressed, scroll up or down.
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
@@ -325,7 +336,9 @@ Change the current working directory to the next/previous jumplist item.
|
|||||||
top (default 'gg' and '<home>')
|
top (default 'gg' and '<home>')
|
||||||
bottom (default 'G' and '<end>')
|
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')
|
high (default 'H')
|
||||||
middle (default 'M')
|
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
|
'invert' with 'unselect' (i.e. 'cmd select-all :unselect; invert'), though this
|
||||||
will also remove selections in other directories.
|
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')
|
unselect (default 'u')
|
||||||
|
|
||||||
Remove the selection of all files in all directories.
|
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.
|
Interrupt the current shell-pipe command and return to the normal mode.
|
||||||
|
|
||||||
cmd-history-next (default '<c-n>')
|
cmd-history-next (default '<c-n>' and '<down>')
|
||||||
cmd-history-prev (default '<c-p>')
|
cmd-history-prev (default '<c-p>' and '<up>')
|
||||||
|
|
||||||
Go to next/previous item in the history.
|
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.
|
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
|
# Options
|
||||||
|
|
||||||
This section shows information about options to customize the behavior.
|
This section shows information about options to customize the behavior.
|
||||||
Character ':' is used as the separator for list options '[]int' and '[]string'.
|
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
|
When this option is enabled, find command starts matching patterns from the
|
||||||
beginning of file names, otherwise, it can match at an arbitrary position.
|
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.
|
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
|
and (5) vertical position of preview pane respectively. Preview clearing is
|
||||||
disabled when the value of this option is left empty.
|
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.
|
Cache directory contents.
|
||||||
|
|
||||||
dircounts bool (default off)
|
dircounts bool (default false)
|
||||||
|
|
||||||
When this option is enabled, directory sizes show the number of items inside
|
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
|
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 items are counted per directory at most, and bigger directories are shown as
|
||||||
'999+'.
|
'999+'.
|
||||||
|
|
||||||
dirfirst bool (default on)
|
dirfirst bool (default true)
|
||||||
|
|
||||||
Show directories first above regular files.
|
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
|
If enabled, directories will also be passed to the previewer script. This allows
|
||||||
custom previews for directories.
|
custom previews for directories.
|
||||||
|
|
||||||
dirpreviews bool (default off)
|
drawbox bool (default false)
|
||||||
|
|
||||||
Show only directories.
|
|
||||||
|
|
||||||
drawbox bool (default off)
|
|
||||||
|
|
||||||
Draw boxes around panes with box drawing characters.
|
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.
|
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")
|
filesep string (default "\n")
|
||||||
|
|
||||||
File separator used in environment variables 'fs' and 'fx'.
|
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,
|
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.
|
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,
|
When this option is enabled, search command patterns are considered as globs,
|
||||||
otherwise they are literals. With globbing, '*' matches any sequence, '?'
|
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.
|
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
|
Show hidden files. On Unix systems, hidden files are determined by the value
|
||||||
of 'hiddenfiles'. On Windows, only files with hidden attributes are considered
|
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
|
List of hidden file glob patterns. Patterns can be given as relative or
|
||||||
absolute paths. Globbing supports the usual special characters, '*' to match any
|
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
|
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.
|
Save command history.
|
||||||
|
|
||||||
icons bool (default off)
|
icons bool (default false)
|
||||||
|
|
||||||
Show icons before each item in the list.
|
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
|
no effect when the value is left empty. This option does not have any effect on
|
||||||
Windows.
|
Windows.
|
||||||
|
|
||||||
ignorecase bool (default on)
|
ignorecase bool (default true)
|
||||||
|
|
||||||
Ignore case in sorting and search patterns.
|
Ignore case in sorting and search patterns.
|
||||||
|
|
||||||
ignoredia bool (default on)
|
ignoredia bool (default true)
|
||||||
|
|
||||||
Ignore diacritics in sorting and search patterns.
|
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.
|
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.
|
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
|
Format string of the file time shown in the info column when it doesn't match
|
||||||
this year.
|
this year.
|
||||||
|
|
||||||
mouse bool (default off)
|
mouse bool (default false)
|
||||||
|
|
||||||
Send mouse events as input.
|
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
|
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
|
'relativenumber' option is enabled, only the current line shows the absolute
|
||||||
position and relative positions are shown for the rest.
|
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)
|
period int (default 0)
|
||||||
|
|
||||||
Set the interval in seconds for periodic checks of directory updates. This works
|
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
|
in lf. Periodic checks are disabled when the value of this option is set to
|
||||||
zero.
|
zero.
|
||||||
|
|
||||||
preview bool (default on)
|
preview bool (default true)
|
||||||
|
|
||||||
Show previews of files and directories at the right most pane. If the file
|
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
|
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
|
of panes in the ui. When 'preview' option is enabled, the right most number is
|
||||||
used for the width of preview pane.
|
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,
|
Show the position number relative to the current line. When 'number' is enabled,
|
||||||
current line shows the absolute position, otherwise nothing is shown.
|
current line shows the absolute position, otherwise nothing is shown.
|
||||||
|
|
||||||
reverse bool (default off)
|
reverse bool (default false)
|
||||||
|
|
||||||
Reverse the direction of sort.
|
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')
|
selmode string (default 'all')
|
||||||
|
|
||||||
Selection mode for commands. When set to 'all' it will use the selected files
|
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.
|
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.
|
Override 'ignorecase' option when the pattern contains an uppercase character.
|
||||||
This option has no effect when 'ignorecase' is disabled.
|
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
|
Override 'ignoredia' option when the pattern contains a character with
|
||||||
diacritic. This option has no effect when 'ignoredia' is disabled.
|
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.
|
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.
|
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 '')
|
tempmarks string (default '')
|
||||||
|
|
||||||
Marks to be considered temporary (e.g. 'abc' refers to marks 'a', 'b',
|
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.
|
String shown after commands of shell-wait type.
|
||||||
|
|
||||||
wrapscan bool (default on)
|
wrapscan bool (default true)
|
||||||
|
|
||||||
Searching can wrap around the file list.
|
Searching can wrap around the file list.
|
||||||
|
|
||||||
wrapscroll bool (default off)
|
wrapscroll bool (default false)
|
||||||
|
|
||||||
Scrolling can wrap around the file list.
|
Scrolling can wrap around the file list.
|
||||||
|
|
||||||
@@ -937,23 +1008,29 @@ $LF_LEVEL) "' in your shell configuration file (e.g. '~/.bashrc').
|
|||||||
|
|
||||||
OPENER
|
OPENER
|
||||||
|
|
||||||
If this variable is set in the environment, use the same value, otherwise set
|
If this variable is set in the environment, use the same value. Otherwise,
|
||||||
the value to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
this is set to 'start' in Windows, 'open' in MacOS, 'xdg-open' in others.
|
||||||
|
|
||||||
EDITOR
|
EDITOR
|
||||||
|
|
||||||
If this variable is set in the environment, use the same value, otherwise set
|
If VISUAL is set in the environment, use its value. Otherwise, use the value of
|
||||||
the value to 'vi' on Unix, 'notepad' in Windows.
|
the environment variable EDITOR. If neither variable is set, this is set to 'vi'
|
||||||
|
on Unix, 'notepad' in Windows.
|
||||||
|
|
||||||
PAGER
|
PAGER
|
||||||
|
|
||||||
If this variable is set in the environment, use the same value, otherwise set
|
If this variable is set in the environment, use the same value. Otherwise,
|
||||||
the value to 'less' on Unix, 'more' in Windows.
|
this is set to 'less' on Unix, 'more' in Windows.
|
||||||
|
|
||||||
SHELL
|
SHELL
|
||||||
|
|
||||||
If this variable is set in the environment, use the same value, otherwise set
|
If this variable is set in the environment, use the same value. Otherwise,
|
||||||
the value to 'sh' on Unix, 'cmd' in Windows.
|
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}
|
lf_{option}
|
||||||
|
|
||||||
@@ -968,6 +1045,10 @@ Value of the user_{option}.
|
|||||||
|
|
||||||
Width/Height of the terminal.
|
Width/Height of the terminal.
|
||||||
|
|
||||||
|
lf_count
|
||||||
|
|
||||||
|
Value of the count associated with the current command.
|
||||||
|
|
||||||
# Special Commands
|
# Special Commands
|
||||||
|
|
||||||
This section shows information about special shell 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:
|
Command 'set' is used to set an option which can be boolean, integer, or string:
|
||||||
|
|
||||||
set hidden # boolean on
|
set hidden # boolean enable
|
||||||
set nohidden # boolean off
|
set hidden true # boolean enable
|
||||||
|
set nohidden # boolean disable
|
||||||
|
set hidden false # boolean disable
|
||||||
set hidden! # boolean toggle
|
set hidden! # boolean toggle
|
||||||
set scrolloff 10 # integer value
|
set scrolloff 10 # integer value
|
||||||
set sortby time # string value w/o quotes
|
set sortby time # string value w/o quotes
|
||||||
|
|||||||
+1
-1
@@ -148,7 +148,7 @@ fi # FILE
|
|||||||
*.tsx
|
*.tsx
|
||||||
*.jl
|
*.jl
|
||||||
*.pp
|
*.pp
|
||||||
*.vue ﵂
|
*.vue
|
||||||
*.elm
|
*.elm
|
||||||
*.swift
|
*.swift
|
||||||
*.xcplayground
|
*.xcplayground
|
||||||
|
|||||||
+3
-2
@@ -5,7 +5,7 @@
|
|||||||
# mkdir -p ~/.config/fish/functions
|
# mkdir -p ~/.config/fish/functions
|
||||||
# ln -s "/path/to/lfcd.fish" ~/.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'
|
# bind \co 'set old_tty (stty -g); stty sane; lfcd; stty $old_tty; commandline -f repaint'
|
||||||
#
|
#
|
||||||
@@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
function lfcd
|
function lfcd
|
||||||
set tmp (mktemp)
|
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"
|
if test -f "$tmp"
|
||||||
set dir (cat $tmp)
|
set dir (cat $tmp)
|
||||||
rm -f $tmp
|
rm -f $tmp
|
||||||
|
|||||||
+3
-2
@@ -8,7 +8,7 @@
|
|||||||
# source "$LFCD"
|
# source "$LFCD"
|
||||||
# fi
|
# 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
|
# bind '"\C-o":"lfcd\C-m"' # bash
|
||||||
# bindkey -s '^o' 'lfcd\n' # zsh
|
# bindkey -s '^o' 'lfcd\n' # zsh
|
||||||
@@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
lfcd () {
|
lfcd () {
|
||||||
tmp="$(mktemp)"
|
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
|
if [ -f "$tmp" ]; then
|
||||||
dir="$(cat "$tmp")"
|
dir="$(cat "$tmp")"
|
||||||
rm -f "$tmp"
|
rm -f "$tmp"
|
||||||
|
|||||||
@@ -20,9 +20,15 @@ set ifs "\n"
|
|||||||
# leave some space at the top and the bottom of the screen
|
# leave some space at the top and the bottom of the screen
|
||||||
set scrolloff 10
|
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
|
# use enter for shell commands
|
||||||
map <enter> shell
|
map <enter> shell
|
||||||
|
|
||||||
|
# show the result of execution of previous commands
|
||||||
|
map ` !true
|
||||||
|
|
||||||
# execute current file (must be executable)
|
# execute current file (must be executable)
|
||||||
map x $$f
|
map x $$f
|
||||||
map X !$f
|
map X !$f
|
||||||
@@ -42,6 +48,9 @@ cmd open &{{
|
|||||||
esac
|
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
|
# define a custom 'rename' command without prompt for overwrite
|
||||||
# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
|
# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
|
||||||
# map r push :rename<space>
|
# map r push :rename<space>
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
module github.com/gokcehan/lf
|
module github.com/gokcehan/lf
|
||||||
|
|
||||||
go 1.12
|
go 1.18
|
||||||
|
|
||||||
require (
|
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/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 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
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.6.0 h1:OKbluoP9VYmJwZwq/iLb4BxwKcwGthaa1YNBJIyCySg=
|
||||||
github.com/gdamore/tcell/v2 v2.5.4-0.20221019011350-d3cbfcfb7aa3/go.mod h1:XmCynGHvvGG7UFI6az9zzoEHBvZB1PGf5APwOJMFUyE=
|
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 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
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 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
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.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=
|
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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
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-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-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-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.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-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.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.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.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.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
|
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
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-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.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/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=
|
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')
|
low (default 'L')
|
||||||
toggle
|
toggle
|
||||||
invert (default 'v')
|
invert (default 'v')
|
||||||
|
invert-below
|
||||||
unselect (default 'u')
|
unselect (default 'u')
|
||||||
glob-select
|
glob-select
|
||||||
glob-unselect
|
glob-unselect
|
||||||
@@ -93,6 +94,8 @@ The following commands are provided by lf:
|
|||||||
mark-remove (modal) (default '"')
|
mark-remove (modal) (default '"')
|
||||||
tag
|
tag
|
||||||
tag-toggle (default 't')
|
tag-toggle (default 't')
|
||||||
|
maps
|
||||||
|
cmaps
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
The following command line commands are provided by lf:
|
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-menu-accept
|
||||||
cmd-enter (default '<c-j>' and '<enter>')
|
cmd-enter (default '<c-j>' and '<enter>')
|
||||||
cmd-interrupt (default '<c-c>')
|
cmd-interrupt (default '<c-c>')
|
||||||
cmd-history-next (default '<c-n>')
|
cmd-history-next (default '<c-n>' and '<down>')
|
||||||
cmd-history-prev (default '<c-p>')
|
cmd-history-prev (default '<c-p>' and '<up>')
|
||||||
cmd-left (default '<c-b>' and '<left>')
|
cmd-left (default '<c-b>' and '<left>')
|
||||||
cmd-right (default '<c-f>' and '<right>')
|
cmd-right (default '<c-f>' and '<right>')
|
||||||
cmd-home (default '<c-a>' and '<home>')
|
cmd-home (default '<c-a>' and '<home>')
|
||||||
@@ -130,56 +133,61 @@ The following command line commands are provided by lf:
|
|||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
anchorfind bool (default on)
|
anchorfind bool (default true)
|
||||||
autoquit bool (default off)
|
autoquit bool (default false)
|
||||||
cleaner string (default '')
|
cleaner string (default '')
|
||||||
dircache bool (default on)
|
cursoractivefmt string (default "\e033[7m")
|
||||||
dircounts bool (default off)
|
cursorparentfmt string (default "\e033[7m")
|
||||||
dirfirst bool (default on)
|
cursorpreviewfmt string (default "\e033[4m")
|
||||||
dironly bool (default off)
|
dircache bool (default true)
|
||||||
dirpreviews bool (default off)
|
dircounts bool (default false)
|
||||||
drawbox bool (default off)
|
dirfirst bool (default true)
|
||||||
errorfmt string (default "\e033[7;31;47m%s\e033[0m")
|
dironly bool (default false)
|
||||||
|
dirpreviews bool (default false)
|
||||||
|
drawbox bool (default false)
|
||||||
|
errorfmt string (default "\e033[7;31;47m")
|
||||||
filesep string (default "\en")
|
filesep string (default "\en")
|
||||||
findlen int (default 1)
|
findlen int (default 1)
|
||||||
globsearch bool (default off)
|
globsearch bool (default false)
|
||||||
hidden bool (default off)
|
hidden bool (default false)
|
||||||
hiddenfiles []string (default '.*')
|
hiddenfiles []string (default '.*')
|
||||||
history bool (default on)
|
history bool (default true)
|
||||||
icons bool (default off)
|
icons bool (default false)
|
||||||
ifs string (default '')
|
ifs string (default '')
|
||||||
ignorecase bool (default on)
|
ignorecase bool (default true)
|
||||||
ignoredia bool (default on)
|
ignoredia bool (default true)
|
||||||
incfilter bool (default off)
|
incfilter bool (default false)
|
||||||
incsearch bool (default off)
|
incsearch bool (default false)
|
||||||
info []string (default '')
|
info []string (default '')
|
||||||
infotimefmtnew string (default 'Jan _2 15:04')
|
infotimefmtnew string (default 'Jan _2 15:04')
|
||||||
infotimefmtold string (default 'Jan _2 2006')
|
infotimefmtold string (default 'Jan _2 2006')
|
||||||
mouse bool (default off)
|
mouse bool (default false)
|
||||||
number bool (default off)
|
number bool (default false)
|
||||||
|
numberfmt string (default "\e033[33m")
|
||||||
period int (default 0)
|
period int (default 0)
|
||||||
preview bool (default on)
|
preview bool (default true)
|
||||||
previewer string (default '')
|
previewer string (default '')
|
||||||
promptfmt string (default "\e033[32;1m%u@%h\e033[0m:\e033[34;1m%d\e033[0m\e033[1m%f\e033[0m")
|
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')
|
ratios []int (default '1:2:3')
|
||||||
relativenumber bool (default off)
|
relativenumber bool (default false)
|
||||||
reverse bool (default off)
|
reverse bool (default false)
|
||||||
|
ruler []string (default 'acc:progress:selection:ind')
|
||||||
scrolloff int (default 0)
|
scrolloff int (default 0)
|
||||||
selmode string (default 'all')
|
selmode string (default 'all')
|
||||||
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
shell string (default 'sh' for Unix and 'cmd' for Windows)
|
||||||
shellflag string (default '-c' for Unix and '/c' for Windows)
|
shellflag string (default '-c' for Unix and '/c' for Windows)
|
||||||
shellopts []string (default '')
|
shellopts []string (default '')
|
||||||
smartcase bool (default on)
|
smartcase bool (default true)
|
||||||
smartdia bool (default off)
|
smartdia bool (default false)
|
||||||
sortby string (default 'natural')
|
sortby string (default 'natural')
|
||||||
tabstop int (default 8)
|
tabstop int (default 8)
|
||||||
tagfmt string (default "\e033[31m%s\e033[0m")
|
tagfmt string (default "\e033[31m")
|
||||||
tempmarks string (default '')
|
tempmarks string (default '')
|
||||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||||
truncatechar string (default '~')
|
truncatechar string (default '~')
|
||||||
waitmsg string (default 'Press any key to continue')
|
waitmsg string (default 'Press any key to continue')
|
||||||
wrapscan bool (default on)
|
wrapscan bool (default true)
|
||||||
wrapscroll bool (default off)
|
wrapscroll bool (default false)
|
||||||
user_{option} string (default none)
|
user_{option} string (default none)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
@@ -194,13 +202,16 @@ The following environment variables are exported for shell commands:
|
|||||||
OLDPWD
|
OLDPWD
|
||||||
LF_LEVEL
|
LF_LEVEL
|
||||||
OPENER
|
OPENER
|
||||||
|
VISUAL
|
||||||
EDITOR
|
EDITOR
|
||||||
PAGER
|
PAGER
|
||||||
SHELL
|
SHELL
|
||||||
|
lf
|
||||||
lf_{option}
|
lf_{option}
|
||||||
lf_user_{option}
|
lf_user_{option}
|
||||||
lf_width
|
lf_width
|
||||||
lf_height
|
lf_height
|
||||||
|
lf_count
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
The following special shell commands are used to customize the behavior of lf when defined:
|
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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
Scroll wheel
|
Scroll wheel
|
||||||
Scroll up or down.
|
Move up or down. If Ctrl is pressed, scroll up or down.
|
||||||
.EE
|
.EE
|
||||||
.SH CONFIGURATION
|
.SH CONFIGURATION
|
||||||
Configuration files should be located at:
|
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>')
|
bottom (default 'G' and '<end>')
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
high (default 'H')
|
high (default 'H')
|
||||||
@@ -392,6 +403,16 @@ Toggle the selection of the current file or files given as arguments.
|
|||||||
.PP
|
.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.
|
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
|
.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
|
.EX
|
||||||
unselect (default 'u')
|
unselect (default 'u')
|
||||||
.EE
|
.EE
|
||||||
@@ -648,8 +669,8 @@ Execute the current line.
|
|||||||
Interrupt the current shell-pipe command and return to the normal mode.
|
Interrupt the current shell-pipe command and return to the normal mode.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
cmd-history-next (default '<c-n>')
|
cmd-history-next (default '<c-n>' and '<down>')
|
||||||
cmd-history-prev (default '<c-p>')
|
cmd-history-prev (default '<c-p>' and '<up>')
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Go to next/previous item in the history.
|
Go to next/previous item in the history.
|
||||||
@@ -726,17 +747,24 @@ Delete the next word in forward direction.
|
|||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Capitalize/uppercase/lowercase the current word and jump to the next word.
|
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
|
.SH OPTIONS
|
||||||
This section shows information about options to customize the behavior. Character ':' is used as the separator for list options '[]int' and '[]string'.
|
This section shows information about options to customize the behavior. Character ':' is used as the separator for list options '[]int' and '[]string'.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
anchorfind bool (default on)
|
anchorfind bool (default true)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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.
|
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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
autoquit bool (default off)
|
autoquit bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Automatically quit server when there are no clients left connected.
|
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.
|
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
|
.PP
|
||||||
.EX
|
.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
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Cache directory contents.
|
Cache directory contents.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
dircounts bool (default off)
|
dircounts bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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+'.
|
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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
dirfirst bool (default on)
|
dirfirst bool (default true)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Show directories first above regular files.
|
Show directories first above regular files.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
dironly bool (default off)
|
dironly bool (default false)
|
||||||
.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)
|
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Show only directories.
|
Show only directories.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.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
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Draw boxes around panes with box drawing characters.
|
Draw boxes around panes with box drawing characters.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
errorfmt string (default "\e033[7;31;47m%s\e033[0m")
|
errorfmt string (default "\e033[7;31;47m")
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Format string of error messages shown in the bottom message line.
|
Format string of error messages shown in the bottom message line.
|
||||||
.PP
|
.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
|
.EX
|
||||||
filesep string (default "\en")
|
filesep string (default "\en")
|
||||||
.EE
|
.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.
|
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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
globsearch bool (default off)
|
globsearch bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
hidden bool (default off)
|
hidden bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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.
|
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 '.*')
|
hiddenfiles []string (default '.*')
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
history bool (default on)
|
history bool (default true)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Save command history.
|
Save command history.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
icons bool (default off)
|
icons bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Show icons before each item in the list.
|
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.
|
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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
ignorecase bool (default on)
|
ignorecase bool (default true)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Ignore case in sorting and search patterns.
|
Ignore case in sorting and search patterns.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
ignoredia bool (default on)
|
ignoredia bool (default true)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Ignore diacritics in sorting and search patterns.
|
Ignore diacritics in sorting and search patterns.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
incsearch bool (default off)
|
incsearch bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Jump to the first match after each keystroke during searching.
|
Jump to the first match after each keystroke during searching.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
incfilter bool (default off)
|
incfilter bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Apply filter pattern after each keystroke during filtering.
|
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.
|
Format string of the file time shown in the info column when it doesn't match this year.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
mouse bool (default off)
|
mouse bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Send mouse events as input.
|
Send mouse events as input.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
number bool (default off)
|
number bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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.
|
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
|
.PP
|
||||||
|
.EX
|
||||||
|
numberfmt string (default "\e033[33m")
|
||||||
|
.EE
|
||||||
|
.PP
|
||||||
|
Format string of the position number for each line.
|
||||||
|
.PP
|
||||||
.EX
|
.EX
|
||||||
period int (default 0)
|
period int (default 0)
|
||||||
.EE
|
.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.
|
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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
preview bool (default on)
|
preview bool (default true)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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'.
|
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.
|
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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
relativenumber bool (default off)
|
relativenumber bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Show the position number relative to the current line. When 'number' is enabled, current line shows the absolute position, otherwise nothing is shown.
|
Show the position number relative to the current line. When 'number' is enabled, current line shows the absolute position, otherwise nothing is shown.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
reverse bool (default off)
|
reverse bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Reverse the direction of sort.
|
Reverse the direction of sort.
|
||||||
.PP
|
.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
|
.EX
|
||||||
selmode string (default 'all')
|
selmode string (default 'all')
|
||||||
.EE
|
.EE
|
||||||
@@ -964,13 +1020,13 @@ Command line flag used to pass shell commands.
|
|||||||
List of shell options to pass to the shell executable.
|
List of shell options to pass to the shell executable.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
smartcase bool (default on)
|
smartcase bool (default true)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Override 'ignorecase' option when the pattern contains an uppercase character. This option has no effect when 'ignorecase' is disabled.
|
Override 'ignorecase' option when the pattern contains an uppercase character. This option has no effect when 'ignorecase' is disabled.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
smartdia bool (default off)
|
smartdia bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Override 'ignoredia' option when the pattern contains a character with diacritic. This option has no effect when 'ignoredia' is disabled.
|
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.
|
Number of space characters to show for horizontal tabulation (U+0009) character.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
tagfmt string (default "\e033[31m%s\e033[0m")
|
tagfmt string (default "\e033[31m")
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Format string of the tags.
|
Format string of the tags.
|
||||||
.PP
|
.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
|
.EX
|
||||||
tempmarks string (default '')
|
tempmarks string (default '')
|
||||||
.EE
|
.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.
|
String shown after commands of shell-wait type.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
wrapscan bool (default on)
|
wrapscan bool (default true)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Searching can wrap around the file list.
|
Searching can wrap around the file list.
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
wrapscroll bool (default off)
|
wrapscroll bool (default false)
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Scrolling can wrap around the file list.
|
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
|
OPENER
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
EDITOR
|
EDITOR
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
PAGER
|
PAGER
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
SHELL
|
SHELL
|
||||||
.EE
|
.EE
|
||||||
.PP
|
.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
|
.PP
|
||||||
.EX
|
.EX
|
||||||
lf_{option}
|
lf_{option}
|
||||||
@@ -1121,6 +1185,12 @@ Value of the user_{option}.
|
|||||||
.EE
|
.EE
|
||||||
.PP
|
.PP
|
||||||
Width/Height of the terminal.
|
Width/Height of the terminal.
|
||||||
|
.PP
|
||||||
|
.EX
|
||||||
|
lf_count
|
||||||
|
.EE
|
||||||
|
.PP
|
||||||
|
Value of the count associated with the current command.
|
||||||
.SH SPECIAL COMMANDS
|
.SH SPECIAL COMMANDS
|
||||||
This section shows information about special shell commands.
|
This section shows information about special shell commands.
|
||||||
.PP
|
.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:
|
Command 'set' is used to set an option which can be boolean, integer, or string:
|
||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
set hidden # boolean on
|
set hidden # boolean enable
|
||||||
set nohidden # boolean off
|
set hidden true # boolean enable
|
||||||
|
set nohidden # boolean disable
|
||||||
|
set hidden false # boolean disable
|
||||||
set hidden! # boolean toggle
|
set hidden! # boolean toggle
|
||||||
set scrolloff 10 # integer value
|
set scrolloff 10 # integer value
|
||||||
set sortby time # string value w/o quotes
|
set sortby time # string value w/o quotes
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ func exportEnvVars() {
|
|||||||
level++
|
level++
|
||||||
|
|
||||||
os.Setenv("LF_LEVEL", strconv.Itoa(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
|
// used by exportOpts below
|
||||||
|
|||||||
@@ -388,11 +388,15 @@ type nav struct {
|
|||||||
searchPos int
|
searchPos int
|
||||||
prevFilter []string
|
prevFilter []string
|
||||||
volatilePreview bool
|
volatilePreview bool
|
||||||
|
previewTimer *time.Timer
|
||||||
|
previewLoading bool
|
||||||
jumpList []string
|
jumpList []string
|
||||||
jumpListInd int
|
jumpListInd int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nav *nav) loadDirInternal(path string) *dir {
|
func (nav *nav) loadDirInternal(path string) *dir {
|
||||||
|
nav.startPreview()
|
||||||
|
|
||||||
d := &dir{
|
d := &dir{
|
||||||
loading: true,
|
loading: true,
|
||||||
loadTime: time.Now(),
|
loadTime: time.Now(),
|
||||||
@@ -448,6 +452,7 @@ func (nav *nav) checkDir(dir *dir) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav.startPreview()
|
||||||
dir.loading = true
|
dir.loading = true
|
||||||
dir.loadTime = now
|
dir.loadTime = now
|
||||||
go func() {
|
go func() {
|
||||||
@@ -465,10 +470,11 @@ func (nav *nav) checkDir(dir *dir) {
|
|||||||
dir.ignorecase != gOpts.ignorecase ||
|
dir.ignorecase != gOpts.ignorecase ||
|
||||||
dir.ignoredia != gOpts.ignoredia:
|
dir.ignoredia != gOpts.ignoredia:
|
||||||
dir.loading = true
|
dir.loading = true
|
||||||
|
sd := *dir
|
||||||
go func() {
|
go func() {
|
||||||
dir.sort()
|
sd.sort()
|
||||||
dir.loading = false
|
sd.loading = false
|
||||||
nav.dirChan <- dir
|
nav.dirChan <- &sd
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -511,6 +517,7 @@ func newNav(height int) *nav {
|
|||||||
tags: make(map[string]string),
|
tags: make(map[string]string),
|
||||||
selectionInd: 0,
|
selectionInd: 0,
|
||||||
height: height,
|
height: height,
|
||||||
|
previewTimer: time.NewTimer(0),
|
||||||
jumpList: make([]string, 0),
|
jumpList: make([]string, 0),
|
||||||
jumpListInd: -1,
|
jumpListInd: -1,
|
||||||
}
|
}
|
||||||
@@ -534,7 +541,6 @@ func (nav *nav) addJumpList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (nav *nav) cdJumpListPrev() {
|
func (nav *nav) cdJumpListPrev() {
|
||||||
// currPath := nav.currDir().path
|
|
||||||
if nav.jumpListInd > 0 {
|
if nav.jumpListInd > 0 {
|
||||||
nav.jumpListInd -= 1
|
nav.jumpListInd -= 1
|
||||||
nav.cd(nav.jumpList[nav.jumpListInd])
|
nav.cd(nav.jumpList[nav.jumpListInd])
|
||||||
@@ -814,6 +820,7 @@ func (nav *nav) loadReg(path string, volatile bool) *reg {
|
|||||||
if !ok || (volatile && r.volatile) {
|
if !ok || (volatile && r.volatile) {
|
||||||
r := ®{loading: true, loadTime: time.Now(), path: path, volatile: true}
|
r := ®{loading: true, loadTime: time.Now(), path: path, volatile: true}
|
||||||
nav.regCache[path] = r
|
nav.regCache[path] = r
|
||||||
|
nav.startPreview()
|
||||||
nav.previewChan <- path
|
nav.previewChan <- path
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
@@ -839,10 +846,17 @@ func (nav *nav) checkReg(reg *reg) {
|
|||||||
|
|
||||||
if s.ModTime().After(reg.loadTime) {
|
if s.ModTime().After(reg.loadTime) {
|
||||||
reg.loadTime = now
|
reg.loadTime = now
|
||||||
|
nav.startPreview()
|
||||||
nav.previewChan <- reg.path
|
nav.previewChan <- reg.path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (nav *nav) startPreview() {
|
||||||
|
nav.previewTimer.Stop()
|
||||||
|
nav.previewLoading = false
|
||||||
|
nav.previewTimer.Reset(100 * time.Millisecond)
|
||||||
|
}
|
||||||
|
|
||||||
func (nav *nav) sort() {
|
func (nav *nav) sort() {
|
||||||
for _, d := range nav.dirs {
|
for _, d := range nav.dirs {
|
||||||
name := d.name()
|
name := d.name()
|
||||||
@@ -912,11 +926,13 @@ func (nav *nav) down(dist int) bool {
|
|||||||
dir.ind = min(maxind, dir.ind)
|
dir.ind = min(maxind, dir.ind)
|
||||||
|
|
||||||
dir.pos += dist
|
dir.pos += dist
|
||||||
edge := min(min(nav.height/2, gOpts.scrolloff), maxind-dir.ind)
|
// 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
|
||||||
// use a smaller value when the height is even and scrolloff is maxed
|
half := nav.height / 2
|
||||||
// in order to stay at the same row as much as possible while up/down
|
if nav.height%2 == 0 {
|
||||||
edge = min(edge, nav.height/2+nav.height%2-1)
|
half--
|
||||||
|
}
|
||||||
|
edge := min(min(half, gOpts.scrolloff), maxind-dir.ind)
|
||||||
|
|
||||||
dir.pos = min(dir.pos, nav.height-edge-1)
|
dir.pos = min(dir.pos, nav.height-edge-1)
|
||||||
dir.pos = min(dir.pos, maxind)
|
dir.pos = min(dir.pos, maxind)
|
||||||
@@ -1086,6 +1102,19 @@ func (nav *nav) low() bool {
|
|||||||
return old != dir.ind
|
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) {
|
func (nav *nav) toggleSelection(path string) {
|
||||||
if _, ok := nav.selections[path]; ok {
|
if _, ok := nav.selections[path]; ok {
|
||||||
delete(nav.selections, path)
|
delete(nav.selections, path)
|
||||||
@@ -1149,14 +1178,22 @@ func (nav *nav) tag(tag string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nav *nav) invert() {
|
func (nav *nav) invertAfter(ix int) {
|
||||||
dir := nav.currDir()
|
dir := nav.currDir()
|
||||||
for _, f := range dir.files {
|
for _, f := range dir.files[ix:] {
|
||||||
path := filepath.Join(dir.path, f.Name())
|
path := filepath.Join(dir.path, f.Name())
|
||||||
nav.toggleSelection(path)
|
nav.toggleSelection(path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (nav *nav) invert() {
|
||||||
|
nav.invertAfter(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nav *nav) invertBelow() {
|
||||||
|
nav.invertAfter(nav.currDir().ind)
|
||||||
|
}
|
||||||
|
|
||||||
func (nav *nav) unselect() {
|
func (nav *nav) unselect() {
|
||||||
nav.selections = make(map[string]int)
|
nav.selections = make(map[string]int)
|
||||||
nav.selectionInd = 0
|
nav.selectionInd = 0
|
||||||
@@ -1426,6 +1463,12 @@ func (nav *nav) rename() error {
|
|||||||
return err
|
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))
|
dir := nav.loadDir(filepath.Dir(newPath))
|
||||||
|
|
||||||
if dir.loading {
|
if dir.loading {
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ type sortType struct {
|
|||||||
var gOpts struct {
|
var gOpts struct {
|
||||||
anchorfind bool
|
anchorfind bool
|
||||||
autoquit bool
|
autoquit bool
|
||||||
|
cursoractivefmt string
|
||||||
|
cursorparentfmt string
|
||||||
|
cursorpreviewfmt string
|
||||||
dircache bool
|
dircache bool
|
||||||
dircounts bool
|
dircounts bool
|
||||||
dironly bool
|
dironly bool
|
||||||
@@ -71,6 +74,7 @@ var gOpts struct {
|
|||||||
hiddenfiles []string
|
hiddenfiles []string
|
||||||
history bool
|
history bool
|
||||||
info []string
|
info []string
|
||||||
|
ruler []string
|
||||||
shellopts []string
|
shellopts []string
|
||||||
keys map[string]expr
|
keys map[string]expr
|
||||||
cmdkeys map[string]expr
|
cmdkeys map[string]expr
|
||||||
@@ -78,6 +82,7 @@ var gOpts struct {
|
|||||||
user map[string]string
|
user map[string]string
|
||||||
sortType sortType
|
sortType sortType
|
||||||
tempmarks string
|
tempmarks string
|
||||||
|
numberfmt string
|
||||||
tagfmt string
|
tagfmt string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +94,9 @@ func init() {
|
|||||||
gOpts.dironly = false
|
gOpts.dironly = false
|
||||||
gOpts.dirpreviews = false
|
gOpts.dirpreviews = false
|
||||||
gOpts.drawbox = false
|
gOpts.drawbox = false
|
||||||
|
gOpts.cursoractivefmt = "\033[7m"
|
||||||
|
gOpts.cursorparentfmt = "\033[7m"
|
||||||
|
gOpts.cursorpreviewfmt = "\033[4m"
|
||||||
gOpts.globsearch = false
|
gOpts.globsearch = false
|
||||||
gOpts.icons = false
|
gOpts.icons = false
|
||||||
gOpts.ignorecase = true
|
gOpts.ignorecase = true
|
||||||
@@ -108,7 +116,7 @@ func init() {
|
|||||||
gOpts.period = 0
|
gOpts.period = 0
|
||||||
gOpts.scrolloff = 0
|
gOpts.scrolloff = 0
|
||||||
gOpts.tabstop = 8
|
gOpts.tabstop = 8
|
||||||
gOpts.errorfmt = "\033[7;31;47m%s\033[0m"
|
gOpts.errorfmt = "\033[7;31;47m"
|
||||||
gOpts.filesep = "\n"
|
gOpts.filesep = "\n"
|
||||||
gOpts.ifs = ""
|
gOpts.ifs = ""
|
||||||
gOpts.previewer = ""
|
gOpts.previewer = ""
|
||||||
@@ -125,10 +133,12 @@ func init() {
|
|||||||
gOpts.hiddenfiles = []string{".*"}
|
gOpts.hiddenfiles = []string{".*"}
|
||||||
gOpts.history = true
|
gOpts.history = true
|
||||||
gOpts.info = nil
|
gOpts.info = nil
|
||||||
|
gOpts.ruler = []string{"acc", "progress", "selection", "ind"}
|
||||||
gOpts.shellopts = nil
|
gOpts.shellopts = nil
|
||||||
gOpts.sortType = sortType{naturalSort, dirfirstSort}
|
gOpts.sortType = sortType{naturalSort, dirfirstSort}
|
||||||
gOpts.tempmarks = "'"
|
gOpts.tempmarks = "'"
|
||||||
gOpts.tagfmt = "\033[31m%s\033[0m"
|
gOpts.numberfmt = "\033[33m"
|
||||||
|
gOpts.tagfmt = "\033[31m"
|
||||||
|
|
||||||
gOpts.keys = make(map[string]expr)
|
gOpts.keys = make(map[string]expr)
|
||||||
|
|
||||||
@@ -139,6 +149,7 @@ func init() {
|
|||||||
gOpts.keys["<c-b>"] = &callExpr{"page-up", nil, 1}
|
gOpts.keys["<c-b>"] = &callExpr{"page-up", nil, 1}
|
||||||
gOpts.keys["<pgup>"] = &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-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["j"] = &callExpr{"down", nil, 1}
|
||||||
gOpts.keys["<down>"] = &callExpr{"down", nil, 1}
|
gOpts.keys["<down>"] = &callExpr{"down", nil, 1}
|
||||||
gOpts.keys["<m-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["<c-f>"] = &callExpr{"page-down", nil, 1}
|
||||||
gOpts.keys["<pgdn>"] = &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-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["h"] = &callExpr{"updir", nil, 1}
|
||||||
gOpts.keys["<left>"] = &callExpr{"updir", nil, 1}
|
gOpts.keys["<left>"] = &callExpr{"updir", nil, 1}
|
||||||
gOpts.keys["l"] = &callExpr{"open", nil, 1}
|
gOpts.keys["l"] = &callExpr{"open", nil, 1}
|
||||||
gOpts.keys["<right>"] = &callExpr{"open", nil, 1}
|
gOpts.keys["<right>"] = &callExpr{"open", nil, 1}
|
||||||
gOpts.keys["q"] = &callExpr{"quit", nil, 1}
|
gOpts.keys["q"] = &callExpr{"quit", nil, 1}
|
||||||
gOpts.keys["gg"] = &callExpr{"top", nil, 1}
|
gOpts.keys["gg"] = &callExpr{"top", nil, 0}
|
||||||
gOpts.keys["<home>"] = &callExpr{"top", nil, 1}
|
gOpts.keys["<home>"] = &callExpr{"top", nil, 0}
|
||||||
gOpts.keys["G"] = &callExpr{"bottom", nil, 1}
|
gOpts.keys["G"] = &callExpr{"bottom", nil, 0}
|
||||||
gOpts.keys["<end>"] = &callExpr{"bottom", nil, 1}
|
gOpts.keys["<end>"] = &callExpr{"bottom", nil, 0}
|
||||||
gOpts.keys["H"] = &callExpr{"high", nil, 1}
|
gOpts.keys["H"] = &callExpr{"high", nil, 1}
|
||||||
gOpts.keys["M"] = &callExpr{"middle", nil, 1}
|
gOpts.keys["M"] = &callExpr{"middle", nil, 1}
|
||||||
gOpts.keys["L"] = &callExpr{"low", 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["<tab>"] = &callExpr{"cmd-complete", nil, 1}
|
||||||
gOpts.cmdkeys["<enter>"] = &callExpr{"cmd-enter", nil, 1}
|
gOpts.cmdkeys["<enter>"] = &callExpr{"cmd-enter", nil, 1}
|
||||||
gOpts.cmdkeys["<c-j>"] = &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["<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["<c-p>"] = &callExpr{"cmd-history-prev", nil, 1}
|
||||||
gOpts.cmdkeys["<delete>"] = &callExpr{"cmd-delete", nil, 1}
|
gOpts.cmdkeys["<delete>"] = &callExpr{"cmd-delete", nil, 1}
|
||||||
gOpts.cmdkeys["<c-d>"] = &callExpr{"cmd-delete", nil, 1}
|
gOpts.cmdkeys["<c-d>"] = &callExpr{"cmd-delete", nil, 1}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
envOpener = os.Getenv("OPENER")
|
envOpener = os.Getenv("OPENER")
|
||||||
envEditor = os.Getenv("EDITOR")
|
envEditor = os.Getenv("VISUAL")
|
||||||
envPager = os.Getenv("PAGER")
|
envPager = os.Getenv("PAGER")
|
||||||
envShell = os.Getenv("SHELL")
|
envShell = os.Getenv("SHELL")
|
||||||
)
|
)
|
||||||
@@ -50,9 +50,12 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if envEditor == "" {
|
||||||
|
envEditor = os.Getenv("EDITOR")
|
||||||
if envEditor == "" {
|
if envEditor == "" {
|
||||||
envEditor = "vi"
|
envEditor = "vi"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if envPager == "" {
|
if envPager == "" {
|
||||||
envPager = "less"
|
envPager = "less"
|
||||||
@@ -159,7 +162,7 @@ func setDefaults() {
|
|||||||
gOpts.keys["i"] = &execExpr{"$", `$PAGER "$f"`}
|
gOpts.keys["i"] = &execExpr{"$", `$PAGER "$f"`}
|
||||||
gOpts.keys["w"] = &execExpr{"$", "$SHELL"}
|
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}
|
gOpts.keys["<f-1>"] = &callExpr{"doc", nil, 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,3 +230,14 @@ func exportFiles(f string, fs []string, pwd string) {
|
|||||||
os.Setenv("fx", envFiles)
|
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)))
|
||||||
|
}
|
||||||
+21
-2
@@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
envOpener = os.Getenv("OPENER")
|
envOpener = os.Getenv("OPENER")
|
||||||
envEditor = os.Getenv("EDITOR")
|
envEditor = os.Getenv("VISUAL")
|
||||||
envPager = os.Getenv("PAGER")
|
envPager = os.Getenv("PAGER")
|
||||||
envShell = os.Getenv("SHELL")
|
envShell = os.Getenv("SHELL")
|
||||||
)
|
)
|
||||||
@@ -44,9 +44,12 @@ func init() {
|
|||||||
envOpener = `start ""`
|
envOpener = `start ""`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if envEditor == "" {
|
||||||
|
envEditor = os.Getenv("EDITOR")
|
||||||
if envEditor == "" {
|
if envEditor == "" {
|
||||||
envEditor = "notepad"
|
envEditor = "notepad"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if envPager == "" {
|
if envPager == "" {
|
||||||
envPager = "more"
|
envPager = "more"
|
||||||
@@ -115,7 +118,7 @@ func setDefaults() {
|
|||||||
gOpts.keys["i"] = &execExpr{"!", "%PAGER% %f%"}
|
gOpts.keys["i"] = &execExpr{"!", "%PAGER% %f%"}
|
||||||
gOpts.keys["w"] = &execExpr{"$", "%SHELL%"}
|
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}
|
gOpts.keys["<f-1>"] = &callExpr{"doc", nil, 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,3 +184,19 @@ func exportFiles(f string, fs []string, pwd string) {
|
|||||||
os.Setenv("fx", envFiles)
|
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 (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
@@ -38,7 +37,7 @@ type scanner struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newScanner(r io.Reader) *scanner {
|
func newScanner(r io.Reader) *scanner {
|
||||||
buf, err := ioutil.ReadAll(r)
|
buf, err := io.ReadAll(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("scanning: %s", err)
|
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)
|
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 {
|
if reg == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -260,8 +260,10 @@ func (win *win) printReg(screen tcell.Screen, reg *reg) {
|
|||||||
st := tcell.StyleDefault
|
st := tcell.StyleDefault
|
||||||
|
|
||||||
if reg.loading {
|
if reg.loading {
|
||||||
|
if previewLoading {
|
||||||
st = st.Reverse(true)
|
st = st.Reverse(true)
|
||||||
win.print(screen, 2, 0, st, "loading...")
|
win.print(screen, 2, 0, st, "loading...")
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,19 +332,26 @@ type dirContext struct {
|
|||||||
tags map[string]string
|
tags map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type dirRole byte
|
||||||
|
|
||||||
|
const (
|
||||||
|
Active dirRole = iota
|
||||||
|
Parent
|
||||||
|
Preview
|
||||||
|
)
|
||||||
|
|
||||||
type dirStyle struct {
|
type dirStyle struct {
|
||||||
colors styleMap
|
colors styleMap
|
||||||
icons iconMap
|
icons iconMap
|
||||||
previewing bool
|
role dirRole
|
||||||
}
|
}
|
||||||
|
|
||||||
// These colors are not currently customizeable
|
// These colors are not currently customizeable
|
||||||
const LineNumberColor = tcell.ColorOlive
|
|
||||||
const SelectionColor = tcell.ColorPurple
|
const SelectionColor = tcell.ColorPurple
|
||||||
const YankColor = tcell.ColorOlive
|
const YankColor = tcell.ColorOlive
|
||||||
const CutColor = tcell.ColorMaroon
|
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 {
|
if win.w < 5 || dir == nil {
|
||||||
return
|
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")
|
win.print(screen, 2, 0, messageStyle, "permission denied")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (dir.loading && len(dir.files) == 0) || (dirStyle.previewing && dir.loading && gOpts.dirpreviews) {
|
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...")
|
win.print(screen, 2, 0, messageStyle, "loading...")
|
||||||
|
}
|
||||||
return
|
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.
|
// Print previewer result instead of default directory print operation.
|
||||||
st := tcell.StyleDefault
|
st := tcell.StyleDefault
|
||||||
for i, l := range dir.lines {
|
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 lnwidth int
|
||||||
var lnformat string
|
|
||||||
|
|
||||||
if gOpts.number || gOpts.relativenumber {
|
if gOpts.number || gOpts.relativenumber {
|
||||||
lnwidth = 1
|
lnwidth = 1
|
||||||
if gOpts.number && gOpts.relativenumber {
|
if gOpts.number && gOpts.relativenumber {
|
||||||
lnwidth++
|
lnwidth++
|
||||||
}
|
}
|
||||||
for j := 10; j < len(dir.files); j *= 10 {
|
for j := 10; j <= len(dir.files); j *= 10 {
|
||||||
lnwidth++
|
lnwidth++
|
||||||
}
|
}
|
||||||
lnformat = fmt.Sprintf("%%%d.d ", lnwidth)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, f := range dir.files[beg:end] {
|
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
|
var ln string
|
||||||
|
|
||||||
if gOpts.number && (!gOpts.relativenumber) {
|
if gOpts.number && (!gOpts.relativenumber) {
|
||||||
ln = fmt.Sprintf(lnformat, i+1+beg)
|
ln = fmt.Sprintf("%*d", lnwidth, i+1+beg)
|
||||||
} else if gOpts.relativenumber {
|
} else if gOpts.relativenumber {
|
||||||
switch {
|
switch {
|
||||||
case i < dir.pos:
|
case i < dir.pos:
|
||||||
ln = fmt.Sprintf(lnformat, dir.pos-i)
|
ln = fmt.Sprintf("%*d", lnwidth, dir.pos-i)
|
||||||
case i > dir.pos:
|
case i > dir.pos:
|
||||||
ln = fmt.Sprintf(lnformat, i-dir.pos)
|
ln = fmt.Sprintf("%*d", lnwidth, i-dir.pos)
|
||||||
case gOpts.number:
|
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:
|
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())
|
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
|
var s []rune
|
||||||
|
|
||||||
s = append(s, ' ')
|
s = append(s, ' ')
|
||||||
|
|
||||||
var iwidth int
|
|
||||||
|
|
||||||
if gOpts.icons {
|
if gOpts.icons {
|
||||||
s = append(s, []rune(dirStyle.icons.get(f))...)
|
s = append(s, []rune(dirStyle.icons.get(f))...)
|
||||||
s = append(s, ' ')
|
s = append(s, ' ')
|
||||||
iwidth = 2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, r := range f.Name() {
|
for _, r := range f.Name() {
|
||||||
@@ -454,39 +456,59 @@ func (win *win) printDir(screen tcell.Screen, dir *dir, context *dirContext, dir
|
|||||||
|
|
||||||
w := runeSliceWidth(s)
|
w := runeSliceWidth(s)
|
||||||
|
|
||||||
if w > win.w-3 {
|
// make space for select marker, and leave another space at the end
|
||||||
s = runeSliceWidthRange(s, 0, win.w-4)
|
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)...)
|
s = append(s, []rune(gOpts.truncatechar)...)
|
||||||
} else {
|
} else {
|
||||||
for i := 0; i < win.w-3-w; i++ {
|
for i := 0; i < maxlength-w; i++ {
|
||||||
s = append(s, ' ')
|
s = append(s, ' ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info := fileInfo(f, dir)
|
info := fileInfo(f, dir)
|
||||||
|
|
||||||
if len(info) > 0 && win.w-lnwidth-iwidth-2 > 2*len(info) {
|
if len(info) > 0 && 2*len(info) < maxlength {
|
||||||
if win.w-2 > w+len(info) {
|
if w+len(info) > maxlength {
|
||||||
s = runeSliceWidthRange(s, 0, win.w-3-len(info)-lnwidth)
|
s = runeSliceWidthRange(s, 0, maxlength-len(info)-1)
|
||||||
} else {
|
|
||||||
s = runeSliceWidthRange(s, 0, win.w-4-len(info)-lnwidth)
|
|
||||||
s = append(s, []rune(gOpts.truncatechar)...)
|
s = append(s, []rune(gOpts.truncatechar)...)
|
||||||
|
} else {
|
||||||
|
s = runeSliceWidthRange(s, 0, maxlength-len(info))
|
||||||
}
|
}
|
||||||
for _, r := range info {
|
for _, r := range info {
|
||||||
s = append(s, r)
|
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]
|
tag, ok := context.tags[path]
|
||||||
if ok {
|
if ok {
|
||||||
if i == dir.pos {
|
if i == dir.pos {
|
||||||
win.print(screen, lnwidth+1, i, st, tag)
|
win.print(screen, lnwidth+1, i, st, fmt.Sprintf(cursorescapefmt, tag))
|
||||||
} else {
|
} 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)
|
wlen := len(gOpts.ratios)
|
||||||
widths := make([]int, wlen)
|
widths := make([]int, wlen)
|
||||||
|
|
||||||
|
if gOpts.drawbox {
|
||||||
|
wtot -= (wlen + 1)
|
||||||
|
}
|
||||||
|
|
||||||
wsum := 0
|
wsum := 0
|
||||||
for i := 0; i < wlen-1; i++ {
|
for i := 0; i < wlen-1; i++ {
|
||||||
widths[i] = gOpts.ratios[i] * wtot / rsum
|
widths[i] = gOpts.ratios[i] * wtot / rsum
|
||||||
@@ -508,10 +534,6 @@ func getWidths(wtot int) []int {
|
|||||||
}
|
}
|
||||||
widths[wlen-1] = wtot - wsum
|
widths[wlen-1] = wtot - wsum
|
||||||
|
|
||||||
if gOpts.drawbox {
|
|
||||||
widths[wlen-1]--
|
|
||||||
}
|
|
||||||
|
|
||||||
return widths
|
return widths
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,7 +548,8 @@ func getWins(screen tcell.Screen) []*win {
|
|||||||
wlen := len(widths)
|
wlen := len(widths)
|
||||||
for i := 0; i < wlen; i++ {
|
for i := 0; i < wlen; i++ {
|
||||||
if gOpts.drawbox {
|
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 {
|
} else {
|
||||||
wins = append(wins, newWin(widths[i], htot-2, wacc, 1))
|
wins = append(wins, newWin(widths[i], htot-2, wacc, 1))
|
||||||
}
|
}
|
||||||
@@ -610,21 +633,9 @@ func (ui *ui) pollEvents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ui *ui) renew() {
|
func (ui *ui) renew() {
|
||||||
|
ui.wins = getWins(ui.screen)
|
||||||
|
|
||||||
wtot, htot := ui.screen.Size()
|
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.promptWin.renew(wtot, 1, 0, 0)
|
||||||
ui.msgWin.renew(wtot, 1, 0, htot-1)
|
ui.msgWin.renew(wtot, 1, 0, htot-1)
|
||||||
ui.menuWin.renew(wtot, 1, 0, htot-2)
|
ui.menuWin.renew(wtot, 1, 0, htot-2)
|
||||||
@@ -652,8 +663,16 @@ func (ui *ui) echomsg(msg string) {
|
|||||||
log.Print(msg)
|
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) {
|
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)
|
log.Printf("error: %s", msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,11 +698,10 @@ func (ui *ui) loadFile(app *app, volatile bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if curr.path == ui.currentFile {
|
if curr.path != ui.currentFile {
|
||||||
return
|
|
||||||
}
|
|
||||||
ui.currentFile = curr.path
|
ui.currentFile = curr.path
|
||||||
onSelect(app)
|
onSelect(app)
|
||||||
|
}
|
||||||
|
|
||||||
if !gOpts.preview {
|
if !gOpts.preview {
|
||||||
return
|
return
|
||||||
@@ -797,7 +815,7 @@ func (ui *ui) drawStatLine(nav *nav) {
|
|||||||
ind := min(dir.ind+1, tot)
|
ind := min(dir.ind+1, tot)
|
||||||
acc := string(ui.keyCount) + string(ui.keyAcc)
|
acc := string(ui.keyCount) + string(ui.keyAcc)
|
||||||
|
|
||||||
var selection string
|
selection := []string{}
|
||||||
|
|
||||||
if len(nav.saves) > 0 {
|
if len(nav.saves) > 0 {
|
||||||
copy := 0
|
copy := 0
|
||||||
@@ -810,40 +828,58 @@ func (ui *ui) drawStatLine(nav *nav) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if copy > 0 {
|
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 {
|
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()
|
currSelections := nav.currSelections()
|
||||||
if len(currSelections) > 0 {
|
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 {
|
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 {
|
if nav.copyTotal > 0 {
|
||||||
percentage := int((100 * float64(nav.copyBytes)) / float64(nav.copyTotal))
|
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 {
|
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 {
|
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() {
|
func (ui *ui) drawBox() {
|
||||||
@@ -852,28 +888,28 @@ func (ui *ui) drawBox() {
|
|||||||
w, h := ui.screen.Size()
|
w, h := ui.screen.Size()
|
||||||
|
|
||||||
for i := 1; i < w-1; i++ {
|
for i := 1; i < w-1; i++ {
|
||||||
ui.screen.SetContent(i, 1, '─', nil, st)
|
ui.screen.SetContent(i, 1, tcell.RuneHLine, nil, st)
|
||||||
ui.screen.SetContent(i, h-2, '─', nil, st)
|
ui.screen.SetContent(i, h-2, tcell.RuneHLine, nil, st)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 2; i < h-2; i++ {
|
for i := 2; i < h-2; i++ {
|
||||||
ui.screen.SetContent(0, i, '│', nil, st)
|
ui.screen.SetContent(0, i, tcell.RuneVLine, nil, st)
|
||||||
ui.screen.SetContent(w-1, i, '│', nil, st)
|
ui.screen.SetContent(w-1, i, tcell.RuneVLine, nil, st)
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.screen.SetContent(0, 1, '┌', nil, st)
|
ui.screen.SetContent(0, 1, tcell.RuneULCorner, nil, st)
|
||||||
ui.screen.SetContent(w-1, 1, '┐', nil, st)
|
ui.screen.SetContent(w-1, 1, tcell.RuneURCorner, nil, st)
|
||||||
ui.screen.SetContent(0, h-2, '└', nil, st)
|
ui.screen.SetContent(0, h-2, tcell.RuneLLCorner, nil, st)
|
||||||
ui.screen.SetContent(w-1, h-2, '┘', nil, st)
|
ui.screen.SetContent(w-1, h-2, tcell.RuneLRCorner, nil, st)
|
||||||
|
|
||||||
wacc := 0
|
wacc := 0
|
||||||
for wind := 0; wind < len(ui.wins)-1; wind++ {
|
for wind := 0; wind < len(ui.wins)-1; wind++ {
|
||||||
wacc += ui.wins[wind].w
|
wacc += ui.wins[wind].w + 1
|
||||||
ui.screen.SetContent(wacc, 1, '┬', nil, st)
|
ui.screen.SetContent(wacc, 1, tcell.RuneTTee, nil, st)
|
||||||
for i := 2; i < h-2; i++ {
|
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
|
st := tcell.StyleDefault
|
||||||
context := dirContext{selections: nav.selections, saves: nav.saves, tags: nav.tags}
|
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()
|
wtot, htot := ui.screen.Size()
|
||||||
for i := 0; i < wtot; i++ {
|
for i := 0; i < wtot; i++ {
|
||||||
for j := 0; j < htot; j++ {
|
for j := 0; j < htot; j++ {
|
||||||
@@ -907,9 +944,14 @@ func (ui *ui) draw(nav *nav) {
|
|||||||
wins--
|
wins--
|
||||||
}
|
}
|
||||||
for i := 0; i < wins; i++ {
|
for i := 0; i < wins; i++ {
|
||||||
|
role := Parent
|
||||||
|
if i == wins-1 {
|
||||||
|
role = Active
|
||||||
|
}
|
||||||
if dir := ui.dirOfWin(nav, i); dir != nil {
|
if dir := ui.dirOfWin(nav, i); dir != nil {
|
||||||
ui.wins[i].printDir(ui.screen, dir, &context,
|
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() {
|
if curr.IsDir() {
|
||||||
preview.printDir(ui.screen, ui.dirPrev, &context,
|
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() {
|
} 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:
|
case tcell.ButtonNone:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if tev.Modifiers() == tcell.ModCtrl {
|
||||||
|
button = "<c-" + button[1:]
|
||||||
|
}
|
||||||
if expr, ok := gOpts.keys[button]; ok {
|
if expr, ok := gOpts.keys[button]; ok {
|
||||||
return expr
|
return expr
|
||||||
}
|
}
|
||||||
|
if button != "<m-1>" && button != "<m-2>" {
|
||||||
if tev.Buttons() != tcell.Button1 && tev.Buttons() != tcell.Button2 {
|
ui.echoerrf("unknown mapping: %s", button)
|
||||||
return nil
|
ui.keyAcc = nil
|
||||||
|
ui.keyCount = nil
|
||||||
|
ui.menuBuf = nil
|
||||||
|
return draw
|
||||||
}
|
}
|
||||||
|
|
||||||
x, y := tev.Position()
|
x, y := tev.Position()
|
||||||
@@ -1331,7 +1380,7 @@ func listMatches(screen tcell.Screen, matches []string, selectedInd int) *bytes.
|
|||||||
wcol = max(wcol, len(m))
|
wcol = max(wcol, len(m))
|
||||||
}
|
}
|
||||||
wcol += gOpts.tabstop - wcol%gOpts.tabstop
|
wcol += gOpts.tabstop - wcol%gOpts.tabstop
|
||||||
ncol := wtot / wcol
|
ncol := max(wtot/wcol, 1)
|
||||||
|
|
||||||
b.WriteString("possible matches\n")
|
b.WriteString("possible matches\n")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user