Compare commits
8 Commits
osc-52-pas
...
ea61bde858
| Author | SHA1 | Date | |
|---|---|---|---|
| ea61bde858 | |||
| a96aa50fbe | |||
| c61c86e979 | |||
| 8790bc0c4e | |||
| b349befbf4 | |||
| 74f2dd7dae | |||
| a362ab0e04 | |||
| a422ab1125 |
@@ -49,7 +49,7 @@ commands:
|
|||||||
if which vim &> /dev/null; then
|
if which vim &> /dev/null; then
|
||||||
# Exit the autoenv before editing.
|
# Exit the autoenv before editing.
|
||||||
_autoenv_exit $PWD
|
_autoenv_exit $PWD
|
||||||
if vim -p $PWD/.enter $PWD/.exit; then
|
if $EDITOR -p $PWD/.enter $PWD/.exit; then
|
||||||
# If enter script exists, authorize it.
|
# If enter script exists, authorize it.
|
||||||
[ -f $PWD/.enter ] && _autoenv_authorized $PWD/.enter yes
|
[ -f $PWD/.enter ] && _autoenv_authorized $PWD/.enter yes
|
||||||
# If exit script exists, authorize it.
|
# If exit script exists, authorize it.
|
||||||
@@ -97,8 +97,8 @@ commands:
|
|||||||
echo '.enter or .exit not found'; return 1
|
echo '.enter or .exit not found'; return 1
|
||||||
fi
|
fi
|
||||||
_autoenv_exit $PWD
|
_autoenv_exit $PWD
|
||||||
virtualenv .local
|
virtualenv -p `command -v python` .local
|
||||||
echo 'source .local/bin/activate' >> .enter
|
echo 'source ${0:a:h}/.local/bin/activate' >> .enter
|
||||||
echo 'deactivate' >> .exit
|
echo 'deactivate' >> .exit
|
||||||
_autoenv_authorized $PWD/.enter yes
|
_autoenv_authorized $PWD/.enter yes
|
||||||
_autoenv_authorized $PWD/.exit yes
|
_autoenv_authorized $PWD/.exit yes
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#compdef build-dir
|
#compdef build-dir
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
'(-h --help)'{-h,--help}'[]' \
|
'(-h --help)'{-h,--help}'[show this help message and exit]' \
|
||||||
|
'(-s --show)'{-s,--show}'[show the current build directory]' \
|
||||||
'--build[invoke a build after selection]' \
|
'--build[invoke a build after selection]' \
|
||||||
'1:directory:_files'
|
'1:directory:_files'
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ fi
|
|||||||
# Interactively choose a `~build` directory for `build` to build.
|
# Interactively choose a `~build` directory for `build` to build.
|
||||||
build-dir() {
|
build-dir() {
|
||||||
local usage='usage: build-dir [-h] [--build] [<directory>]'
|
local usage='usage: build-dir [-h] [--build] [<directory>]'
|
||||||
local -a help do_build
|
local -a help show do_build
|
||||||
zparseopts -D h=help -help=help -build=do_build
|
zparseopts -D h=help -help=help s=show -show=show -build=do_build
|
||||||
if [[ -n $help ]]; then
|
if [[ -n $help ]]; then
|
||||||
cat << EOF
|
cat << EOF
|
||||||
$usage
|
$usage
|
||||||
@@ -45,12 +45,22 @@ positional arguments:
|
|||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
|
-s, --show show the current build directory
|
||||||
--build invoke a build after selection
|
--build invoke a build after selection
|
||||||
EOF
|
EOF
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
error() { echo "\e[31merror:\e[0m $1" }
|
error() { echo "\e[31merror:\e[0m $1" }
|
||||||
warning() { echo "\e[33mwarning:\e[0m $1" }
|
warning() { echo "\e[33mwarning:\e[0m $1" }
|
||||||
|
if [[ -n $show ]]; then
|
||||||
|
if [[ ! -n $build_dir ]]; then
|
||||||
|
error "build directory not set"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
echo "$build_dir"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
local local_build_dir
|
local local_build_dir
|
||||||
if [[ ${#*} -gt 1 ]]; then
|
if [[ ${#*} -gt 1 ]]; then
|
||||||
echo $usage
|
echo $usage
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ fresh_line_one() {
|
|||||||
# Construct the time and directory portions of the prompt
|
# Construct the time and directory portions of the prompt
|
||||||
local time_stamp="%{%F{244}%}%D{%H:%M:%S}%{%f%}"
|
local time_stamp="%{%F{244}%}%D{%H:%M:%S}%{%f%}"
|
||||||
[[ -n $SANDBOX_HOME ]] && \
|
[[ -n $SANDBOX_HOME ]] && \
|
||||||
local directory="%{%F{3}%}$SANDBOX_NAME${PWD#$SANDBOX_HOME}%{%f%}" || \
|
local directory="%{%F{220}%}$SANDBOX_NAME${PWD#$SANDBOX_HOME}%{%f%}" || \
|
||||||
local directory="%{%F{37}%}%~%{%f%}"
|
local directory="%{%F{37}%}%~%{%f%}"
|
||||||
|
|
||||||
# Check we are in a git repository
|
# Check we are in a git repository
|
||||||
|
|||||||
10
tasks.yaml
10
tasks.yaml
@@ -10,9 +10,17 @@
|
|||||||
become: true
|
become: true
|
||||||
apt:
|
apt:
|
||||||
name:
|
name:
|
||||||
- zsh-doc
|
|
||||||
- pinentry-curses
|
- pinentry-curses
|
||||||
|
- silversearcher-ag
|
||||||
- unzip
|
- unzip
|
||||||
|
- zsh-doc
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: zsh install macOS packages
|
||||||
|
when: ansible_os_family == "Darwin"
|
||||||
|
become: false
|
||||||
|
homebrew:
|
||||||
|
name: the_silver_searcher
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: zsh clone plugin repos
|
- name: zsh clone plugin repos
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ for completion in $zsh_completions/src/_*; do
|
|||||||
# Remove existing completion file if it exists.
|
# Remove existing completion file if it exists.
|
||||||
[ -f $symlink ] && rm $symlink
|
[ -f $symlink ] && rm $symlink
|
||||||
# Check if the command exists on the PATH.
|
# Check if the command exists on the PATH.
|
||||||
if which ${name:1} &> /dev/null; then
|
if command -v ${name:1} &> /dev/null; then
|
||||||
# Symlink the completion for the existing command.
|
# Symlink the completion for the existing command.
|
||||||
[ `uname` = Darwin ] && \
|
[ `uname` = Darwin ] && \
|
||||||
ln -s $completion $symlink || ln -sr $completion $symlink
|
ln -s $completion $symlink || ln -sr $completion $symlink
|
||||||
|
|||||||
@@ -16,10 +16,7 @@ fi
|
|||||||
|
|
||||||
# Abstract different ways to paste from the clipboard.
|
# Abstract different ways to paste from the clipboard.
|
||||||
# TODO: Use OSC-52 to get the clipboard, not widely supported though
|
# TODO: Use OSC-52 to get the clipboard, not widely supported though
|
||||||
if [ -n "$SSH_CONNECTION" ]; then
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
# Use OSC-52 to get the clipboard
|
|
||||||
alias paste='printf "\033]52;c;?\a"'
|
|
||||||
elif [ "`uname`" = "Darwin" ]; then
|
|
||||||
# Use pbpaste to get the clipboard
|
# Use pbpaste to get the clipboard
|
||||||
alias paste='pbpaste'
|
alias paste='pbpaste'
|
||||||
elif which xclip &> /dev/null; then
|
elif which xclip &> /dev/null; then
|
||||||
|
|||||||
22
zshenv
22
zshenv
@@ -37,7 +37,7 @@ export CCACHE_CONFIGPATH=$HOME/.config/ccache
|
|||||||
export CCACHE_DIR=$HOME/.cache/ccache
|
export CCACHE_DIR=$HOME/.cache/ccache
|
||||||
|
|
||||||
# Add default CMake generator
|
# Add default CMake generator
|
||||||
which ninja &> /dev/null && \
|
command -v ninja &> /dev/null && \
|
||||||
export CMAKE_GENERATOR=Ninja
|
export CMAKE_GENERATOR=Ninja
|
||||||
|
|
||||||
# Remove duplicates from environment variables
|
# Remove duplicates from environment variables
|
||||||
@@ -47,8 +47,12 @@ typeset -U MANPATH; export MANPATH
|
|||||||
typeset -U INFOPATH; export INFOPATH
|
typeset -U INFOPATH; export INFOPATH
|
||||||
|
|
||||||
# Set default editor.
|
# Set default editor.
|
||||||
which vim &> /dev/null && \
|
if command -v nvim &> /dev/null; then
|
||||||
export EDITOR=`which vim`
|
export EDITOR=`command -v nvim`
|
||||||
|
elif command -v vim &> /dev/null; then
|
||||||
|
export EDITOR=`command -v vim`
|
||||||
|
fi
|
||||||
|
export GIT_EDITOR=$EDITOR
|
||||||
|
|
||||||
# Use ~/.local for pip installs on macOS
|
# Use ~/.local for pip installs on macOS
|
||||||
[ "`uname`" = "Darwin" ] && export PYTHONUSERBASE=$HOME/.local
|
[ "`uname`" = "Darwin" ] && export PYTHONUSERBASE=$HOME/.local
|
||||||
@@ -77,24 +81,24 @@ export PYLINTHOME=~/.local/share/pylint
|
|||||||
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||||
|
|
||||||
# If pinentry-curses exists, use it for lastpass-cli
|
# If pinentry-curses exists, use it for lastpass-cli
|
||||||
which pinentry-curses &> /dev/null && \
|
command -v pinentry-curses &> /dev/null && \
|
||||||
export LPASS_PINENTRY=pinentry-curses
|
export LPASS_PINENTRY=pinentry-curses
|
||||||
|
|
||||||
# Teach these some XDG Base Directory Spec manners
|
# Teach these some XDG Base Directory Spec manners
|
||||||
export IPYTHONDIR=$HOME/.config/ipython
|
export IPYTHONDIR=$HOME/.config/ipython
|
||||||
which cargo &> /dev/null && \
|
command -v cargo &> /dev/null && \
|
||||||
export CARGO_HOME=$HOME/.local/share/cargo
|
export CARGO_HOME=$HOME/.local/share/cargo
|
||||||
if which ccache &> /dev/null; then
|
if command -v ccache &> /dev/null; then
|
||||||
export CCACHE_CONFIGPATH=$HOME/.config/ccache.conf
|
export CCACHE_CONFIGPATH=$HOME/.config/ccache.conf
|
||||||
export CCACHE_DIR=$HOME/.cache/ccache
|
export CCACHE_DIR=$HOME/.cache/ccache
|
||||||
fi
|
fi
|
||||||
which conan &> /dev/null && \
|
command -v conan &> /dev/null && \
|
||||||
export CONAN_USER_HOME=$HOME/.local/share/conan
|
export CONAN_USER_HOME=$HOME/.local/share/conan
|
||||||
which docker &> /dev/null && \
|
command -v docker &> /dev/null && \
|
||||||
export DOCKER_CONFIG=$HOME/.local/share/docker
|
export DOCKER_CONFIG=$HOME/.local/share/docker
|
||||||
export GTK_RC_FILES=$HOME/.config/gtk/gtkrc
|
export GTK_RC_FILES=$HOME/.config/gtk/gtkrc
|
||||||
export GTK2_RC_FILES=$HOME/.config/gtk-2.0/gtkrc
|
export GTK2_RC_FILES=$HOME/.config/gtk-2.0/gtkrc
|
||||||
which rustup &> /dev/null && \
|
command -v rustup &> /dev/null && \
|
||||||
export RUSTUP_HOME=$HOME/.local/share/rustup
|
export RUSTUP_HOME=$HOME/.local/share/rustup
|
||||||
export PYLINTHOME=$HOME/.cache/pylint
|
export PYLINTHOME=$HOME/.cache/pylint
|
||||||
# TODO: terminfo
|
# TODO: terminfo
|
||||||
|
|||||||
13
zshrc
13
zshrc
@@ -68,7 +68,7 @@ autoload -U compinit
|
|||||||
compinit
|
compinit
|
||||||
|
|
||||||
# Add pip to the old completion engine if present
|
# Add pip to the old completion engine if present
|
||||||
if which pip &> /dev/null; then
|
if command -v pip &> /dev/null; then
|
||||||
function _pip_completion {
|
function _pip_completion {
|
||||||
local words cword
|
local words cword
|
||||||
read -Ac words
|
read -Ac words
|
||||||
@@ -172,15 +172,16 @@ fi
|
|||||||
# Frequntly used directories
|
# Frequntly used directories
|
||||||
function frequent-directory() { export $1; hash -d $1 }
|
function frequent-directory() { export $1; hash -d $1 }
|
||||||
frequent-directory Projects="$HOME/Projects"
|
frequent-directory Projects="$HOME/Projects"
|
||||||
|
frequent-directory Sandbox="$HOME/Sandbox"
|
||||||
|
|
||||||
# Load work related config
|
# Load work related config
|
||||||
[ -f ~/.config/work/zshrc ] && source ~/.config/work/zshrc
|
[ -f ~/.config/work/zshrc ] && source ~/.config/work/zshrc
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
alias grep='grep --color=always'
|
alias grep='grep --color=always'
|
||||||
which cmake &> /dev/null && \
|
command -v cmake &> /dev/null && \
|
||||||
alias cninja='cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
|
alias cninja='cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
|
||||||
which ssh &> /dev/null && \
|
command -v ssh &> /dev/null && \
|
||||||
alias ssh='TERM=xterm-256color ssh'
|
alias ssh='TERM=xterm-256color ssh'
|
||||||
alias weather="curl wttr.in"
|
alias weather="curl wttr.in"
|
||||||
alias cls="clear && printf '\e[3J'"
|
alias cls="clear && printf '\e[3J'"
|
||||||
@@ -188,15 +189,15 @@ alias cls="clear && printf '\e[3J'"
|
|||||||
case `uname` in
|
case `uname` in
|
||||||
Linux)
|
Linux)
|
||||||
alias ls='ls -F --color=auto'
|
alias ls='ls -F --color=auto'
|
||||||
if which cgdb &> /dev/null; then
|
if command -v cgdb &> /dev/null; then
|
||||||
alias debug='cgdb --args'
|
alias debug='cgdb --args'
|
||||||
elif which gdb &> /dev/null; then
|
elif command -v gdb &> /dev/null; then
|
||||||
alias debug='gdb --args'
|
alias debug='gdb --args'
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
Darwin)
|
Darwin)
|
||||||
alias ls='ls -GFh'
|
alias ls='ls -GFh'
|
||||||
which lldb &> /dev/null && \
|
command -v lldb &> /dev/null && \
|
||||||
alias debug='lldb --'
|
alias debug='lldb --'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user