diff options
author | vulonkaaz <7442677+vulonkaaz@users.noreply.github.com> | 2024-08-17 16:19:36 +0200 |
---|---|---|
committer | vulonkaaz <7442677+vulonkaaz@users.noreply.github.com> | 2024-08-17 16:19:36 +0200 |
commit | be43356a2e0b497bb6f11c32eac0288fa026d51d (patch) | |
tree | b59af1b39465e8a1dfc61fdb0ba3b0346417a95c | |
parent | 416e6594a9f8b3c94afe956aea358540d1ad2595 (diff) |
zshrc
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | zshrc_example | 42 |
2 files changed, 53 insertions, 0 deletions
@@ -11,6 +11,17 @@ It is recommanded that you read and understand the scripts before running them ## Explanation of each script +### zshrc_example + +not a script but an example .zshrc that I consider sane defaults + +zsh has the reputation to be very powerful but a pain to configure, with this you +can just use it as a drop in replacement for bash and it should work right and feel +right right away, main differences are like vi-like keybindings and autocompletion +is a bit different than bash (way better) + +you may wanna customize the PS1 variable and add your own aliases + ### addtorrent.sh a command line script to add a torrent to a remote Transmission server over HTTP diff --git a/zshrc_example b/zshrc_example new file mode 100644 index 0000000..319166d --- /dev/null +++ b/zshrc_example @@ -0,0 +1,42 @@ +# Lines configured by zsh-newuser-install +HISTFILE=~/.histfile +HISTSIZE=1000 +SAVEHIST=1000 +setopt autocd beep extendedglob nomatch +bindkey -v +# End of lines configured by zsh-newuser-install +autoload -Uz compinit promptinit +compinit +promptinit +PS1='%B%F{magenta}[%n@%m %1~]%f%F{blue}%(#.#.$)%f %b' +zstyle ':completion:*' menu select + +# page home and page end +bindkey "^[[H" beginning-of-line +bindkey "^[[F" end-of-line + +export EDITOR=nvim +# aliases +alias v="nvim" + +# Change cursor shape for different vi modes. +function zle-keymap-select { + if [[ ${KEYMAP} == vicmd ]] || + [[ $1 = 'block' ]]; then + echo -ne '\e[1 q' + elif [[ ${KEYMAP} == main ]] || + [[ ${KEYMAP} == viins ]] || + [[ ${KEYMAP} = '' ]] || + [[ $1 = 'beam' ]]; then + echo -ne '\e[5 q' + fi +} +zle -N zle-keymap-select +zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" +} +zle -N zle-line-init +echo -ne '\e[5 q' # Use beam shape cursor on startup. +preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + |