commit 1afacb947f836937201146c6e007211ad4d31e9d
parent a3722e5b1a5717c918685f6f4cdc2f2081a3551d
Author: oscarbenedito <oscar@oscarbenedito.com>
Date:   Wed, 25 Mar 2020 18:15:23 +0100

Installation script and some funcitonalities added

Diffstat:
Mdot_config/aliases.tmpl | 7++++---
Mdot_zshenv | 9+++++----
Mdot_zshrc.tmpl | 30++++++++++++++++++++++++++++--
Arun_once_installation.sh.tmpl | 11+++++++++++
4 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/dot_config/aliases.tmpl b/dot_config/aliases.tmpl @@ -13,7 +13,8 @@ alias mv="mv --interactive" alias mkdir="mkdir --parents" # Shortcuts -alias v="vim" +alias v="nvim" +alias vim="nvim" {{- if ne .chezmoi.hostname "fme-desktop" }} @@ -42,10 +43,10 @@ alias gsh="git stash" {{ if ne .chezmoi.hostname "fme-desktop" -}} {{- if eq .chezmoi.osRelease.id "debian" -}} -alias upgrade="sudo apt-get update && sudo apt-get upgrade" +alias upgrade="sudo apt-get update && sudo apt-get -y upgrade" alias ag="sudo apt-get" {{- else -}} -alias upgrade="sudo pacman -Syyu" +alias upgrade="sudo pacman -Syyu --noconfirm" alias p="sudo pacman" {{- end }} {{- end }} diff --git a/dot_zshenv b/dot_zshenv @@ -6,17 +6,18 @@ export XDG_DATA_HOME="$HOME/.local/share" export XDG_CONFIG_HOME="$HOME/.config" export XDG_CACHE_HOME="$HOME/.cache" -# Programs default folders +# XDG paths export GNUPGHOME="$XDG_DATA_HOME/gnupg" export R_LIBS_USER="$XDG_DATA_HOME/R" export ATOM_HOME="$XDG_DATA_HOME/atom" export GOPATH="$XDG_DATA_HOME/go" export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter" +export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc export ICEAUTHORITY="$XDG_CACHE_HOME/ICEauthority" +export RXVT_SOCKET="$XDG_RUNTIME_DIR/urxvtd" export LESSHISTFILE="-" # Environment variables -export VISUAL="vim" -export EDITOR="vim" - +export VISUAL="nvim" +export EDITOR="nvim" diff --git a/dot_zshrc.tmpl b/dot_zshrc.tmpl @@ -20,12 +20,38 @@ compinit -d ~/.cache/zsh/zcompdump # Auto complete case insensitive zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' -# Set up vim style keys +# Set up vi style keys bindkey -v export KEYTIMEOUT=1 bindkey "^?" backward-delete-char -# Also set vim keys to navigate the menus when double pressing tab +# 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 + +# Use beam shape cursor on startup. +echo -ne '\e[5 q' +# Use beam shape cursor for each new prompt. +preexec() { echo -ne '\e[5 q' ;} + +# Also set vi keys to navigate the menus when double pressing tab bindkey -M menuselect 'h' vi-backward-char bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char diff --git a/run_once_installation.sh.tmpl b/run_once_installation.sh.tmpl @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +{{ if eq .chezmoi.osRelease.id "debian" }} +sudo apt-get install zsh zsh-syntax-highlighting neovim python3-pip curl wget +{{ else }} +sudo pacman -S zsh zsh-syntax-highlighting neovim curl wget +{{ end }} +[ -z "$XDG_CACHE_HOME" ] && XDG_CACHE_HOME="$HOME/.cache" +mkdir -p $XDG_CACHE_HOME/zsh + +chsh -s /bin/zsh