| 1 |
# Change working dir in shell to last dir in lf on exit (adapted from ranger). |
| 2 |
# |
| 3 |
# You need to add this to your Nushell Environment Config File |
| 4 |
# (Execute 'config env' in the nushell to open it). |
| 5 |
|
| 6 |
# You may also like to assign a key (Ctrl-O) to this command: |
| 7 |
# See the documentation: https://www.nushell.sh/book/line_editor.html#keybindings |
| 8 |
# |
| 9 |
# keybindings: [ |
| 10 |
# { |
| 11 |
# name: lfcd |
| 12 |
# modifier: control |
| 13 |
# keycode: char_o |
| 14 |
# mode: [emacs, vi_normal, vi_insert] |
| 15 |
# event: { |
| 16 |
# send: executehostcommand |
| 17 |
# cmd: "lfcd" |
| 18 |
# } |
| 19 |
# } |
| 20 |
# ] |
| 21 |
|
| 22 |
# For nushell version >= 0.87.0 |
| 23 |
def --env --wrapped lfcd [...args: string] { |
| 24 |
cd (lf -print-last-dir ...$args) |
| 25 |
} |