top | item 39077417 (no title) traviscj | 2 years ago I’ve done this enough times I chain the desired command and the cd together: cd ~/x/y/z && my-command So that when I CTRL-R for my-command it automatically reminds me. discuss order hn newest gumby|2 years ago If you’re doing this for history value put it in a subshell so it doesn’t change your working directory in a confusing way: (cd ~/x/y/z && my-command) chrisshroba|2 years ago Neat idea, definitely going to use this! Thanks for sharing __MatrixMan__|2 years ago cwd is one of the default fields. Here's my first nushell command: $ history | get 0 ╭─────────────────┬─────────────────────────────╮ │ start_timestamp │ 2023-12-15 15:39:12.872 UTC │ │ command │ ls │ │ cwd │ /home/matt/src/configs │ │ duration │ 31 ms │ │ exit_status │ 0 │ ╰─────────────────┴─────────────────────────────╯ It would take some smarts to figure out when to bind the cwd and when not to, but that would be the interesting part.
gumby|2 years ago If you’re doing this for history value put it in a subshell so it doesn’t change your working directory in a confusing way: (cd ~/x/y/z && my-command) chrisshroba|2 years ago Neat idea, definitely going to use this! Thanks for sharing
__MatrixMan__|2 years ago cwd is one of the default fields. Here's my first nushell command: $ history | get 0 ╭─────────────────┬─────────────────────────────╮ │ start_timestamp │ 2023-12-15 15:39:12.872 UTC │ │ command │ ls │ │ cwd │ /home/matt/src/configs │ │ duration │ 31 ms │ │ exit_status │ 0 │ ╰─────────────────┴─────────────────────────────╯ It would take some smarts to figure out when to bind the cwd and when not to, but that would be the interesting part.
gumby|2 years ago
chrisshroba|2 years ago
__MatrixMan__|2 years ago