-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[Feature Request] nushell
integration
#4122
Labels
Comments
If you save this in the file and do # Dependencies: `fd`, `bat, `rg`, `nufmt`, `tree`.
export-env {
$env.FZF_ALT_C_COMMAND = "fd --type directory --hidden"
$env.FZF_ALT_C_OPTS = "--preview 'tree -C {} | head -n 200'"
$env.FZF_CTRL_T_COMMAND = "fd --type file --hidden"
$env.FZF_CTRL_T_OPTS = "--preview 'bat --color=always --style=full --line-range=:500 {}' "
$env.FZF_DEFAULT_COMMAND = "fd --type file --hidden"
}
# Directories
const alt_c = {
name: fzf_dirs
modifier: alt
keycode: char_c
mode: [emacs, vi_normal, vi_insert]
event: [
{
send: executehostcommand
cmd: "
let fzf_alt_c_command = \$\"($env.FZF_ALT_C_COMMAND) | fzf ($env.FZF_ALT_C_OPTS)\";
let result = nu -c $fzf_alt_c_command;
cd $result;
"
}
]
}
# History
const ctrl_r = {
name: history_menu
modifier: control
keycode: char_r
mode: [emacs, vi_insert, vi_normal]
event: [
{
send: executehostcommand
cmd: "
let result = history
| get command
| str replace --all (char newline) ' '
| to text
| fzf --preview 'printf \'{}\' | nufmt --stdin 2>&1 | rg -v ERROR';
commandline edit --append $result;
commandline set-cursor --end
"
}
]
}
# Files
const ctrl_t = {
name: fzf_files
modifier: control
keycode: char_t
mode: [emacs, vi_normal, vi_insert]
event: [
{
send: executehostcommand
cmd: "
let fzf_ctrl_t_command = \$\"($env.FZF_CTRL_T_COMMAND) | fzf ($env.FZF_CTRL_T_OPTS)\";
let result = nu -l -i -c $fzf_ctrl_t_command;
commandline edit --append $result;
commandline set-cursor --end
"
}
]
}
# Update the $env.config
export-env {
if not ($env.__keybindings_loaded? | default false) {
$env.__keybindings_loaded = true
$env.config.keybindings = $env.config.keybindings | append [
$alt_c
$ctrl_r
$ctrl_t
]
}
} |
I guess, if cleaned up, then it could serve as PR. Things to consider: remove everything that does not come with the clean
And delegating as much as possible to the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
man fzf
)Output of
fzf --version
0.56.3 (v0.56.3)
OS
Shell
Feature Request
Hi, I am currently switching to
nushell
as my main shell. I noticed thatfzf
does not have a nushell integration.I would like to propose to add a
nushell
integration, like it is done forzsh
,bash
andfish
.I really miss the CTRL+t keybind in nushell, as that was my goto way of selecting files in my terminal.
The text was updated successfully, but these errors were encountered: