diff --git a/install.sh b/install.sh index d93fb99..44dd56e 100755 --- a/install.sh +++ b/install.sh @@ -1,90 +1,93 @@ #!/bin/bash override=false verbose=false if [[ "${1}" = '-f' || "${2}" = '-f' ]]; then override=true fi if [[ "${1}" = '-v' || "${2}" = '-v' ]]; then verbose=true fi [[ -z "${XDG_CONFIG_HOME}" ]] && CONFIG_HOME="${HOME}/.config" || CONFIG_HOME="${XDG_CONFIG_HOME}" [[ -z "${XDG_DATA_HOME}" ]] && DATA_HOME="${HOME}/.local" || DATA_HOME="${XDG_DATA_HOME}" function link_xdg_config() { [[ "${verbose}" = true ]] && verbose_ln='-v' || verbose_ln='' if [[ -d "${CONFIG_HOME}/${1}" && "${override}" = false ]] then echo "Failed to link '${1}': already existing ('-f' for overwrite)" else [[ "${verbose}" = true ]] && echo "Linking '${1}'" ln -s -f ${verbose_ln} -t "${CONFIG_HOME}" "${PWD}/${1}" fi } function link_xdg_data() { [[ "${verbose}" = true ]] && verbose_ln='-v' || verbose_ln='' if [[ -d "${DATA_HOME}/${1}" && "${override}" = false ]] then echo "Failed to link '${1}': already existing ('-f' for overwrite)" else [[ "${verbose}" = true ]] && echo "Linking '${1}'" ln -s -f ${verbose_ln} -t "${DATA_HOME}" "${PWD}/${1}" fi } function link_dot() { [[ "${verbose}" = true ]] && verbose_ln='-v' || verbose_ln='' if [[ -f "${HOME}/.${1}" && "${override}" = false ]] then echo "Failed to link '${1}': already existing ('-f' for overwrite)" else [[ "${verbose}" = true ]] && echo "Linking '${1}'" ln -s -f ${verbose_ln} "${PWD}/${2}/${1}" "${HOME}/.${1}" fi } # Setup Git link_xdg_config "git" +# Setup Kitty +link_xdg_config "kitty" + # Setup Neovim link_xdg_config "nvim" mkdir -p ${DATA_HOME}/nvim/site/pack/minpac/opt git clone https://github.com/k-takata/minpac.git \ ${DATA_HOME}/nvim/site/pack/minpac/opt/minpac echo "Neovim has been set up, but you will need to manually call" \ "\`:PackageUpdate()\` to install the plug-ins" # Setup Vim link_xdg_config "vim" curl -sS -fLo ${DATA_HOME}/vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim echo ":set runtimepath+=${XDG_CONFIG_HOME}/vim,${XDG_CONFIG_HOME}/vim/after :set packpath+=${XDG_DATA_HOME}/vim/pack source ${XDG_CONFIG_HOME}/vim/vimrc" > ${HOME}/.vimrc echo "Vim has been set up, but you will need to manually call" \ "\`:PlugInstall()\` to install the plug-ins" # Setup Weechat link_xdg_config "weechat" # cd ~/.weechat/python/autoload; wget https://raw.githubusercontent.com/kattrali/weemoji/master/weemoji.py # Setup XDG link_xdg_config "user-dirs.dirs" # Setup Zsh link_dot "zshrc" "zsh" # Add scripts for emails link_xdg_data "mailpop.py" diff --git a/kitty/diff.conf b/kitty/diff.conf new file mode 100644 index 0000000..4587867 --- /dev/null +++ b/kitty/diff.conf @@ -0,0 +1,91 @@ +# Syntax highlighting style +pygments_style native + +# Basic colours +foreground white +background black + +# Title colours +title_fg white +title_bg black + +# Margin colours +margin_fg #fafbfc +margin_bg #222222 + +# Removed text backgrounds +removed_bg #440000 +highlight_removed_bg #fdb8c0 +removed_margin_bg #aa0000 + +# Added text backgrounds +added_bg #004400 +highlight_added_bg #acf2bd +added_margin_bg #00aa00 + +# Filler (empty) line background +filler_bg #1a1a1a + +# Hunk colours +hunk_margin_bg #aa00aa +hunk_bg #550055 + + +# Quit +map q quit + +# Scroll down +map j scroll_by 1 + +# Scroll up +map k scroll_by -1 + +# Scroll to top +map g scroll_to start + +# Scroll to bottom +map G scroll_to end + +# Scroll to next page +map ctrl+f scroll_to next-page + +# Scroll to previous page +map ctrl+b scroll_to prev-page + +# Scroll to next change +map n scroll_to next-change + +# Scroll to previous change +map p scroll_to prev-change + +# Show all context +map a change_context all + +# Show default context +map = change_context default + +# Increase context +map + change_context 5 + +# Decrease context +map - change_context -5 + +# Search forward +map / start_search regex forward + +# Search backward +map ? start_search regex backward + +# Scroll to next search match +map . scroll_to next-match +map > scroll_to next-match + +# Scroll to previous search match +map , scroll_to prev-match +map < scroll_to prev-match + +# Search forward (no regex) +map f start_search substring forward + +# Search backward (no regex) +map b start_search substring backward diff --git a/zsh/zshrc b/zsh/zshrc index 5e037e2..2769447 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,197 +1,200 @@ # Filename: .zshrc current_path=$(readlink -f "$(print -P %N)") root_dir=$(dirname "$(dirname "${current_path}")") local OS=`uname` local SYMB='' if [[ ${EUID} -eq 0 ]] then SYMB='#' else SYMB='%%' fi # Using custom colored output for ls case ${OS} in 'Darwin') export LSCOLORS='GxFxCxDxBxegedabagaced' ;; 'Linux') eval $(dircolors ${root_dir}/colors/ls.zsh) ;; esac # Common aliases case ${OS} in 'Darwin') alias ls='ls -G' alias mv=" noglob mv -iv" alias rm=" noglob rm -iv" alias du="du -h -x -d 1" ;; 'Linux') alias ls="ls --color=auto" alias mv=" noglob timeout 8 mv -iv" alias rm=" noglob timeout 3 rm -Iv --one-file-system" alias du="du --human-readable --total --max-depth=1" ;; esac alias lsa="ls -lisAh" alias grep="grep --color=auto" alias grepi="grep -RnI --exclude=tags" alias egrepi="grep -RnIE" alias lsblk="lsblk -o NAME,FSTYPE,SIZE,LABEL,MOUNTPOINT" +alias kgdiff='git difftool --no-symlinks --dir-diff' # Adding a "command not found" hook if [[ ${OS} == 'Linux' ]] then source /usr/share/doc/pkgfile/command-not-found.zsh fi # Set home page for Lynx export WWW_HOME="https://duckduckgo.com" # Set editor export EDITOR=nvim # Change shortcuts to Emacs bindkey -e # Set XDG variables export XDG_DATA_HOME="${HOME}/.local" export XDG_CONFIG_HOME="${HOME}/.config" export XDG_CACHE_HOME="${HOME}/.cache" # Set Weechat home directory export WEECHAT_HOME="${XDG_CONFIG_HOME}/weechat" # Set make flags local numcpus='' case ${OS} in 'Darwin') numcpus=$((`system_profiler SPHardwareDataType 2> /dev/null | grep 'Total Number of Cores' | sed 's/[[:space:]]Total Number of Cores: //'`)) ;; 'Linux') numcpus=`grep -c '^processor' /proc/cpuinfo` ;; esac export MAKEFLAGS="--jobs=${numcpus} --load-average=${numcpus}" # Define default compilers export CC="/usr/bin/clang" export CXX="/usr/bin/clang++" # Starting tmux #[[ -z "$TMUX" ]] && exec tmux man() { env LESS_TERMCAP_mb=$'\E[01;31m' \ LESS_TERMCAP_md=$'\E[01;38;5;74m' \ LESS_TERMCAP_md=$'\E[0m' \ LESS_TERMCAP_md=$'\E[0m' \ LESS_TERMCAP_md=$'\E[38;5;246m' \ LESS_TERMCAP_md=$'\E[0m' \ LESS_TERMCAP_md=$'\E[04;38;5;66m' \ man "$@" } autoload -Uz compinit && compinit +# Completion for kitty +kitty + complete setup zsh | source /dev/stdin autoload -U colors && colors setopt promptsubst setopt promptpercent function DisplayJobsInformation() { if [[ -z `jobs` ]] then jobsNb=0 color="green" else jobsNb=`jobs | awk '/\[/{i++}END{print i}'` color="red" fi echo "%{%F{$color}%}$jobsNb jobs" } source ${root_dir}/colors/zsh source ${root_dir}/battery/display.zsh if [[ -z $TMUX && -z $STY && $TERM != 'screen' ]] then local dispBattery='$(DisplayBatteryInformation)' else local dispBattery='' fi function DisplayBatteryInformation() { local battery=$(DisplayBattery) if [[ ${battery} != '' ]] then echo "${battery} " else echo '' fi } # Enable Git repo status display case "${OS}" in 'Darwin') source '/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh' ;; 'Linux') source '/usr/share/git/git-prompt.sh' ;; esac GIT_PS1_SHOWDIRTYSTATE='true' GIT_PS1_SHOWSTASHSTATE='true' GIT_PS1_SHOWUNTRACKEDFILES='true' GIT_PS1_SHOWUPSTREAM=('verbose' 'name' 'git') GIT_PS1_SHOWCOLORHINTS='true' precmd() { __git_ps1 " %{%F{cyan}%}%~%{%f%}" " ${dispBattery}${SYMB} " " [%s]" } RPROMPT=$'$(DisplayJobsInformation)' # Start the gpg-agent if not already running if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then gpg-connect-agent /bye >/dev/null 2>&1 fi # Set SSH to use gpg-agent unset SSH_AGENT_PID if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then export SSH_AUTH_SOCK="/run/user/${UID}/gnupg/S.gpg-agent.ssh" fi # Set GPG TTY GPG_TTY=$(tty) export GPG_TTY # Refresh gpg-agent tty in case user switches into an X session gpg-connect-agent updatestartuptty /bye >/dev/null