1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-09 23:00:55 +00:00
starship/docs/pt-BR/advanced-config/README.md

94 lines
4.0 KiB
Markdown
Raw Normal View History

# Configuração avançada
Ainda que Starship seja um shell versátil, às vezes você precisará fazer algumas outras coisas além de editar o arquivo `starship.toml`. Esta página detalha algumas das configurações mais avançadas usadas em starship.
::: warning
As configurações nesta seção estão sujeitas a alterações em futuras versões do Starship.
:::
## Comandos personalizados de pre-prompt e pre-execution no Bash
O Bash não possui uma estrutura formal para os hooks preexec/precmd como a maioria dos outros shells. Por esse motivo, é difícil fornecer hooks totalmente customizáveis no `bash`. No entanto, Starship te oferece uma capacidade limitada de inserir suas próprias funções na processo de prompt-rendering:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
```bash
function blastoff(){
echo "🚀"
}
starship_precmd_user_func="blastoff"
```
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Trap DEBUG *before* running starship
eval $(starship init bash)
```
## Altera o título da janela
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish faz isso por padrão. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
First, define a window title change function (identical in bash and zsh):
```bash
function set_win_title(){
echo -ne "\033]0; YOUR_WINDOW_TITLE_HERE \007"
}
```
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
In `bash`, set this function to be the precmd starship function:
```bash
starship_precmd_user_func="set_win_title"
```
In `zsh`, add this to the `precmd_functions` array:
```bash
precmd_functions+=(set_win_title)
```
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zshrc`) to make it permanent.
For example, if you want to display your current directory in your terminal tab title, add the following snippet to your `~/.bashrc` or `~/.zshrc`:
```bash
function set_win_title(){
echo -ne "\033]0; $(basename $PWD) \007"
}
starship_precmd_user_func="set_win_title"
```
## Estilo dos textos
docs(i18n): new Crowdin translations (#1262) * New translations README.md (Portuguese, Brazilian) * New translations README.md (German) * New translations README.md (French) * New translations README.md (Japanese) * New translations README.md (Spanish) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Russian) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Traditional) * New translations README.md (Portuguese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (German) * New translations README.md (Russian) * New translations README.md (Japanese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Traditional) * New translations README.md (Portuguese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (German) * New translations README.md (Russian) * New translations README.md (Japanese) * New translations README.md (French) * New translations README.md (Japanese) * New translations README.md (German) * New translations README.md (Spanish) * New translations README.md (Chinese Traditional) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese) * New translations README.md (Chinese Simplified) * New translations README.md (Russian) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Traditional) * New translations README.md (Portuguese) * New translations README.md (Portuguese) * New translations README.md (Chinese Simplified) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (German) * New translations README.md (German) * New translations README.md (Chinese Simplified) * New translations README.md (Japanese) * New translations README.md (Japanese) * New translations README.md (Russian) * New translations README.md (Russian) * New translations README.md (Japanese) * New translations README.md (Japanese) * New translations README.md (Japanese) * New translations README.md (Japanese)
2020-06-11 01:28:04 +00:00
Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Cada palavra pode ser uma das seguintes:
- `bold`
- `underline`
- `dimmed`
- `bg:<color>`
- `fg:<color>`
- `<color>`
- `none`
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing , though this may change in the future. The order of words in the string does not matter.
The `none` token overrides all other tokens in a string, so that e.g. `fg:red none fg:blue` will still create a string with no styling. It may become an error to use `none` in conjunction with other tokens in the future.
A color specifier can be one of the following:
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
docs(i18n): new Crowdin translations (#1262) * New translations README.md (Portuguese, Brazilian) * New translations README.md (German) * New translations README.md (French) * New translations README.md (Japanese) * New translations README.md (Spanish) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Russian) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Traditional) * New translations README.md (Portuguese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (German) * New translations README.md (Russian) * New translations README.md (Japanese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Traditional) * New translations README.md (Portuguese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (German) * New translations README.md (Russian) * New translations README.md (Japanese) * New translations README.md (French) * New translations README.md (Japanese) * New translations README.md (German) * New translations README.md (Spanish) * New translations README.md (Chinese Traditional) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Portuguese) * New translations README.md (Chinese Simplified) * New translations README.md (Russian) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Traditional) * New translations README.md (Portuguese) * New translations README.md (Portuguese) * New translations README.md (Chinese Simplified) * New translations README.md (Portuguese, Brazilian) * New translations README.md (French) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (German) * New translations README.md (German) * New translations README.md (Chinese Simplified) * New translations README.md (Japanese) * New translations README.md (Japanese) * New translations README.md (Russian) * New translations README.md (Russian) * New translations README.md (Japanese) * New translations README.md (Japanese) * New translations README.md (Japanese) * New translations README.md (Japanese)
2020-06-11 01:28:04 +00:00
- Um número entre 0-255. Este especifica um [Código de Cor ANSI 8 bits](https://i.stack.imgur.com/KTSQa.png).
If multiple colors are specified for foreground/background, the last one in the string will take priority.