From b323c66209784458352ce35c05c268e21c6b5d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Tue, 30 Sep 2014 19:55:51 +0200 Subject: [PATCH] Lots of changes. --- conky/conky/clock.conkyrc | 2 +- git/.gitignore | 1 + git/gitk | 61 -------------- i3/i3/config | 4 +- i3/i3/config.d/notebook.config | 4 +- i3/i3/scripts/status.d/battery.bash | 4 +- i3/i3/scripts/status.d/sysinfo.bash | 2 +- mpd/mpd/mpd.conf | 2 +- scripts/setup.bash | 2 +- setup/packages-foreign.list | 9 +-- setup/packages-native.list | 57 ++++++------- tmux/tmux.conf | 43 +++++++--- vim/vimrc | 70 ++++++++-------- x/Xresources | 4 +- x/xinitrc | 21 ++--- zsh/zprofile | 5 +- zsh/zshrc | 119 ++++++++++++++++++++++++---- 17 files changed, 229 insertions(+), 181 deletions(-) create mode 100644 git/.gitignore delete mode 100644 git/gitk diff --git a/conky/conky/clock.conkyrc b/conky/conky/clock.conkyrc index b133b64..45aabf0 100644 --- a/conky/conky/clock.conkyrc +++ b/conky/conky/clock.conkyrc @@ -248,7 +248,7 @@ use_xft yes TEXT ${font Ubuntu:size=112:light}${alignr}${time %R}${font} -${font Ubuntu:size=30:light}_______________________${font} +${alignr}${font Ubuntu:size=30:light}__________________________________________________________${font} ${font Ubuntu:size=30:light}${alignr}${time %A, %d %B %Y}${font} diff --git a/git/.gitignore b/git/.gitignore new file mode 100644 index 0000000..f5fff02 --- /dev/null +++ b/git/.gitignore @@ -0,0 +1 @@ +gitk diff --git a/git/gitk b/git/gitk deleted file mode 100644 index 5a67d0a..0000000 --- a/git/gitk +++ /dev/null @@ -1,61 +0,0 @@ -set mainfont {sans 9} -set textfont {monospace 9} -set uifont {sans 9 bold} -set tabstop 8 -set findmergefiles 0 -set maxgraphpct 50 -set maxwidth 16 -set cmitmode patch -set wrapcomment none -set autoselect 1 -set autosellen 40 -set showneartags 1 -set maxrefs 20 -set hideremotes 0 -set showlocalchanges 1 -set datetimeformat {%Y-%m-%d %H:%M:%S} -set limitdiffs 1 -set uicolor grey85 -set want_ttk 1 -set bgcolor white -set fgcolor black -set uifgcolor black -set uifgdisabledcolor #999 -set colors {green red blue magenta darkgrey brown orange} -set diffcolors {red "#00a000" blue} -set mergecolors {red blue green purple brown "#009090" magenta "#808000" "#009000" "#ff0080" cyan "#b07070" "#70b0f0" "#70f0b0" "#f0b070" "#ff70b0"} -set markbgcolor #e0e0ff -set diffcontext 3 -set selectbgcolor gray85 -set foundbgcolor yellow -set currentsearchhitbgcolor orange -set extdifftool meld -set perfile_attrs 0 -set headbgcolor green -set headfgcolor black -set headoutlinecolor black -set remotebgcolor #ffddaa -set tagbgcolor yellow -set tagfgcolor black -set tagoutlinecolor black -set reflinecolor black -set filesepbgcolor #aaaaaa -set filesepfgcolor black -set linehoverbgcolor #ffff80 -set linehoverfgcolor black -set linehoveroutlinecolor black -set mainheadcirclecolor yellow -set workingfilescirclecolor red -set indexcirclecolor green -set circlecolors {white blue gray blue blue} -set linkfgcolor blue -set circleoutlinecolor black -set geometry(main) 1024x516+0+0 -set geometry(state) normal -set geometry(topwidth) 1024 -set geometry(topheight) 210 -set geometry(pwsash0) "519 1" -set geometry(pwsash1) "844 1" -set geometry(botwidth) 550 -set geometry(botheight) 301 -set permviews {} diff --git a/i3/i3/config b/i3/i3/config index 395fa1e..a81c1cb 100644 --- a/i3/i3/config +++ b/i3/i3/config @@ -19,7 +19,7 @@ set $mod Mod4 # The default terminal - set $terminal urxvt + set $terminal urxvtc #-e bash -c "tmux -q has-session && exec tmux attach-session -d || exec tmux new-session -n$USER -s$USER@$HOSTNAME" # Path to the exit script set $path_i3exit ~/.i3/scripts/i3exit.bash @@ -251,7 +251,7 @@ popup_during_fullscreen leave_fullscreen # Do not always wrap but change to a container on the same level instead - force_focus_wrapping no + force_focus_wrapping yes force_xinerama no diff --git a/i3/i3/config.d/notebook.config b/i3/i3/config.d/notebook.config index f221616..0f1c42a 100644 --- a/i3/i3/config.d/notebook.config +++ b/i3/i3/config.d/notebook.config @@ -4,8 +4,8 @@ bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle bindsym XF86AudioRaiseVolume exec --no-startup-id bash $HOME/.i3/scripts/pa-volume.bash set-vol +5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash" bindsym XF86AudioLowerVolume exec --no-startup-id bash $HOME/.i3/scripts/pa-volume.bash set-vol -5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash" # keys seemingly switched -bindsym XF86MonBrightnessUp exec --no-startup-id sudo /usr/local/bin/backlight.sh -10 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash" -bindsym XF86MonBrightnessDown exec --no-startup-id sudo /usr/local/bin/backlight.sh +10 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash" +bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -dec 5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash" +bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -inc 5 ; exec --no-startup-id "bash $HOME/.i3/scripts/update-status.bash" bindsym XF86AudioPlay exec --no-startup-id mpc toggle diff --git a/i3/i3/scripts/status.d/battery.bash b/i3/i3/scripts/status.d/battery.bash index fd88a30..70f0528 100755 --- a/i3/i3/scripts/status.d/battery.bash +++ b/i3/i3/scripts/status.d/battery.bash @@ -53,12 +53,12 @@ conky() { if threshold2 ; then if [[ ! -f "$PATH_WARN_2" ]] ; then echo > "$PATH_WARN_2" - notify-send --icon dialog-warning "Battery below ${THRESHOLD2}%" + notify-send --icon dialog-warning "Battery below ${THRESHOLD2}%" --expire-time 0 fi elif threshold1 ; then if [[ ! -f "$PATH_WARN_1" ]] ; then echo > "$PATH_WARN_1" - notify-send --icon dialog-warning "Battery below ${THRESHOLD1}%" + notify-send --icon dialog-warning "Battery below ${THRESHOLD1}%" --expire-time 30000 fi fi fi diff --git a/i3/i3/scripts/status.d/sysinfo.bash b/i3/i3/scripts/status.d/sysinfo.bash index 3895cd1..b34dbeb 100755 --- a/i3/i3/scripts/status.d/sysinfo.bash +++ b/i3/i3/scripts/status.d/sysinfo.bash @@ -22,7 +22,7 @@ echo "MEM:" echo "${memused}MB / ${memtotal}MB ($(( $memused * 100 / $memtotal ))%) used" echo "" echo "PROCS:" -(echo "x x cpu% mem% x x x x x x command" ; ps aux | sort -nrk 3 | tr -s " " | cut -d " " -f -11 | uniq -uf 10 | head -10) | cut -d " " -f 3,4,11 | column -t +(echo "x x CPU% MEM% x x x x x x COMMAND" ; ps aux | grep -v '^USER' | sort -nrk 3 | tr -s " " | cut -d " " -f -11 | uniq -uf 10 | head -10) | cut -d " " -f 3,4,11 | column -t echo "" echo "STORAGE:" df -hT --type=btrfs --type=ext4 --total diff --git a/mpd/mpd/mpd.conf b/mpd/mpd/mpd.conf index 971cd7f..8b3532d 100644 --- a/mpd/mpd/mpd.conf +++ b/mpd/mpd/mpd.conf @@ -288,7 +288,7 @@ audio_output { # This is necessary for visualization in ncmpcpp audio_output { type "fifo" - name "mpd fifo" + name "visualizer feed" path "/tmp/mpd.fifo" format "44100:16:2" } diff --git a/scripts/setup.bash b/scripts/setup.bash index 1dbfdbd..d35d982 100755 --- a/scripts/setup.bash +++ b/scripts/setup.bash @@ -14,7 +14,7 @@ backup_dir="$HOME/.dotfiles.bak/" # the following folders inside $config_dir will be inspected and the # contents symlinked: -symlink_folders='git i3 vim zsh conky x mpd ncmpcpp' +symlink_folders='git i3 vim zsh conky x mpd ncmpcpp tmux' MAPPING_SEPARATOR='::' diff --git a/setup/packages-foreign.list b/setup/packages-foreign.list index 1e9de30..b0d6027 100644 --- a/setup/packages-foreign.list +++ b/setup/packages-foreign.list @@ -1,19 +1,18 @@ -chromium-libpdf -chromium-pepper-flash cower dmenu2 dropbox fontconfig-infinality-git freetype2-infinality-git +google-earth6 gtk-theme-boje +i3-git imgurbash j4-dmenu-desktop lib32-freetype2-infinality-git +linssid pacaur pasystray-git -thunar-dropbox -thunar-shares-plugin -thunar-vfs ttf-font-icons +ttf-ms-fonts virtualbox-ext-oracle yad diff --git a/setup/packages-native.list b/setup/packages-native.list index 83442a4..9abda9e 100644 --- a/setup/packages-native.list +++ b/setup/packages-native.list @@ -1,15 +1,10 @@ abs acpi -alsa-utils -atool -atop blender btrfs-progs bzr chromium chrony -clementine -cmake codespell conky cowsay @@ -20,39 +15,34 @@ deluge dialog dnsutils dosfstools -dzen2 +easy-rsa efibootmgr encfs -envoy -expac feh -filezilla firefox flake8 +flashplugin fortune-mod fuseiso +gcc-multilib gcolor2 -gimp +ghostscript git -gnuplot -gparted gptfdisk grub gsmartcontrol -gvim hardinfo +hdparm hedgewars highlight htop -i3-wm i3lock i3status -icedtea-web-java7 +icedtea-web ifplugd iftop -imagemagick -inkscape iotop +iperf lib32-alsa-plugins lib32-fakeroot lib32-intel-dri @@ -62,24 +52,22 @@ lib32-ncurses lib32-openal lib32-qtcurve-gtk2 lib32-qtcurve-qt4 -libreoffice-calc -libreoffice-draw -libreoffice-gnome -libreoffice-impress -libreoffice-math -libreoffice-postgresql-connector -libreoffice-writer +libreoffice-fresh libva-intel-driver +libvirt linux-headers lsb-release +lsof lxappearance mousepad mpc mpd -mplayer -mtools ncmpcpp net-tools +nmap +ntfs-3g +openbsd-netcat +openvpn p7zip pavucontrol pdnsd @@ -88,8 +76,8 @@ powertop puddletag pulseaudio pulseaudio-alsa -putty pv +pygtksourceview2 python-docs python-pip python-pylint @@ -107,32 +95,33 @@ redshift reflector rsync rxvt-unicode +rxvt-unicode-terminfo samba scrot skype -smplayer sshfs steam +stress subversion -thunar -thunar-archive-plugin -thunar-media-tags-plugin -thunar-volman thunderbird tk tmux +traceroute tree ttf-dejavu ttf-ubuntu-font-family -tumbler +unclutter units unrar +vim +virt-manager virtualbox virtualbox-guest-iso virtualbox-host-modules vlc vnstat wget +whois wine wine-mono wine_gecko @@ -145,7 +134,6 @@ xclip xcursor-vanilla-dmz xf86-input-synaptics xf86-video-intel -xfce4-panel xorg-server xorg-sessreg xorg-utils @@ -163,4 +151,5 @@ xorg-xrefresh youtube-dl zathura zathura-pdf-mupdf +zim zsh diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 9fe721e..b1840b6 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,36 +1,40 @@ -#set -g default-terminal 'screen-256color' +set -g default-terminal 'screen-256color' set -g utf8 on set -g status-utf8 on +set -g default-command "${SHELL}" + set -g prefix C-a unbind C-b bind C-a send-prefix -bind-key r source-file ~/.tmux.conf +set -s escape-time 0 +set-window-option -g aggressive-resize on + +setw -g mode-mouse on +# set -g mouse-select-pane on +# set -g mouse-resize-pane on +# set -g mouse-select-window on + +set -g mode-keys vi set-option -g renumber-windows on -bind-key C-a last-window - bind-key k confirm kill-window bind-key K confirm kill-server -bind / command-prompt "split-window -h 'exec man %%'" -bind + split-window -h "exec htop" - bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R -bind-key y set-option status - set -g bell-action any set -g history-limit 5000 set -g base-index 1 +set-window-option -g pane-base-index 1 set -g status-position bottom set -g status-justify left @@ -40,24 +44,26 @@ set -g status-bg '#222222' set -g status-fg white set -g status-attr default + set-window-option -g window-status-fg '#FFFFFF' set-window-option -g window-status-bg '#444444' set-window-option -g window-status-attr none set-window-option -g window-status-format ' #I: #W #F ' -set-window-option -g window-status-current-fg '#FFFFFF' +set-window-option -g window-status-current-fg '#000000' set-window-option -g window-status-current-bg red set-window-option -g window-status-current-attr bold set-window-option -g window-status-current-format ' #I: #W #F ' set-window-option -g monitor-activity on -set -g visual-activity on +#set -g visual-activity on -set-window-option -g automatic-rename +set-window-option -g automatic-rename on +set-window-option -g automatic-rename-format '#{pane_current_command}' set-window-option -g window-status-separator ' ' -set -g status-right '#[fg=colour226]#(uptime | cut -d ',' -f 2-)' +set -g status-right '' ##[fg=colour226]#(uptime | cut -d ',' -f 2-)' set -g message-fg white set -g message-bg black @@ -75,3 +81,14 @@ unbind % unbind '"' bind-key s split-window -v bind-key v split-window -h + +bind-key -n S-down new-window +bind-key -n S-left prev +bind-key -n S-right next +bind-key -n C-j detach + +bind-key -n C-F1 command-prompt "split-window -h 'exec man %%'" +bind-key -n C-F2 split-window -h "exec htop" +bind-key -n C-F3 set-option status + +bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf sourced" diff --git a/vim/vimrc b/vim/vimrc index 7fe6fe0..8efaf87 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -28,79 +28,86 @@ set nocompatible " setup of vundle filetype off -set rtp+=~/.vim/bundle/vundle/ -call vundle#rc() -Bundle 'gmarik/vundle' + +set rtp+=~/.vim/bundle/Vundle.vim/ + +call vundle#begin() + +Plugin 'gmarik/vundle' " solarized color theme -Bundle 'altercation/vim-colors-solarized' +Plugin 'altercation/vim-colors-solarized' " monokai color theme -Bundle 'sickill/vim-monokai' +Plugin 'sickill/vim-monokai' " display the undo history in a graph -Bundle 'mbbill/undotree' +Plugin 'mbbill/undotree' " tree explorer plugin -Bundle 'scrooloose/nerdtree' +Plugin 'scrooloose/nerdtree' " quoting/parenthesizing made simple -Bundle 'tpope/vim-surround' +Plugin 'tpope/vim-surround' " better commenting -Bundle 'tpope/vim-commentary' +Plugin 'tpope/vim-commentary' " nice auto completion -Bundle 'Valloric/YouCompleteMe' +Plugin 'Valloric/YouCompleteMe' " nice text alignment -Bundle 'godlygeek/tabular' +Plugin 'godlygeek/tabular' " status line plugin -Bundle 'bling/vim-airline' +Plugin 'bling/vim-airline' " date/time support for CTRL-x and CTRL-a -Bundle 'tpope/vim-speeddating' +Plugin 'tpope/vim-speeddating' " git integration -Bundle 'tpope/vim-fugitive' +Plugin 'tpope/vim-fugitive' " buffer expolorer -"Bundle 'fholgado/minibufexpl.vim' +"Plugin 'fholgado/minibufexpl.vim' " shows a code outline -Bundle 'majutsushi/tagbar' +Plugin 'majutsushi/tagbar' " python specific stuff -Bundle 'klen/python-mode' +Plugin 'klen/python-mode' " incremental visual mode -Bundle 'terryma/vim-expand-region' +Plugin 'terryma/vim-expand-region' " splitting single line code -Bundle 'AndrewRadev/splitjoin.vim' +Plugin 'AndrewRadev/splitjoin.vim' " motion to two characters -Bundle 'justinmk/vim-sneak' +Plugin 'justinmk/vim-sneak' " alignment operator -Bundle 'tommcdo/vim-lion' +Plugin 'tommcdo/vim-lion' -Bundle 'wincent/Command-T' +Plugin 'wincent/Command-T' -Bundle 'sjl/gundo.vim' +Plugin 'sjl/gundo.vim' -Bundle 'kien/ctrlp.vim' +Plugin 'kien/ctrlp.vim' -Bundle 'PeterRincker/vim-argumentative' +Plugin 'PeterRincker/vim-argumentative' -Bundle 'wellle/targets.vim' +Plugin 'wellle/targets.vim' -Bundle 'Lokaltog/vim-easymotion' +Plugin 'Lokaltog/vim-easymotion' -Bundle 'terryma/vim-multiple-cursors' +Plugin 'terryma/vim-multiple-cursors' -Bundle 'flazz/vim-colorschemes' +Plugin 'flazz/vim-colorschemes' + +call vundle#end() + +filetype plugin indent on set t_Co=256 @@ -126,8 +133,6 @@ let g:solarized_visibility="normal" syntax enable colorscheme monokai -filetype plugin indent on - " setup for vim-airline let g:airline_theme='powerlineish' let g:airline_left_sep='' @@ -170,6 +175,7 @@ set history=1000 " history length for commands, defaults to set nobackup " do not create a backup set nowritebackup +set backupcopy=no set noshowmode " do not show the current mode, as this @@ -341,8 +347,8 @@ nnoremap l nnoremap :NERDTreeToggle nnoremap :TagbarToggle - " Autosave views when closing and restoring when opening again. +set viewdir=~/.vim/view autocmd BufWinLeave *.* mkview autocmd BufWinEnter *.* silent loadview diff --git a/x/Xresources b/x/Xresources index 9993ab4..02351f8 100644 --- a/x/Xresources +++ b/x/Xresources @@ -7,7 +7,7 @@ URxvt.font: xft:DejaVu Sans Mono:size=10.5 URxvt.letterSpace: -1 ! clickable URLs -URxvt.perl-ext-common: default,matcher +URxvt.perl-ext-common: default,matcher,selection-to-clipboard URxvt.url-launcher: /usr/bin/chromium URxvt.matcher.button: 1 @@ -24,7 +24,7 @@ URxvt.termName: urxvt URxvt.cursorBlink: true URxvt.transparent: true -URxvt.shading: 15 +URxvt.shading: 10 ! Solarized color scheme for the X Window System ! diff --git a/x/xinitrc b/x/xinitrc index ff698df..7361152 100755 --- a/x/xinitrc +++ b/x/xinitrc @@ -55,7 +55,7 @@ wallchanger_pidfile="$RUNDIR/wallchanger.pid" wallpaper_directory="$HOME/pictures/wallpaper/misc" wallpaper_logfile="$LOGDIR/wallpaper.log" wallpaper_fallback="$HOME/.i3/data/wallpaper/" -wallpaper_interval="900" +wallpaper_interval="10800" # redshift settings redshift_lat_long="49.5:11" @@ -69,16 +69,19 @@ else log "mpd already running, will not start another instance" fi -## start the urxvt daemon -#if pidof urxvtd &>/dev/null ; then -# log "urxvtd already running" -#else -# log "starting urxvtd" -# urxvtd -q --fork -#fi + start the urxvt daemon +if pgrep urxvtd >/dev/null 2>&1; then + log "urxvtd already running" +else + log "starting urxvtd" + urxvtd -q -q -o +fi + +log "starting zim in tray" +zim --plugin trayicon log "starting conky clock on desktop" -(sleep 5 && conky -c "$HOME/.conky/clock.conkyrc" &>> $LOGFILE) & +(sleep 3 && conky -c "$HOME/.conky/clock.conkyrc" &>> $LOGFILE) & # start the pulseaudio volume control tray applet log "starting pasystray" diff --git a/zsh/zprofile b/zsh/zprofile index 70b7059..3195693 100644 --- a/zsh/zprofile +++ b/zsh/zprofile @@ -1 +1,4 @@ -[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx +# exec startx breaks some logind fuckery, without exec it works +tmux start-server & +(eval $(ssh-agent) ; ssh-add) >/dev/null 2>&1 & +[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx diff --git a/zsh/zshrc b/zsh/zshrc index 9df9430..ac223bc 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -6,20 +6,38 @@ colors autoload -U compinit compinit +zstyle ':completion:*' menu select +setopt completealiases + +#[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" history-beginning-search-backward +#[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" history-beginning-search-forward + + +#DIRSTACKFILE="$HOME/.cache/zsh/dirs" +#if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then +# dirstack=( ${(f)"$(< $DIRSTACKFILE)"} ) +# [[ -d $dirstack[1] ]] && cd $dirstack[1] +#fi +#chpwd() { +# print -l $PWD ${(u)dirstack} >$DIRSTACKFILE +#} +# +#DIRSTACKSIZE=20 +# +#setopt autopushd pushdsilent pushdtohome +# +### Remove duplicate entries +#setopt pushdignoredups +# +### This reverts the +/- operators. +#setopt pushdminus + +#source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh HISTSIZE=10000 SAVEHIST=10000 HISTFILE="$HOME/.zsh_history" -PROMPT="%{$fg[white]%}╭─%{$fg[green]%}%M %{$fg[red]%}▶ %{$fg[yellow]%}%~ -%{$fg[white]%}╰─%B%#%b " -RPROMPT="%{$fg[red]%}%? %{$fg[white]%}%*%{$reset_color%}" - -PATH="$PATH:$HOME/bin" - -envoy --agent ssh-agent -source <(envoy --print sh) - man() { env LESS_TERMCAP_mb=$'\E[01;31m' \ LESS_TERMCAP_md=$'\E[01;38;5;74m' \ @@ -34,6 +52,9 @@ man() { ### VARIABLES export EDITOR="vim" export VISUAL="vim" +export PATH="$PATH:$HOME/bin" +export BROWSER="firefox" + ### BOOKMARKS bm() { @@ -72,18 +93,19 @@ setopt LONG_LIST_JOBS bindkey -e -[[ $TERM == "urxvt" ]] && export TERM="rxvt-unicode" +[[ $TERM == "urxvt" ]] && export TERM="rxvt-unicode" +[[ $TERM == "screen" ]] && export TERM="screen-256color" ### ALIASES alias su="su -" -LS_HIDE="*.py[co]" +#LS_HIDE="*.py[co]" # --dereference-command-line -alias ls="ls --group-directories-first --classify --color=auto --hide=\"$LS_HIDE\"" +alias ls="ls --group-directories-first --classify --color=auto" #--hide=\"$LS_HIDE\"" -alias ll='ls -AlF' +alias ll='ls -AlFh' alias la='ls -A' alias grep='grep --color=auto' @@ -140,7 +162,7 @@ slideshow() { } cd() { - builtin cd $* && ls + builtin cd "$@" && ls } mount() { @@ -231,3 +253,72 @@ rmext() { serve() { python3 -m http.server 8800 } + +manpdf() { + [[ -z "$1" ]] && { echo >&2 "$(man)" ; exit 1 ; } + man -t "$1" | ps2pdf - - | zathura - +} + +myip4() { + curl "http://ipv4.icanhazip.com" +} + +myip6() { + curl "http://ipv6.icanhazip.com" 1>/dev/null 2>&1 || echo "no ip6" +} + +alias myip="myip4" + +alias clip="xclip -selection clipboard" +alias clipo="xclip -out -selection clipboard" + +alias tmux="tmux -2" + +alias tm="tmux" +alias tml="tmux list-sessions" +alias tma="tmux attach-session" +alias tmc="tmux switch-client -t" + +#echo $(date +%T) >> $HOME/tmux-debug.log +#[[ $- != *i* ]] && return +#[[ -z "$TMUX" ]] && exec tmux -2 + +alias note="zim --plugin quicknote --notebook ~/wiki/zim/notes --page ":quicknotes" --append true" + +alias spm="sudo pacman"s + +alias chmod="chmod -c" +alias chown="chown -c" + +alias rgrep="grep -r" + +autoload -Uz vcs_info +zstyle ':vcs_info:*' enable git hg +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:git*' formats "%{${fg[cyan]}%}[%{${fg[green]}%}%s%{${fg[cyan]}%}][%{${fg[blue]}%}%r/%S%%{${fg[cyan]}%}][%{${fg[blue]}%}%b%{${fg[yellow]}%}%m%u%c%{${fg[cyan]}%}]%{$reset_color%}" + +setprompt() { + setopt prompt_subst + + if [[ -n "$SSH_CLIENT" ]]; then + SSHINFO="[ssh] " + else + SSHINFO="" + fi + +# if git status ; then +# GITINFO=" " +# else +# GITINFO="" +# fi + + PROMPT="%{$fg[white]%}┌─ %{$fg[green]%}%n@%M%{$fg[white]%} ─ %{$fg[cyan]%}%*%{$fg[white]%} ─ %{%B$fg[yellow]%}%~${vcs_info_msg_0_}%{%b%} +%{$fg[white]%}└─ %B${PINFO}%#%b " + RPROMPT="" +} + +setprompt + +gensshport() { + echo $(( $(od -v -An -N4 -tu4 < /dev/urandom) % (2**16-2**10) + 2**10 )) +}