From feb6e9c90bd6edd2b48655328f1d7a25b9b578b4 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sat, 12 May 2018 13:53:45 +0200 Subject: [PATCH] Make DEFAULT_PROMPT and DEFAULT_TITLE work without functions The prompt is a fallback that is overridden via a function file anyway. Do that with the title as well, so we can use just builtins. This removes error messages when $fish_function_path is borked. --- share/functions/fish_title.fish | 3 +++ src/reader.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 share/functions/fish_title.fish diff --git a/share/functions/fish_title.fish b/share/functions/fish_title.fish new file mode 100644 index 000000000..5eacb73e9 --- /dev/null +++ b/share/functions/fish_title.fish @@ -0,0 +1,3 @@ +function fish_title + echo (status current-command) " " (__fish_pwd) +end diff --git a/src/reader.cpp b/src/reader.cpp index 29cfe81c8..45aad82b6 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -84,7 +84,7 @@ /// A simple prompt for reading shell commands that does not rely on fish specific commands, meaning /// it will work even if fish is not installed. This is used by read_i. -#define DEFAULT_PROMPT L"echo -n \"$USER@\"(hostname|cut -d . -f 1)' '(__fish_pwd)'> '" +#define DEFAULT_PROMPT L"echo -n \"$USER@$hostname $PWD \"'> '" /// The name of the function that prints the fish prompt. #define LEFT_PROMPT_FUNCTION_NAME L"fish_prompt" @@ -99,7 +99,7 @@ #define MODE_PROMPT_FUNCTION_NAME L"fish_mode_prompt" /// The default title for the reader. This is used by reader_readline. -#define DEFAULT_TITLE L"echo (status current-command) \" \"; __fish_pwd" +#define DEFAULT_TITLE L"echo (status current-command) \" \" $PWD" /// The maximum number of characters to read from the keyboard without repainting. Note that this /// readahead will only occur if new characters are available for reading, fish will never block for