mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
docs(i18n): new Crowdin updates (#4124)
This commit is contained in:
@@ -8,6 +8,52 @@ As configurações nesta seção estão sujeitas a alterações em futuras vers
|
||||
|
||||
:::
|
||||
|
||||
## TransientPrompt in PowerShell
|
||||
|
||||
It is possible to replace the previous-printed prompt with a custom string. This is useful in cases where all the prompt information is not always needed. To enable this, run `Enable-TransientPrompt` in the shell session. To make it permanent, put this statement in your `$PROFILE`. Transience can be disabled on-the-fly with `Disable-TransientPrompt`.
|
||||
|
||||
By default, the left side of input gets replaced with `>`. To customize this, define a new function called `Invoke-Starship-TransientFunction`. For example, to display Starship's `character` module here, you would do
|
||||
|
||||
```powershell
|
||||
function Invoke-Starship-TransientFunction {
|
||||
&starship module character
|
||||
}
|
||||
|
||||
Invoke-Expression (&starship init powershell)
|
||||
|
||||
Enable-TransientPrompt
|
||||
```
|
||||
|
||||
## TransientPrompt and TransientRightPrompt in Cmd
|
||||
|
||||
Clink allows you to replace the previous-printed prompt with custom strings. This is useful in cases where all the prompt information is not always needed. To enable this, run `clink set prompt.transient <value>` where \<value\> can be one of:
|
||||
|
||||
- `always`: always replace the previous prompt
|
||||
- `same_dir`: replace the previous prompt only if the working directory is same
|
||||
- `off`: do not replace the prompt (i.e. turn off transience)
|
||||
|
||||
You need to do this only once. Make the following changes to your `starship.lua` to customize what gets displayed on the left and on the right:
|
||||
|
||||
- By default, the left side of input gets replaced with `>`. To customize this, define a new function called `starship_transient_prompt_func`. This function receives the current prompt as a string that you can utilize. For example, to display Starship's `character` module here, you would do
|
||||
|
||||
```lua
|
||||
function starship_transient_prompt_func(prompt)
|
||||
return io.popen("starship module character"
|
||||
.." --keymap="..rl.getvariable('keymap')
|
||||
):read("*a")
|
||||
end
|
||||
load(io.popen('starship init cmd'):read("*a"))()
|
||||
```
|
||||
|
||||
- By default, the right side of input is empty. To customize this, define a new function called `starship_transient_rprompt_func`. This function receives the current prompt as a string that you can utilize. For example, to display the time at which the last command was started here, you would do
|
||||
|
||||
```lua
|
||||
function starship_transient_rprompt_func(prompt)
|
||||
return io.popen("starship module time"):read("*a")
|
||||
end
|
||||
load(io.popen('starship init cmd'):read("*a"))()
|
||||
```
|
||||
|
||||
## Comandos personalizados de pré-prompt e pré-execução no Cmd
|
||||
|
||||
O Clink fornece APIs extremamente flexíveis para executar comandos pré-prompt e pré-execução em Cmd shell. É bastante simples de usar com o Starship. Faça as seguintes alterações no seu arquivo `starship.lua` conforme suas necessidades:
|
||||
@@ -45,7 +91,7 @@ function blastoff(){
|
||||
starship_precmd_user_func="blastoff"
|
||||
```
|
||||
|
||||
- Para rodar uma função personalizada antes que um comando seja executado, você pode usar [`DEBUG` como mecanismo de armadilha](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). No entanto, você **deve** prender o sinal de DEBUG _antes_ de inicializar o Starship! O Starship consegue preservar o valor da armadilha DEBUG, mas se a armadilha for substituída depois do starship iniciar, algumas funções iram quebrar.
|
||||
- Para rodar uma função personalizada antes que um comando seja executado, você pode usar [`DEBUG` como mecanismo de armadilha](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). No entanto, você **deve** capturar o sinal DEBUG _antes_ de inicializar o Starship! O Starship consegue preservar o valor da armadilha DEBUG, mas se a armadilha for substituída depois do starship iniciar, algumas funções iram quebrar.
|
||||
|
||||
```bash
|
||||
function blastoff(){
|
||||
@@ -153,15 +199,15 @@ Gera um prompt parecido com o seguinte:
|
||||
▶ starship on rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
|
||||
```
|
||||
|
||||
## Prompt de Continução
|
||||
## Prompt de Continuação
|
||||
|
||||
Algumas shells suportam prompt de continuação juntamento com o prompt normal. Este prompt é renderizado em vez do prompt normal quando o usuário insere um comando incompleto (Como um parentese ou aspas a esquerda).
|
||||
Alguns shells suportam um prompt de continuação junto com o prompt normal. Esse prompt é renderizado em vez do prompt normal quando o usuário insere uma instrução incompleta (como um único parêntese esquerdo ou aspas).
|
||||
|
||||
O Starship consegue definir o prompt de continuação usando a opção `continuation_prompt`. O prompt padrão é `"[∙](bright-black) "`.
|
||||
Starship pode definir o prompt de continuação usando a opção `continuation_prompt`. O prompt padrão é `"[∙](bright-black) "`.
|
||||
|
||||
Nota: `continuation_prompt` deve ser definido como uma string literal sem variáveis.
|
||||
Nota: `continuation_prompt` deve ser definido como uma string literal sem nenhuma variável.
|
||||
|
||||
Nota: Prompt de continuação são disponíveis apenas nos shells a seguir:
|
||||
Nota: os prompts de continuação estão disponíveis apenas nos seguintes shells:
|
||||
|
||||
- `bash`
|
||||
- `zsh`
|
||||
@@ -170,9 +216,9 @@ Nota: Prompt de continuação são disponíveis apenas nos shells a seguir:
|
||||
### Exemplo
|
||||
|
||||
```toml
|
||||
#~/.config/starship.toml
|
||||
# ~/.config/starship.toml
|
||||
|
||||
# Um prompt de continuação que mostra duas setas
|
||||
# Um prompt de continuação que exibe duas setas preenchidas
|
||||
continuation_prompt = "▶▶"
|
||||
```
|
||||
|
||||
@@ -185,6 +231,9 @@ Estilo de strings são uma lista de palavras, separadas por espaço. As palavras
|
||||
- `underline`
|
||||
- `dimmed`
|
||||
- `inverted`
|
||||
- `blink`
|
||||
- `hidden`
|
||||
- `strikethrough`
|
||||
- `bg:<color>`
|
||||
- `fg:<color>`
|
||||
- `<color>`
|
||||
@@ -201,3 +250,9 @@ Um especialista em cores pode ser um dos seguintes:
|
||||
- Um número entre 0-255. Este especifica um [Código de Cor ANSI 8 bits](https://i.stack.imgur.com/KTSQa.png).
|
||||
|
||||
Se múltiplas cores forem especificadas para foreground/background, a ultima da string que terá prioridade.
|
||||
|
||||
Not every style string will be displayed correctly by every terminal. In particular, the following known quirks exist:
|
||||
|
||||
- Many terminals disable support for `blink` by default
|
||||
- `hidden` is not supported on iTerm (https://gitlab.com/gnachman/iterm2/-/issues/4564).
|
||||
- `strikethrough` is not supported by the default macOS Terminal.app
|
||||
|
||||
Reference in New Issue
Block a user