Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add i to enter and o to exit dir #128

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ Now use `lk` command to start walking.
| Key binding | Description |
|------------------|--------------------|
| `Arrows`, `hjkl` | Move cursor |
| `Enter` | Enter directory |
| `Backspace` | Exit directory |
| `Enter`, `i` | Enter directory |
| `Backspace`, `o` | Exit directory |
| `Space` | Toggle preview |
| `Esc`, `q` | Exit with cd |
| `Ctrl+c` | Exit without cd |
Expand Down
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ var (
keyQuit = key.NewBinding(key.WithKeys("esc"))
keyQuitQ = key.NewBinding(key.WithKeys("q"))
keyOpen = key.NewBinding(key.WithKeys("enter"))
keyOpenI = key.NewBinding(key.WithKeys("i"))
keyBack = key.NewBinding(key.WithKeys("backspace"))
keyBackO = key.NewBinding(key.WithKeys("o"))
keyUp = key.NewBinding(key.WithKeys("up"))
keyDown = key.NewBinding(key.WithKeys("down"))
keyLeft = key.NewBinding(key.WithKeys("left"))
Expand Down Expand Up @@ -220,7 +222,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.performPendingDeletions()
return m, tea.Quit

case key.Matches(msg, keyOpen):
case key.Matches(msg, keyOpen, keyOpenI):
m.searchMode = false
filePath, ok := m.filePath()
if !ok {
Expand All @@ -244,7 +246,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, m.openEditor()
}

case key.Matches(msg, keyBack):
case key.Matches(msg, keyBack, keyBackO):
m.searchMode = false
m.prevName = filepath.Base(m.path)
m.path = filepath.Join(m.path, "..")
Expand Down