# Personalizar terminal

## Instalación zsh

Instalamos el SHELL zsh

```bash
sudo apt install zsh
```

Podemos verificar la instalación con el comando

```bash
zsh --version
```

## Instalación de Oh My Zsh

```bash
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
```

{% hint style="info" %}

#### Recomendado instalar tipografía MesloLGS NF&#x20;

* [MesloLGS NF Regular.ttf](https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf)
* [MesloLGS NF Bold.ttf](https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf)
* [MesloLGS NF Italic.ttf](https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf)
* [MesloLGS NF Bold Italic.ttf](https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf)
  {% endhint %}

## Instalación de PowerLevel10k

Instalamos PowerLevel10k (necesitamos tener la herramienta `git` previamente instalada)

```bash
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
```

Modificamos el archivo `~/.zshrc`

```bash
nano ~/.zshrc
```

```bash
# liena a modificar "ZSH_THEME"
ZSH_THEME="powerlevel10k/powerlevel10k"
```

Recargar el archivo modificado

```bash
source ~/.zshrc
```

Se abrirá el proceso de instalación de PoerLevel10k. Configurar al gusto ;)

### Activar autocompletar en zsh

Para que salga la opción de autocompletar y que nos resalte los comandos cuando escribimos en el shell, falta añadir 2 lineas al archivo de configuración.

```bash
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
```

```bash
echo "source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
```

### Poner nombre user\@host actual visible

Por lo menos a mi, me gusta ver en que usuario nos encontramos y depende de como configuremos p10k, no se nos mostrará... Por ello aquí muestro como ponerlo.

Debemos modificar el siguiente archivo:

```bash
nano ~/.p10k.zsh
```

Comentamos la siguiente línea: (en nano se puede buscar con "ctrl+f")

```bash
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
```

Buscamos el parametro que nos muestra el user\@host y lo pondremos en la posición que queramos. Buscaremos esta línea y la cortamos.(en nano se corta con "ctrl+k" y se pega con "ctrl+u")

```
context                 # user@hostname
```

La pegamos en el lado derecho o izquierdo y nos quedará algo parecido a esto:

```bash
  # The list of segments shown on the left. Fill it with the most important segments.
  typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
    # =========================[ Line #1 ]=========================
    os_icon                 # os identifier
    context                 # user@hostname
    dir                     # current directory
    vcs                     # git status
    # =========================[ Line #2 ]=========================
    newline                 # \n
    prompt_char             # prompt symbol
  )

```

Aplicamos los cambios

```bash
source ~/.p10k.zsh
```

{% hint style="danger" %}
Para el terminal de SUDO hay que repetir de nuevo todo el proceso, ya que la personalización la hacemos al shell de un usuario
{% endhint %}

***

## :information\_source: Tips

{% hint style="info" %}

#### Verificación de shells

```bash
echo $SHELL # ver el shell que se usa actualmente
```

```bash
chsh -s /bin/bash usuario # cambiar de shell
```

```bash
cat /etc/shells # ver shells disponibles
```

{% endhint %}

{% hint style="info" %}

#### Para configurar de nuevo las opciones iniciales de PowerLevel10k

```bash
p10k configure
```

#### Para actualizar a la ultima versión de PowerLevel10k

```bash
git -C $ZSH_CUSTOM/themes/powerlevel10k pull
```

#### Para modificar las opciones de PowerLevel10k

```bash
nano ~/.p10k.zsh
source ~/.p10k.zsh  # aplicamos cambios
```

{% endhint %}

{% hint style="info" %}

#### Para modificar las opciones de PowerLevel10k

```bash
nano ~/.p10k.zsh
source ~/.p10k.zsh  # aplicamos cambios
```

{% endhint %}

* Link del proyecto powerlevel10k\
  <https://github.com/romkatv/powerlevel10k>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bibliotek.gitbook.io/miwiki/configuraciones/configuraciones-linux/personalizar-terminal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
