diff --git a/nvim/plugin/git.vim b/nvim/plugin/git.vim index 901d487..66ca1dd 100644 --- a/nvim/plugin/git.vim +++ b/nvim/plugin/git.vim @@ -2,12 +2,11 @@ let g:gitgutter_map_keys = 0 nnoremap gg :G nnoremap g :Git - nnoremap gs :vertical Git - nnoremap gd :Gdiffsplit - nnoremap gb :Git blame - nnoremap gw :GBrowse - nnoremap gW :.GBrowse + nnoremap gs :vertical Gstatus + nnoremap gd :Gdiff + nnoremap gb :Gblame + nnoremap gw :Gbrowse nnoremap gc :Gcommit % - nnoremap gl :Gclog - nnoremap gp :Git push + nnoremap gl :Glog + nnoremap gp :Gpush " }}} diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index e75e872..c5227a4 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -74,12 +74,7 @@ alias du='du -h' alias df='df -h' alias free='free -h' -if command_exists apt && command_exists apt-get; then - apt_get_message="use 'apt' instead of 'apt-get' -if you really want to use 'apt-get', type '\\apt-get'" - alias apt-get="echo -E ${(qqq)apt_get_message} #" - unset apt_get_message -fi +alias apt-get="echo -e \"use 'apt' instead of 'apt-get'\nif you really want to use 'apt-get', type '"'\\\\'"apt-get'\" #" # editor alias edit="$EDITOR" @@ -102,9 +97,3 @@ alias bin-list-dylib-symbols='nm -gD' # Duplicated as an alias to prevent autocorrection of the real "command" part. # See also scripts/prime-run alias prime-run='__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia ' - -if ! command_exists update-grub; then - # Doesn't exist on Arch by default. Probably implementing this command was - # left as a challenge to the documentation reader. - alias update-grub="grub-mkconfig -o /boot/grub/grub.cfg" -fi diff --git a/zsh/completion.zsh b/zsh/completion.zsh index faa7748..5ae1e87 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -40,12 +40,9 @@ zstyle ':completion:*:processes' force-list always _completion_get_hosts() { print localhost - local line - < ~/.ssh/config while IFS= read -r line; do - if [[ "$line" =~ '^Host[[:blank:]]+(.*)[[:blank:]]*' ]]; then - print -- "${match[1]}" - fi - done + if [[ -f ~/.ssh/config ]]; then + awk "match(\$0, /^Host[[:blank:]]*/) { print substr(\$0, RLENGTH+1); }" ~/.ssh/config + fi } zstyle -e ':completion:*:hosts' hosts 'reply=("${(@f)$(_completion_get_hosts)}")' diff --git a/zsh/path.zsh b/zsh/path.zsh index fff9b36..d6a9bda 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -1,11 +1,9 @@ #!/usr/bin/env zsh -export PATH -export MANPATH - # tie these env variables to zsh arrays -export -T PKG_CONFIG_PATH pkg_config_path ':' -export -T LD_LIBRARY_PATH ld_library_path ':' +typeset -T PKG_CONFIG_PATH pkg_config_path ':' + +export PKG_CONFIG_PATH PATH MANPATH path_prepend() { if (( $# < 1 )); then @@ -77,28 +75,24 @@ if [[ -f ~/.rustup/settings.toml ]]; then # use of rustup's CLI. Also a shortcut is taken: strings aren't unescaped # because Rust toolchain names don't need escaping in strings. # See also . - rust_toolchain="" - < ~/.rustup/settings.toml while IFS= read -r line; do - if [[ "$line" =~ '^default_toolchain = "(.+)"$' ]]; then - rust_toolchain="${match[1]}" - break - elif [[ "$line" == \[*\] ]]; then - break - fi - done; unset line - - if [[ -n "$rust_toolchain" ]]; then + if rust_toolchain="$( + awk ' + match($0, /^default_toolchain = "(.+)"$/, matches) { + print matches[1]; + exit; + } + /^\[.+\]$/ { + exit; + } + ' ~/.rustup/settings.toml + )" && [[ -n "$rust_toolchain" ]]; then rust_sysroot=~/.rustup/toolchains/"$rust_toolchain" path_prepend path "$rust_sysroot"/bin path_prepend fpath "$rust_sysroot"/zsh/site-functions path_prepend manpath "$rust_sysroot"/share/man - path_prepend ld_library_path "$rust_sysroot"/lib - unset rust_sysroot fi - - unset rust_toolchain + unset rust_toolchain rust_sysroot fi - path_prepend path ~/.cargo/bin # add my binaries and completions @@ -109,12 +103,3 @@ path_prepend fpath "$ZSH_DOTFILES/completions" path_prepend path ~/.local/bin unfunction path_prepend - -# For some reason manpath is not always set when logging with ssh for instance. -# Let's ensure that it is always set and exported. The additional colon ensures -# that the system manpath isn't overwritten (see manpath(1)). -if [[ -n "$MANPATH" && "$MANPATH" != *: ]]; then - # Append a colon if MANPATH isn't empty and doesn't end with a colon already - MANPATH="$MANPATH:" -fi -export MANPATH="$MANPATH" diff --git a/zsh/zshrc b/zsh/zshrc index ea8cb05..3513103 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -46,6 +46,14 @@ _perf_timer_start "total" fi # }}} +# For some reason manpath is not always set when logging with ssh for instance. +# Let's ensure that it is always set and exported. The additional colon ensures +# that the system manpath isn't overwritten (see manpath(1)), though in reality +# two colons get added for some reason, which is also valid, but means +# something slightly different (again, see manpath(1)). Hope this won't cause +# any problems in the future. +export MANPATH="$MANPATH:" + for script in functions options path env plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh"