File: lfcd.nu

package info (click to toggle)
lf 34%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,296 kB
  • sloc: sh: 126; makefile: 23; csh: 4
file content (25 lines) | stat: -rw-r--r-- 672 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Change working dir in shell to last dir in lf on exit (adapted from ranger).
#
# You need to add this to your Nushell Enviroment Config File
# (Execute 'config env' in the nushell to open it).

# You may also like to assign a key (Ctrl-O) to this command:
# See the documentation: https://www.nushell.sh/book/line_editor.html#keybindings
#
# keybindings: [
#   {
#     name: lfcd
#     modifier: control
#     keycode: char_o
#     mode: [emacs, vi_normal, vi_insert]
#     event: {
#       send: executehostcommand
#       cmd: "lfcd"
#     }
#   }
# ]

# For nushell version >= 0.87.0
def --env --wrapped lfcd [...args: string] { 
  cd (lf -print-last-dir ...$args)
}