Commit 00d7b6ac authored by Baptiste Girard-Carrabin's avatar Baptiste Girard-Carrabin 💬
Browse files

add new plugin

parent 67177f81
......@@ -20,10 +20,10 @@ This is a theme for ZSH which mainly forks the historical theme used on VIA Cent
## Install for Oh-My-ZSH
In order to use this theme, you have to clone this repository in your Oh-My-ZSH `custom/themes` directory (usually `~/.oh-my-zsh/custom/themes`):
In order to use this theme, you have to clone this repository in your Oh-My-ZSH `custom` directory (usually `~/.oh-my-zsh/custom`):
```shell
git clone https://gitlab.viarezo.fr/ViaRezo/oh-my-viarezo.git $ZSH/custom/themes/oh-my-viarezo
git clone https://gitlab.viarezo.fr/ViaRezo/oh-my-viarezo.git $ZSH/custom
```
You then need to select this theme in your `~/.zshrc` :
......@@ -32,6 +32,13 @@ You then need to select this theme in your `~/.zshrc` :
ZSH_THEME="oh-my-viarezo/viarezo"
```
To enable the custom plugin, juste add `watch` to the list of plugins in the `~/.zshrc`:
```shell
plugins=(... watch)
```
The plugin will allow you to add `watch` in front of your last command by using `Ctrl+Esc`.
## Customization
Time format defaults to `%D{%H:%M}`, but can be overwritten by setting the variable `OHMYVIAREZO_TIME_FORMAT` in your `~/.zshrc`.
......
# ------------------------------------------------------------------------------
# Description
# -----------
#
# watch will be inserted before the command
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Connard <baptiste.gc@student-cs.fr>
#
# ------------------------------------------------------------------------------
watch-command-line() {
[[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)"
# if [[ -n $EDITOR && $BUFFER == $EDITOR\ * ]]; then
# if [[ ${#LBUFFER} -le ${#EDITOR} ]]; then
# RBUFFER=" ${BUFFER#$EDITOR }"
# LBUFFER="sudoedit"
# else
# LBUFFER="sudoedit ${LBUFFER#$EDITOR }"
# fi
# elif [[ $BUFFER == sudoedit\ * ]]; then
# if [[ ${#LBUFFER} -le 8 ]]; then
# RBUFFER=" ${BUFFER#sudoedit }"
# LBUFFER="$EDITOR"
# else
# LBUFFER="$EDITOR ${LBUFFER#sudoedit }"
# fi
if [[ $BUFFER == watch\ * ]]; then
if [[ ${#LBUFFER} -le 4 ]]; then
RBUFFER="${BUFFER#watch }"
LBUFFER=""
else
LBUFFER="${LBUFFER#watch }"
fi
else
LBUFFER="watch $LBUFFER"
fi
}
zle -N watch-command-line
# Defined shortcut keys: [Alt] [Esc]
bindkey -M emacs '^\e' watch-command-line
bindkey -M vicmd '^\e' watch-command-line
bindkey -M viins '^\e' watch-command-line
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment