mirror of
https://github.com/sebaschi/dotfiles.git
synced 2026-11-15 09:00:27 +01:00
Add grml tmux and zsh configs
This commit is contained in:
1 parent
8cbb941af6
commit
b1060d52eb
6 files changed
+4194
-18
No files matched your search
@@ -0,0 +1,97 @@
|
|||||||
|
# Filename: /etc/tmux
|
||||||
|
# Purpose: configuration file for tmux
|
||||||
|
# Authors: grml-team (grml.org), (c) Michael Prokop <mika at grml.org>,
|
||||||
|
# Sebastian Boehm <sebastian at sometimesfood.org>
|
||||||
|
# Bernhard Tittelbach <xro at realraum.at>
|
||||||
|
# Bug-Reports: see http://grml.org/bugs/
|
||||||
|
# License: This file is licensed under the GPL v2.
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
### screen-like keybindings
|
||||||
|
unbind C-b
|
||||||
|
set -g prefix C-a
|
||||||
|
bind-key a send-prefix
|
||||||
|
bind-key C-a last-window
|
||||||
|
unbind space
|
||||||
|
bind-key space next-window
|
||||||
|
bind-key C-space next-window
|
||||||
|
bind-key K confirm-before kill-pane
|
||||||
|
bind-key '\' confirm-before kill-session
|
||||||
|
#bind-key C-h previous-window
|
||||||
|
|
||||||
|
### join the last active pane to the currently active window
|
||||||
|
bind-key j join-pane -s !
|
||||||
|
|
||||||
|
### join the marked pane to the currently active window
|
||||||
|
### ('bind-key m select-pane -m' is default to mark the current pane)
|
||||||
|
bind-key J join-pane
|
||||||
|
|
||||||
|
### Move current window to session named "bg" (and create session if it does not exist)
|
||||||
|
bind-key B if-shell '! tmux has-session -t bg' {
|
||||||
|
new-session -d -s bg
|
||||||
|
move-window -t bg
|
||||||
|
}
|
||||||
|
|
||||||
|
### Reload Config
|
||||||
|
bind-key R source-file ~/.tmux.conf \; source-file -q ~/.tmux.conf.local \; display-message "~/.tmux.conf[.local] reloaded"
|
||||||
|
|
||||||
|
###rebind keys
|
||||||
|
bind-key h next-layout
|
||||||
|
bind-key BSpace previous-window
|
||||||
|
|
||||||
|
bind-key tab select-pane -t :.+
|
||||||
|
### useful custom keybindings
|
||||||
|
bind-key | command-prompt -p "exec:" "split-window -h '%%'"
|
||||||
|
bind-key - command-prompt -p "exec:" "split-window -v '%%'"
|
||||||
|
|
||||||
|
%if #{>=:#{version},3.1}
|
||||||
|
bind-key -N 'Select the last (previously selected) window' C-a last-window
|
||||||
|
bind-key -N 'Select the next window' space next-window
|
||||||
|
bind-key -N 'Select the next window' C-space next-window
|
||||||
|
bind-key -N 'Kill pane (with confirmation)' K confirm-before kill-pane
|
||||||
|
bind-key -N 'Kill session (with confirmation)' '\' confirm-before kill-session
|
||||||
|
bind-key -N 'Join the last active pane to the currently active window' j join-pane -s !
|
||||||
|
bind-key -N 'Join the marked pane to the currently active window' J join-pane
|
||||||
|
bind-key -N 'Move current window to session named "bg" (and create session if it does not exist)' B if-shell "! tmux has-session -t bg" "new-session -d -s bg" \; move-window -t bg
|
||||||
|
bind-key -N 'Reload config' R source-file ~/.tmux.conf \; source-file -q ~/.tmux.conf.local \; display-message '~/.tmux.conf[.local] reloaded'
|
||||||
|
bind-key -N 'Select the next layout' h next-layout
|
||||||
|
bind-key -N 'Select the previous window' BSpace previous-window
|
||||||
|
bind-key -N 'Select next pane' tab select-pane -t :.+
|
||||||
|
bind-key -N 'Split window horizontally & prompt for command' | command-prompt -p "exec:" "split-window -h '%%'"
|
||||||
|
bind-key -N 'Split window vertically & prompt for command' - command-prompt -p "exec:" "split-window -v '%%'"
|
||||||
|
%endif
|
||||||
|
|
||||||
|
### misc options
|
||||||
|
set -s escape-time 0
|
||||||
|
set -g default-terminal "screen-256color"
|
||||||
|
set -g display-panes-time 3000
|
||||||
|
set -g visual-activity on
|
||||||
|
set -g mode-keys vi
|
||||||
|
set -g history-limit 10000 # default: 2000
|
||||||
|
|
||||||
|
### set status line appearance
|
||||||
|
set -g status-style fg=white,bg=black
|
||||||
|
|
||||||
|
set -g status-left-length 28
|
||||||
|
### status-left: @hostname:sessionname
|
||||||
|
#set -g status-left "#[fg=white,bold]@#h#[fg=red]:#S#[fg=white,nobold] | "
|
||||||
|
### status-left: username@hostname:sessionname
|
||||||
|
set -g status-left "#[fg=red,bold]#{user}@#[fg=white]#h#[fg=red]:#S#[fg=white,nobold] | "
|
||||||
|
|
||||||
|
### status-right: Date and Time
|
||||||
|
#set -g status-right '#[fg=yellow]%Y-%m-%d %H:%M'
|
||||||
|
### status-right: IPs and Date and Time
|
||||||
|
set -g status-right-length 64
|
||||||
|
if-shell 'command -v hostname && hostname --help | grep -q -- -I' {
|
||||||
|
set -g status-right "#[fg=green](net: #(hostname -I | sed -e 's/ [^ ]*:.*$//;s/ / | /g;s/ | $//')) #[fg=yellow]%Y-%m-%d %H:%M"
|
||||||
|
} {
|
||||||
|
set -g status-right '#[fg=yellow]%Y-%m-%d %H:%M'
|
||||||
|
}
|
||||||
|
### status-right: Time
|
||||||
|
#set -g status-right "#[fg=yellow]%H:%M"
|
||||||
|
|
||||||
|
set-window-option -g window-status-style fg=white,bg=black
|
||||||
|
set-window-option -g window-status-current-style fg=blue,bg=white
|
||||||
|
|
||||||
|
### source user-specific local configuration file
|
||||||
|
source-file -q ~/.tmux.conf.local
|
||||||
File renamed without changes.
Executable
+37
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# IMPORTANT: please note that you might override existing
|
||||||
|
# configuration files in the current working directory!
|
||||||
|
if command -v wget >/dev/null 2>&1 ; then
|
||||||
|
wget -O .screenrc https://grml.org/console/screenrc
|
||||||
|
wget -O .tmux.conf https://grml.org/console/tmux.conf
|
||||||
|
wget -O .vimrc https://grml.org/console/vimrc
|
||||||
|
wget -O .zshrc https://grml.org/console/zshrc
|
||||||
|
wget -O .zshenv https://grml.org/console/zshenv
|
||||||
|
# optional:
|
||||||
|
# wget -O .zshrc.local https://grml.org/console/zshrc.local
|
||||||
|
# wget -O .screenrc_v4 https://grml.org/console/screenrc_v4
|
||||||
|
elif command -v curl >/dev/null 2>&1 ; then
|
||||||
|
curl -sSfL -o .screenrc https://grml.org/console/screenrc
|
||||||
|
curl -sSfL -o .tmux.conf https://grml.org/console/tmux.conf
|
||||||
|
curl -sSfL -o .vimrc https://grml.org/console/vimrc
|
||||||
|
curl -sSfL -o .zshrc https://grml.org/console/zshrc
|
||||||
|
curl -sSfL -o .zshenv https://grml.org/console/zshenv
|
||||||
|
# optional:
|
||||||
|
# curl -sSfL -o .zshrc.local https://grml.org/console/zshrc.local
|
||||||
|
# curl -sSfL -o .screenrc_v4 https://grml.org/console/screenrc_v4
|
||||||
|
elif command -v fetch >/dev/null 2>&1 ; then
|
||||||
|
fetch -o .screenrc https://grml.org/console/screenrc
|
||||||
|
fetch -o .tmux.conf https://grml.org/console/tmux.conf
|
||||||
|
fetch -o .vimrc https://grml.org/console/vimrc
|
||||||
|
fetch -o .zshrc https://grml.org/console/zshrc
|
||||||
|
fetch -o .zshenv https://grml.org/console/zshenv
|
||||||
|
# optional:
|
||||||
|
# fetch -o .zshrc.local https://grml.org/console/zshrc.local
|
||||||
|
# fetch -o .screenrc_v4 https://grml.org/console/screenrc_v4
|
||||||
|
else
|
||||||
|
echo 'Error: neither wget, curl not fetch available for retrieving configuration files.' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
+89
@@ -0,0 +1,89 @@
|
|||||||
|
# Filename: zshenv
|
||||||
|
# Purpose: system-wide .zshenv file for zsh(1)
|
||||||
|
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
|
||||||
|
# Bug-Reports: see http://grml.org/bugs/
|
||||||
|
# License: This file is licensed under the GPL v2.
|
||||||
|
################################################################################
|
||||||
|
# This file is sourced on all invocations of the shell.
|
||||||
|
# It is the 1st file zsh reads; it's read for every shell,
|
||||||
|
# even if started with -f (setopt NO_RCS), all other
|
||||||
|
# initialization files are skipped.
|
||||||
|
#
|
||||||
|
# This file should contain commands to set the command
|
||||||
|
# search path, plus other important environment variables.
|
||||||
|
# This file should not contain commands that produce
|
||||||
|
# output or assume the shell is attached to a tty.
|
||||||
|
#
|
||||||
|
# Notice: .zshenv is the same, execpt that it's not read
|
||||||
|
# if zsh is started with -f
|
||||||
|
#
|
||||||
|
# Global Order: zshenv, zprofile, zshrc, zlogin
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# language settings (read in /etc/environment before /etc/default/locale as
|
||||||
|
# the latter one is the default on Debian nowadays)
|
||||||
|
# no xsource() here because it's only created in zshrc! (which is good)
|
||||||
|
[[ -r /etc/environment ]] && source /etc/environment
|
||||||
|
|
||||||
|
## set $PATH
|
||||||
|
# gentoo users have to source /etc/profile.env
|
||||||
|
if [[ -r /etc/gentoo-release ]] ; then
|
||||||
|
[[ -r /etc/profile.env ]] && source /etc/profile.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
# support extra scripts/software in special directory outside of squashfs environment in live mode
|
||||||
|
if [[ -f /etc/grml_cd ]] ; then
|
||||||
|
[[ -r /run/live/medium/scripts ]] && ADDONS='/run/live/medium/scripts'
|
||||||
|
[[ -r /etc/grml/my_path ]] && ADDONS="$(cat /etc/grml/my_path)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# generic $PATH handling
|
||||||
|
if (( EUID != 0 )); then
|
||||||
|
path=(
|
||||||
|
$HOME/bin
|
||||||
|
$HOME/.local/bin
|
||||||
|
/usr/local/bin
|
||||||
|
/usr/bin
|
||||||
|
/bin
|
||||||
|
/usr/local/sbin
|
||||||
|
/usr/sbin
|
||||||
|
/sbin
|
||||||
|
/usr/local/games
|
||||||
|
/usr/games
|
||||||
|
"${ADDONS}"
|
||||||
|
"${path[@]}"
|
||||||
|
)
|
||||||
|
else
|
||||||
|
path=(
|
||||||
|
$HOME/bin
|
||||||
|
$HOME/.local/bin
|
||||||
|
/usr/local/sbin
|
||||||
|
/usr/local/bin
|
||||||
|
/sbin
|
||||||
|
/bin
|
||||||
|
/usr/sbin
|
||||||
|
/usr/bin
|
||||||
|
"${ADDONS}"
|
||||||
|
"${path[@]}"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# remove empty components to avoid '::' ending up + resulting in './' being in $PATH
|
||||||
|
path=( "${path[@]:#}" )
|
||||||
|
|
||||||
|
typeset -U path
|
||||||
|
|
||||||
|
# less (:=pager) options:
|
||||||
|
# export LESS=C
|
||||||
|
typeset -a lp; lp=( ${^path}/lesspipe(N) )
|
||||||
|
if (( $#lp > 0 )) && [[ -x $lp[1] ]] ; then
|
||||||
|
export LESSOPEN="|lesspipe %s"
|
||||||
|
elif [[ -x /usr/bin/lesspipe.sh ]] ; then
|
||||||
|
export LESSOPEN="|lesspipe.sh %s"
|
||||||
|
fi
|
||||||
|
unset lp
|
||||||
|
|
||||||
|
export READNULLCMD=${PAGER:-/usr/bin/pager}
|
||||||
|
|
||||||
|
## END OF FILE #################################################################
|
||||||
|
# vim:filetype=zsh foldmethod=marker autoindent expandtab shiftwidth=4
|
||||||
+341
@@ -0,0 +1,341 @@
|
|||||||
|
# Filename: /etc/skel/.zshrc
|
||||||
|
# Purpose: config file for zsh (z shell)
|
||||||
|
# Authors: (c) grml-team (grml.org)
|
||||||
|
# Bug-Reports: see http://grml.org/bugs/
|
||||||
|
# License: This file is licensed under the GPL v2 or any later version.
|
||||||
|
################################################################################
|
||||||
|
# Nowadays, grml's zsh setup lives in only *one* zshrc file.
|
||||||
|
# That is the global one: /etc/zsh/zshrc (from grml-etc-core).
|
||||||
|
# It is best to leave *this* file untouched and do personal changes to
|
||||||
|
# your zsh setup via ${HOME}/.zshrc.local which is loaded at the end of
|
||||||
|
# the global zshrc.
|
||||||
|
#
|
||||||
|
# That way, we enable people on other operating systems to use our
|
||||||
|
# setup, too, just by copying our global zshrc to their ${HOME}/.zshrc.
|
||||||
|
# Adjustments would still go to the .zshrc.local file.
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
## Inform users about upgrade path for grml's old zshrc layout, assuming that:
|
||||||
|
## /etc/skel/.zshrc was installed as ~/.zshrc,
|
||||||
|
## /etc/zsh/zshrc was installed as ~/.zshrc.global and
|
||||||
|
## ~/.zshrc.local does not exist yet.
|
||||||
|
if [ -r ~/.zshrc -a -r ~/.zshrc.global -a ! -r ~/.zshrc.local ] ; then
|
||||||
|
printf '-!-\n'
|
||||||
|
printf '-!- Looks like you are using the old zshrc layout of grml.\n'
|
||||||
|
printf '-!- Please read the notes in the grml-zsh-refcard, being'
|
||||||
|
printf '-!- available at: http://grml.org/zsh/\n'
|
||||||
|
printf '-!-\n'
|
||||||
|
printf '-!- If you just want to get rid of this warning message execute:\n'
|
||||||
|
printf '-!- touch ~/.zshrc.local\n'
|
||||||
|
printf '-!-\n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Settings for umask
|
||||||
|
#if (( EUID == 0 )); then
|
||||||
|
# umask 002
|
||||||
|
#else
|
||||||
|
# umask 022
|
||||||
|
#fi
|
||||||
|
|
||||||
|
## Now, we'll give a few examples of what you might want to use in your
|
||||||
|
## .zshrc.local file (just copy'n'paste and uncomment it there):
|
||||||
|
|
||||||
|
## Prompt theme extension ##
|
||||||
|
|
||||||
|
# Virtualenv support
|
||||||
|
|
||||||
|
#function virtual_env_prompt () {
|
||||||
|
# REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) }
|
||||||
|
#}
|
||||||
|
#grml_theme_add_token virtual-env -f virtual_env_prompt '%F{magenta}' '%f'
|
||||||
|
#zstyle ':prompt:grml:left:setup' items rc virtual-env change-root user at host path vcs percent
|
||||||
|
|
||||||
|
## ZLE tweaks ##
|
||||||
|
|
||||||
|
## use the vi navigation keys (hjkl) besides cursor keys in menu completion
|
||||||
|
#bindkey -M menuselect 'h' vi-backward-char # left
|
||||||
|
#bindkey -M menuselect 'k' vi-up-line-or-history # up
|
||||||
|
#bindkey -M menuselect 'l' vi-forward-char # right
|
||||||
|
#bindkey -M menuselect 'j' vi-down-line-or-history # bottom
|
||||||
|
|
||||||
|
## set command prediction from history, see 'man 1 zshcontrib'
|
||||||
|
#zrcautoload predict-on && \
|
||||||
|
#zle -N predict-on && \
|
||||||
|
#zle -N predict-off && \
|
||||||
|
#bindkey "^X^Z" predict-on && \
|
||||||
|
#bindkey "^Z" predict-off
|
||||||
|
|
||||||
|
## press ctrl-q to quote line:
|
||||||
|
#mquote () {
|
||||||
|
# zle beginning-of-line
|
||||||
|
# zle forward-word
|
||||||
|
# # RBUFFER="'$RBUFFER'"
|
||||||
|
# RBUFFER=${(q)RBUFFER}
|
||||||
|
# zle end-of-line
|
||||||
|
#}
|
||||||
|
#zle -N mquote && bindkey '^q' mquote
|
||||||
|
|
||||||
|
## define word separators (for stuff like backward-word, forward-word, backward-kill-word,..)
|
||||||
|
#WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
|
||||||
|
#WORDCHARS=.
|
||||||
|
#WORDCHARS='*?_[]~=&;!#$%^(){}'
|
||||||
|
#WORDCHARS='${WORDCHARS:s@/@}'
|
||||||
|
|
||||||
|
# just type '...' to get '../..'
|
||||||
|
#rationalise-dot() {
|
||||||
|
#local MATCH
|
||||||
|
#if [[ $LBUFFER =~ '(^|/| | |'$'\n''|\||;|&)\.\.$' ]]; then
|
||||||
|
# LBUFFER+=/
|
||||||
|
# zle self-insert
|
||||||
|
# zle self-insert
|
||||||
|
#else
|
||||||
|
# zle self-insert
|
||||||
|
#fi
|
||||||
|
#}
|
||||||
|
#zle -N rationalise-dot
|
||||||
|
#bindkey . rationalise-dot
|
||||||
|
## without this, typing a . aborts incremental history search
|
||||||
|
#bindkey -M isearch . self-insert
|
||||||
|
|
||||||
|
#bindkey '\eq' push-line-or-edit
|
||||||
|
|
||||||
|
## some popular options ##
|
||||||
|
|
||||||
|
## add `|' to output redirections in the history
|
||||||
|
#setopt histallowclobber
|
||||||
|
|
||||||
|
## try to avoid the 'zsh: no matches found...'
|
||||||
|
#setopt nonomatch
|
||||||
|
|
||||||
|
## warning if file exists ('cat /dev/null > ~/.zshrc')
|
||||||
|
#setopt NO_clobber
|
||||||
|
|
||||||
|
## don't warn me about bg processes when exiting
|
||||||
|
#setopt nocheckjobs
|
||||||
|
|
||||||
|
## alert me if something failed
|
||||||
|
#setopt printexitvalue
|
||||||
|
|
||||||
|
## with spelling correction, assume dvorak kb
|
||||||
|
#setopt dvorak
|
||||||
|
|
||||||
|
## Allow comments even in interactive shells
|
||||||
|
#setopt interactivecomments
|
||||||
|
|
||||||
|
## if a new command line being added to the history list duplicates an older
|
||||||
|
## one, the older command is removed from the list
|
||||||
|
#setopt histignorealldups
|
||||||
|
|
||||||
|
## compsys related snippets ##
|
||||||
|
|
||||||
|
## changed completer settings
|
||||||
|
#zstyle ':completion:*' completer _complete _correct _approximate
|
||||||
|
#zstyle ':completion:*' expand prefix suffix
|
||||||
|
|
||||||
|
## another different completer setting: expand shell aliases
|
||||||
|
#zstyle ':completion:*' completer _expand_alias _complete _approximate
|
||||||
|
|
||||||
|
## to have more convenient account completion, specify your logins:
|
||||||
|
#my_accounts=(
|
||||||
|
# {grml,grml1}@foo.invalid
|
||||||
|
# grml-devel@bar.invalid
|
||||||
|
#)
|
||||||
|
#other_accounts=(
|
||||||
|
# {fred,root}@foo.invalid
|
||||||
|
# vera@bar.invalid
|
||||||
|
#)
|
||||||
|
#zstyle ':completion:*:my-accounts' users-hosts $my_accounts
|
||||||
|
#zstyle ':completion:*:other-accounts' users-hosts $other_accounts
|
||||||
|
|
||||||
|
## add grml.org to your list of hosts
|
||||||
|
#hosts+=(grml.org)
|
||||||
|
#zstyle ':completion:*:hosts' hosts $hosts
|
||||||
|
|
||||||
|
## telnet on non-default ports? ...well:
|
||||||
|
## specify specific port/service settings:
|
||||||
|
#telnet_users_hosts_ports=(
|
||||||
|
# user1@host1:
|
||||||
|
# user2@host2:
|
||||||
|
# @mail-server:{smtp,pop3}
|
||||||
|
# @news-server:nntp
|
||||||
|
# @proxy-server:8000
|
||||||
|
#)
|
||||||
|
#zstyle ':completion:*:*:telnet:*' users-hosts-ports $telnet_users_hosts_ports
|
||||||
|
|
||||||
|
## the default grml setup provides '..' as a completion. it does not provide
|
||||||
|
## '.' though. If you want that too, use the following line:
|
||||||
|
#zstyle ':completion:*' special-dirs true
|
||||||
|
|
||||||
|
## aliases ##
|
||||||
|
|
||||||
|
## translate
|
||||||
|
#alias u='translate -i'
|
||||||
|
|
||||||
|
## ignore ~/.ssh/known_hosts entries
|
||||||
|
#alias insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "PreferredAuthentications=keyboard-interactive"'
|
||||||
|
|
||||||
|
|
||||||
|
## global aliases (for those who like them) ##
|
||||||
|
|
||||||
|
#alias -g '...'='../..'
|
||||||
|
#alias -g '....'='../../..'
|
||||||
|
#alias -g BG='& exit'
|
||||||
|
#alias -g C='|wc -l'
|
||||||
|
#alias -g G='|grep'
|
||||||
|
#alias -g H='|head'
|
||||||
|
#alias -g Hl=' --help |& less -r'
|
||||||
|
#alias -g J='|jq'
|
||||||
|
#alias -g K='|keep'
|
||||||
|
#alias -g L='|less'
|
||||||
|
#alias -g LL='|& less -r'
|
||||||
|
#alias -g M='|most'
|
||||||
|
#alias -g N='&>/dev/null'
|
||||||
|
#alias -g R='| tr A-z N-za-m'
|
||||||
|
#alias -g SL='| sort | less'
|
||||||
|
#alias -g S='| sort'
|
||||||
|
#alias -g T='|tail'
|
||||||
|
#alias -g TS='|ts "%F %H:%M:%.S"'
|
||||||
|
#alias -g V='| vim -'
|
||||||
|
|
||||||
|
## instead of global aliase it might be better to use grmls $abk assoc array, whose contents are expanded after pressing ,.
|
||||||
|
#$abk[SnL]="| sort -n | less"
|
||||||
|
|
||||||
|
## get top 10 shell commands:
|
||||||
|
#alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
|
||||||
|
|
||||||
|
## Execute \kbd{./configure}
|
||||||
|
#alias CO="./configure"
|
||||||
|
|
||||||
|
## Execute \kbd{./configure --help}
|
||||||
|
#alias CH="./configure --help"
|
||||||
|
|
||||||
|
## miscellaneous code ##
|
||||||
|
|
||||||
|
## Use a default width of 80 for manpages for more convenient reading
|
||||||
|
#export MANWIDTH=${MANWIDTH:-80}
|
||||||
|
|
||||||
|
## Set a search path for the cd builtin
|
||||||
|
#cdpath=(.. ~)
|
||||||
|
|
||||||
|
## variation of our manzsh() function; pick you poison:
|
||||||
|
#manzsh() { /usr/bin/man zshall | most +/"$1" ; }
|
||||||
|
|
||||||
|
## Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
|
||||||
|
#bash() {
|
||||||
|
# NO_SWITCH="yes" command bash "$@"
|
||||||
|
#}
|
||||||
|
#restart () {
|
||||||
|
# exec $SHELL $SHELL_ARGS "$@"
|
||||||
|
#}
|
||||||
|
|
||||||
|
## Handy functions for use with the (e::) globbing qualifier (like nt)
|
||||||
|
#contains() { grep -q "$*" $REPLY }
|
||||||
|
#sameas() { diff -q "$*" $REPLY &>/dev/null }
|
||||||
|
#ot () { [[ $REPLY -ot ${~1} ]] }
|
||||||
|
|
||||||
|
## get_ic() - queries imap servers for capabilities; real simple. no imaps
|
||||||
|
#ic_get() {
|
||||||
|
# emulate -L zsh
|
||||||
|
# local port
|
||||||
|
# if [[ ! -z $1 ]] ; then
|
||||||
|
# port=${2:-143}
|
||||||
|
# print "querying imap server on $1:${port}...\n";
|
||||||
|
# print "a1 capability\na2 logout\n" | nc $1 ${port}
|
||||||
|
# else
|
||||||
|
# print "usage:\n $0 <imap-server> [port]"
|
||||||
|
# fi
|
||||||
|
#}
|
||||||
|
|
||||||
|
## List all occurrences of programm in current PATH
|
||||||
|
#plap() {
|
||||||
|
# emulate -L zsh
|
||||||
|
# if [[ $# = 0 ]] ; then
|
||||||
|
# echo "Usage: $0 program"
|
||||||
|
# echo "Example: $0 zsh"
|
||||||
|
# echo "Lists all occurrences of program in the current PATH."
|
||||||
|
# else
|
||||||
|
# ls -l ${^path}/*$1*(*N)
|
||||||
|
# fi
|
||||||
|
#}
|
||||||
|
|
||||||
|
## Find out which libs define a symbol
|
||||||
|
#lcheck() {
|
||||||
|
# if [[ -n "$1" ]] ; then
|
||||||
|
# nm -go /usr/lib/lib*.a 2>/dev/null | grep ":[[:xdigit:]]\{8\} . .*$1"
|
||||||
|
# else
|
||||||
|
# echo "Usage: lcheck <function>" >&2
|
||||||
|
# fi
|
||||||
|
#}
|
||||||
|
|
||||||
|
## Download a file and display it locally
|
||||||
|
#uopen() {
|
||||||
|
# emulate -L zsh
|
||||||
|
# if ! [[ -n "$1" ]] ; then
|
||||||
|
# print "Usage: uopen \$URL/\$file">&2
|
||||||
|
# return 1
|
||||||
|
# else
|
||||||
|
# FILE=$1
|
||||||
|
# MIME=$(curl --head $FILE | \
|
||||||
|
# grep Content-Type | \
|
||||||
|
# cut -d ' ' -f 2 | \
|
||||||
|
# cut -d\; -f 1)
|
||||||
|
# MIME=${MIME%$'\r'}
|
||||||
|
# curl $FILE | see ${MIME}:-
|
||||||
|
# fi
|
||||||
|
#}
|
||||||
|
|
||||||
|
## Memory overview
|
||||||
|
#memusage() {
|
||||||
|
# ps aux | awk '{if (NR > 1) print $5;
|
||||||
|
# if (NR > 2) print "+"}
|
||||||
|
# END { print "p" }' | dc
|
||||||
|
#}
|
||||||
|
|
||||||
|
## print hex value of a number
|
||||||
|
#hex() {
|
||||||
|
# emulate -L zsh
|
||||||
|
# if [[ -n "$1" ]]; then
|
||||||
|
# printf "%x\n" $1
|
||||||
|
# else
|
||||||
|
# print 'Usage: hex <number-to-convert>'
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
|
#}
|
||||||
|
|
||||||
|
## log out? set timeout in seconds...
|
||||||
|
## ...and do not log out in some specific terminals:
|
||||||
|
#if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
|
||||||
|
# unset TMOUT
|
||||||
|
#else
|
||||||
|
# TMOUT=1800
|
||||||
|
#fi
|
||||||
|
|
||||||
|
## associate types and extensions (be aware with perl scripts and anwanted behaviour!)
|
||||||
|
#check_com zsh-mime-setup || { autoload zsh-mime-setup && zsh-mime-setup }
|
||||||
|
#alias -s pl='perl -S'
|
||||||
|
|
||||||
|
## ctrl-s will no longer freeze the terminal.
|
||||||
|
#stty erase "^?"
|
||||||
|
|
||||||
|
## you want to automatically use a bigger font on big terminals?
|
||||||
|
#if [[ "$TERM" == "xterm" ]] && [[ "$LINES" -ge 50 ]] && [[ "$COLUMNS" -ge 100 ]] && [[ -z "$SSH_CONNECTION" ]] ; then
|
||||||
|
# large
|
||||||
|
#fi
|
||||||
|
|
||||||
|
## Some quick Perl-hacks aka /useful/ oneliner
|
||||||
|
#bew() { perl -le 'print unpack "B*","'$1'"' }
|
||||||
|
#web() { perl -le 'print pack "B*","'$1'"' }
|
||||||
|
#hew() { perl -le 'print unpack "H*","'$1'"' }
|
||||||
|
#weh() { perl -le 'print pack "H*","'$1'"' }
|
||||||
|
#pversion() { perl -M$1 -le "print $1->VERSION" } # i. e."pversion LWP -> 5.79"
|
||||||
|
#getlinks () { perl -ne 'while ( m/"((www|ftp|http):\/\/.*?)"/gc ) { print $1, "\n"; }' $* }
|
||||||
|
#gethrefs () { perl -ne 'while ( m/href="([^"]*)"/gc ) { print $1, "\n"; }' $* }
|
||||||
|
#getanames () { perl -ne 'while ( m/a name="([^"]*)"/gc ) { print $1, "\n"; }' $* }
|
||||||
|
#getforms () { perl -ne 'while ( m:(\</?(input|form|select|option).*?\>):gic ) { print $1, "\n"; }' $* }
|
||||||
|
#getstrings () { perl -ne 'while ( m/"(.*?)"/gc ) { print $1, "\n"; }' $*}
|
||||||
|
#getanchors () { perl -ne 'while ( m/«([^«»\n]+)»/gc ) { print $1, "\n"; }' $* }
|
||||||
|
#showINC () { perl -e 'for (@INC) { printf "%d %s\n", $i++, $_ }' }
|
||||||
|
#vimpm () { vim `perldoc -l $1 | sed -e 's/pod$/pm/'` }
|
||||||
|
#vimhelp () { vim -c "help $1" -c on -c "au! VimEnter *" }
|
||||||
|
|
||||||
|
## END OF FILE #################################################################
|
||||||
Reference in new issue
Block a user