Skip to content

Commit

Permalink
add cmd/lk command as submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
ardnew committed Jan 8, 2024
1 parent 0f5029c commit 1b2c707
Show file tree
Hide file tree
Showing 7 changed files with 282 additions and 186 deletions.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2021 Anton Medvedev
Modified (c) 2023 Andrew Shultzabarger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
126 changes: 6 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,130 +1,16 @@
# πŸ₯Ύ walk
# walk

<p align="center">
<br>
<img src=".github/images/demo.gif" width="600" alt="walk demo">
<br>
</p>
Walk is based on [antonmedv/walk](https://github.com/antonmedv/walk) with modifications to enable reuse as a component in other [BubbleTea](https://github.com/charmbracelet/bubbletea) applications, along with some other bugfixes and enhancements.

**Walk** β€” a terminal navigator.

Why another terminal navigator? I wanted something simple and minimalistic.
Something to help me with faster navigation in the filesystem; a `cd` and `ls`
replacement. So I build **walk**. It allows for quick navigation with fuzzy
searching, `cd` integration is quite simple. And you can open `vim` right from
the walk. That's it.

## Install
To use the `walk` component, install the module using:

```
brew install walk
go get github.com/ardnew/walk/v2
```

```
pkg_add walk
```
The original `walk` command has been refactored into the [cmd/lk] submodule ([README.md](cmd/lk/README.md)) and can be installed using:

```
pacman -S walk
```

go get github.com/ardnew/walk/v2/cmd/lk
```
go install github.com/antonmedv/walk@latest
```

Or download [prebuild binaries](https://github.com/antonmedv/walk/releases).

Put the next function into the **.bashrc** or a similar config:

<table>
<tr>
<th> Bash/Zsh </th>
<th> Fish </th>
<th> PowerShell </th>
</tr>
<tr>
<td>

```bash
function lk {
cd "$(walk "$@")"
}
```

</td>
<td>

```fish
function lk
set loc (walk $argv); and cd $loc;
end
```

</td>
<td>

```powershell
function lk() {
cd $(walk $args)
}
```

</td>
</tr>
</table>


Now use `lk` command to start walking.

## Usage

| Key binding | Description |
|------------------|--------------------|
| `Arrows`, `hjkl` | Move cursor |
| `Enter` | Enter directory |
| `Backspace` | Exit directory |
| `Space` | Toggle preview |
| `Esc`, `q` | Exit with cd |
| `Ctrl+c` | Exit without cd |
| `/` | Fuzzy search |
| `dd` | Delete file or dir |
| `y` | yank current dir |

The `EDITOR` or `WALK_EDITOR` environment variable used for opening files from
the walk.

```bash
export EDITOR=vim
```

### Preview mode

Press `Space` to toggle preview mode.

<img src=".github/images/preview-mode.gif" width="600" alt="Walk Preview Mode">

### Delete file or directory

Press `dd` to delete file or directory. Press `u` to undo.

<img src=".github/images/rm-demo.gif" width="600" alt="Walk Deletes a File">

### Display icons

Install [Nerd Fonts](https://www.nerdfonts.com) and add `--icons` flag.

<img src=".github/images/demo-icons.gif" width="600" alt="Walk Icons Support">

### Image preview

No additional setup is required.

<img src=".github/images/images-mode.gif" width="600" alt="Walk Image Preview">

## Become a sponsor

Every line of code in my repositories πŸ“– signifies my unwavering commitment to open source πŸ’‘. Your support 🀝 ensures these projects keep thriving, innovating, and benefiting all πŸ’Ό. If my work has ever resonated 🎡 or helped you, kindly consider showing love ❀️ by sponsoring. [**πŸš€ Sponsor Me Today! πŸš€**](https://github.com/sponsors/antonmedv)

## License

[MIT](LICENSE)
22 changes: 22 additions & 0 deletions cmd/lk/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2021 Anton Medvedev
Modified (c) 2023 Andrew Shultzabarger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
115 changes: 115 additions & 0 deletions cmd/lk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# πŸ₯Ύ lk

<p align="center">
<br>
<img src=".github/images/demo.gif" width="600" alt="lk demo">
<br>
</p>

**lk** β€” a terminal navigator.

Taken from [antonmedv/walk](https://github.com/antonmedv/walk):

> Why another terminal navigator? I wanted something simple and minimalistic. Something to help me with faster navigation in the filesystem; a `cd` and `ls`replacement. So I build \[`lk`\]. It allows for quick navigation with fuzzy searching, `cd` integration is quite simple. And you can open `vim` right from \[`lk`\]. That's it.
## Install

```
go install github.com/ardnew/walk/v2/cmd/lk@latest
```

Or download [prebuild binaries](https://github.com/ardnew/walk/releases).

Put the next function into the `.bashrc` or a similar config:

<table>
<tr>
<th> Bash/Zsh </th>
<th> Fish </th>
<th> PowerShell </th>
</tr>
<tr>
<td>

```bash
function clk {
cd "$(lk "$@")"
}
```

</td>
<td>

```fish
function clk
set loc (lk $argv); and cd $loc;
end
```

</td>
<td>

```powershell
function clk() {
cd $(lk $args)
}
```

</td>
</tr>
</table>


Now use `clk` command to start walking.

## Usage

| Key binding | Description |
|------------------|--------------------|
| `Arrows`, `hjkl` | Move cursor |
| `Enter` | Enter directory |
| `Backspace` | Exit directory |
| `Space` | Toggle preview |
| `Esc`, `q` | Exit with cd |
| `Ctrl+c` | Exit without cd |
| `/` | Fuzzy search |
| `dd` | Delete file or dir |
| `y` | yank current dir |

The `EDITOR` or `LK_EDITOR` environment variable used for opening files from lk.

```bash
export EDITOR=vim
```

### Preview mode

Press `Space` to toggle preview mode.

<img src=".github/images/preview-mode.gif" width="600" alt="Walk Preview Mode">

### Delete file or directory

Press `dd` to delete file or directory. Press `u` to undo.

<img src=".github/images/rm-demo.gif" width="600" alt="Walk Deletes a File">

### Display icons

Install [Nerd Fonts](https://www.nerdfonts.com) and add `--icons` flag.

<img src=".github/images/demo-icons.gif" width="600" alt="Walk Icons Support">

### Image preview

No additional setup is required.

<img src=".github/images/images-mode.gif" width="600" alt="Walk Image Preview">

## Become a sponsor

Every line of code in my repositories πŸ“– signifies my unwavering commitment to open source πŸ’‘. Your support 🀝 ensures these projects keep thriving, innovating, and benefiting all πŸ’Ό. If my work has ever resonated 🎡 or helped you, kindly consider showing love ❀️ by sponsoring. [**πŸš€ Sponsor Me Today! πŸš€**](https://github.com/sponsors/antonmedv)

## License

[MIT](LICENSE)
2 changes: 1 addition & 1 deletion cmd/lk/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ardnew/walk/cmd/lk
go 1.21.4

require (
github.com/ardnew/walk/v2 v2.0.0
github.com/ardnew/walk/v2 v2.1.0
github.com/charmbracelet/bubbletea v0.25.0
github.com/charmbracelet/lipgloss v0.9.1
github.com/muesli/termenv v0.15.2
Expand Down
Loading

0 comments on commit 1b2c707

Please sign in to comment.