mirror of
https://github.com/cmderdev/cmder.git
synced 2025-07-16 12:39:38 +08:00
Compare commits
1 Commits
master
...
update-ven
Author | SHA1 | Date | |
---|---|---|---|
c1e12c10a9 |
10
vendor/cmder_prompt_config.lua.default
vendored
10
vendor/cmder_prompt_config.lua.default
vendored
@ -48,15 +48,15 @@ prompt_overrideSvnStatusOptIn = false
|
||||
-- Colors: https://github.com/cmderdev/cmder/wiki/Customization#list-of-colors
|
||||
-- Effects: https://github.com/cmderdev/cmder/wiki/Customization#list-of-effects
|
||||
--
|
||||
-- Green: "\x1b[1;32;49m"
|
||||
-- Yellow: "\x1b[1;33;49m"
|
||||
-- Green: "\x1b[1;33;49m"
|
||||
-- Yellow: "\x1b[1;32;49m"
|
||||
-- Light Grey: "\x1b[1;30;49m"
|
||||
|
||||
-- Prompt Element Colors
|
||||
uah_color = "\x1b[1;33;49m" -- Yellow uah = [user]@[hostname]
|
||||
cwd_color = "\x1b[1;32;49m" -- Green cwd = Current Working Directory
|
||||
uah_color = "\x1b[1;33;49m" -- Green = uah = [user]@[hostname]
|
||||
cwd_color = "\x1b[1;32;49m" -- Yellow cwd = Current Working Directory
|
||||
lamb_color = "\x1b[1;30;49m" -- Light Grey = Lambda Color
|
||||
clean_color = "\x1b[37;1m"
|
||||
dirty_color = "\x1b[33;3m" -- Yellow, Italic
|
||||
conflict_color = "\x1b[31;1m" -- Red, Bold
|
||||
unknown_color = "\x1b[37;1m" -- White, Bold = No VCS Status Branch Color
|
||||
unknown_color = "\x1b[37;1m" -- White = No VCS Status Branch Color
|
||||
|
66
vendor/git-prompt.sh
vendored
66
vendor/git-prompt.sh
vendored
@ -1,33 +1,24 @@
|
||||
# Returns 1 if git status for Cmder is disabled, otherwise returns 0
|
||||
function getGitStatusSetting() {
|
||||
local gitConfig
|
||||
gitStatusSetting=$(git --no-pager config -l 2>/dev/null)
|
||||
|
||||
# Get all git config entries for the current repository without pager
|
||||
gitConfig=$(git --no-pager config -l 2>/dev/null) || return 0 # treat failure as enabled
|
||||
|
||||
# Check if git status for Cmder is disabled
|
||||
if [[ $gitConfig =~ (^|$'\n')cmder\.status=false($|$'\n') ]] || \
|
||||
[[ $gitConfig =~ (^|$'\n')cmder\.shstatus=false($|$'\n') ]]
|
||||
if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} =~ cmder.status=false ]] || [[ ${gitStatusSetting} =~ cmder.shstatus=false ]]
|
||||
then
|
||||
return 1 # disabled
|
||||
echo false
|
||||
else
|
||||
echo true
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Prints current branch or detached HEAD short commit hash
|
||||
function getSimpleGitBranch() {
|
||||
local gitDir
|
||||
gitDir=$(git rev-parse --git-dir 2>/dev/null) || return 0
|
||||
gitDir=$(git rev-parse --git-dir 2>/dev/null)
|
||||
if [ -z "$gitDir" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local headFile="$gitDir/HEAD"
|
||||
[ -f "$headFile" ] || return 0
|
||||
|
||||
local headContent
|
||||
headContent=$(< "$headFile")
|
||||
if [[ "$headContent" =~ ^ref:\ refs/heads/(.+)$ ]]
|
||||
headContent=$(< "$gitDir/HEAD")
|
||||
if [[ "$headContent" == "ref: refs/heads/"* ]]
|
||||
then
|
||||
echo " (${BASH_REMATCH[1]})"
|
||||
echo " (${headContent:16})"
|
||||
else
|
||||
echo " (HEAD detached at ${headContent:0:7})"
|
||||
fi
|
||||
@ -42,18 +33,18 @@ fi
|
||||
|
||||
if test -f ~/.config/git/git-prompt.sh
|
||||
then
|
||||
if getGitStatusSetting
|
||||
if [[ $(getGitStatusSetting) == true ]]
|
||||
then
|
||||
. ~/.config/git/git-prompt.sh
|
||||
fi
|
||||
else
|
||||
# Taken parts from https://github.com/git-for-windows/build-extra/blob/main/git-extra/git-prompt.sh
|
||||
PS1='\[\033]0;${TITLEPREFIX:+$TITLEPREFIX:}${PWD//[^[:ascii:]]/?}\007\]' # set window title to TITLEPREFIX (if set) and current working directory
|
||||
# PS1="$PS1"'\n' # new line (disabled)
|
||||
PS1="$PS1"'\[\033[32m\]' # change to green and bold
|
||||
PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title
|
||||
# PS1="$PS1"'\n' # new line
|
||||
PS1="$PS1"'\[\033[32m\]' # change to green
|
||||
PS1="$PS1"'\u@\h ' # user@host<space>
|
||||
PS1="$PS1${MSYSTEM:+\[\033[35m\]$MSYSTEM }" # show MSYSTEM in purple (if set)
|
||||
PS1="$PS1"'\[\033[1;33m\]' # change to dark yellow in bold
|
||||
# PS1="$PS1"'\[\033[35m\]' # change to purple
|
||||
# PS1="$PS1"'$MSYSTEM ' # show MSYSTEM
|
||||
PS1="$PS1"'\[\033[33m\]' # change to brownish yellow
|
||||
PS1="$PS1"'\w' # current working directory
|
||||
if test -z "$WINELOADERNOEXEC"
|
||||
then
|
||||
@ -64,7 +55,7 @@ else
|
||||
if test -f "$COMPLETION_PATH/git-prompt.sh"
|
||||
then
|
||||
. "$COMPLETION_PATH/git-completion.bash"
|
||||
if getGitStatusSetting
|
||||
if [[ $(getGitStatusSetting) == true ]]
|
||||
then
|
||||
. "$COMPLETION_PATH/git-prompt.sh"
|
||||
PS1="$PS1"'\[\033[36m\]' # change color to cyan
|
||||
@ -75,22 +66,9 @@ else
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
PS1="$PS1"'\[\033[0m\]' # reset color
|
||||
PS1="$PS1"'\[\033[0m\]' # change color
|
||||
PS1="$PS1"'\n' # new line
|
||||
PS1="$PS1"'\[\033[30;1m\]' # change color to grey in bold
|
||||
PS1="$PS1"'λ ' # prompt: Cmder uses λ
|
||||
PS1="$PS1"'\[\033[0m\]' # reset color
|
||||
PS1="$PS1"'λ ' # prompt: always λ
|
||||
fi
|
||||
|
||||
MSYS2_PS1="$PS1" # for detection by MSYS2 SDK's bash.basrc
|
||||
|
||||
# Evaluate all user-specific Bash completion scripts (if any)
|
||||
if test -z "$WINELOADERNOEXEC"
|
||||
then
|
||||
for c in "$HOME"/bash_completion.d/*.bash
|
||||
do
|
||||
# Handle absence of any scripts (or the folder) gracefully
|
||||
test ! -f "$c" ||
|
||||
. "$c"
|
||||
done
|
||||
fi
|
||||
|
12
vendor/sources.json
vendored
12
vendor/sources.json
vendored
@ -1,13 +1,13 @@
|
||||
[
|
||||
{
|
||||
"name": "git-for-windows",
|
||||
"version": "2.49.0.windows.1",
|
||||
"url": "https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/PortableGit-2.49.0-64-bit.7z.exe"
|
||||
"version": "2.50.1.windows.1",
|
||||
"url": "https://github.com/git-for-windows/git/releases/download/v2.50.1.windows.1/PortableGit-2.50.1-64-bit.7z.exe"
|
||||
},
|
||||
{
|
||||
"name": "clink",
|
||||
"version": "1.7.14",
|
||||
"url": "https://github.com/chrisant996/clink/releases/download/v1.7.14/clink.1.7.14.843933.zip"
|
||||
"version": "1.7.21",
|
||||
"url": "https://github.com/chrisant996/clink/releases/download/v1.7.21/clink.1.7.21.9f5af8.zip"
|
||||
},
|
||||
{
|
||||
"name": "conemu-maximus5",
|
||||
@ -16,7 +16,7 @@
|
||||
},
|
||||
{
|
||||
"name": "clink-completions",
|
||||
"version": "0.6.2",
|
||||
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.6.2.zip"
|
||||
"version": "0.6.3",
|
||||
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.6.3.zip"
|
||||
}
|
||||
]
|
||||
|
Reference in New Issue
Block a user