summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2018-01-22 18:46:19 +0100
committerUrbain Vaes <urbain@vaes.uk>2018-01-22 18:57:22 +0100
commit688260bd74442ad04bf91460f497697e019d8d18 (patch)
treeebae0bc6df34b0ae7132abfd84da0e46d77c9cd8
parent2a0962d39f66aeff81d1ee41bde4c9d9d7706d08 (diff)
[zsh] Add handy bindings
-rw-r--r--bash/.bash_profile7
-rw-r--r--bash/.bashrc9
-rwxr-xr-xbin/bin/downloads3
-rwxr-xr-xbin/bin/keyboard2
-rwxr-xr-xbin/bin/monitor2
-rwxr-xr-xbin/bin/password2
-rwxr-xr-xbin/bin/tmux_attach5
-rwxr-xr-xbin/bin/username5
-rw-r--r--pkgs/base-packages/PKGBUILD10
-rw-r--r--pkgs/local-packages/PKGBUILD1
-rw-r--r--vim/.vimrc1
-rw-r--r--zsh/.zsh/.zshrc27
12 files changed, 47 insertions, 27 deletions
diff --git a/bash/.bash_profile b/bash/.bash_profile
new file mode 100644
index 0000000..d7297c5
--- /dev/null
+++ b/bash/.bash_profile
@@ -0,0 +1,7 @@
+# Prompt
+if [[ -n $SSH_CLIENT ]]; then
+ PS1=$'\w \e[0;31m$\e[0m '
+else
+ PS1='\w $ '
+fi
+
diff --git a/bash/.bashrc b/bash/.bashrc
index 0e8ede6..23b523d 100644
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -1,11 +1,2 @@
-# Prompt
-
-if [[ -n $SSH_CLIENT ]]; then
- PS1=$'\w\e[0;31m$ \e[0m'
-else
- PS1='\w $ '
-fi
-
-
# FZF
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
diff --git a/bin/bin/downloads b/bin/bin/downloads
index 46d64bd..45dc41f 100755
--- a/bin/bin/downloads
+++ b/bin/bin/downloads
@@ -1,4 +1,5 @@
-#!/bin/bash
+#!/usr/bin/env bash
+
download_dir="$HOME/Downloads"
target=$(find $download_dir -regex '.*\.\(pdf\|PDF\|djvu\|ps\)' -printf "%f\n" | dmenu -i -p "Open File:")
[[ -n $target ]] && exec zathura "$download_dir/$target"
diff --git a/bin/bin/keyboard b/bin/bin/keyboard
index c63f027..ca67828 100755
--- a/bin/bin/keyboard
+++ b/bin/bin/keyboard
@@ -1,3 +1,5 @@
+#!/usr/bin/env bash
+
# Xcape settings
killall -9 xcape
diff --git a/bin/bin/monitor b/bin/bin/monitor
index c3b81db..ce12c04 100755
--- a/bin/bin/monitor
+++ b/bin/bin/monitor
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
XRANDR=$(which xrandr)
diff --git a/bin/bin/password b/bin/bin/password
index 065672b..f94379a 100755
--- a/bin/bin/password
+++ b/bin/bin/password
@@ -1,2 +1,2 @@
-#! /bin/bash
+#!/usr/bin/env bash
passmenu
diff --git a/bin/bin/tmux_attach b/bin/bin/tmux_attach
index 80add99..7fd5750 100755
--- a/bin/bin/tmux_attach
+++ b/bin/bin/tmux_attach
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
SESSIONS=$(tmux list-sessions | cut -d':' -f1)
+ATTACHED_SESSIONS=$(tmux list-sessions | grep attached | cut -d':' -f1)
TMUXINATOR=$(tmuxinator list | sed '1d' | sed 's/\s\+/\n/g')
UNION=$(cat <(echo "$SESSIONS") <(echo "$TMUXINATOR") | sort | uniq | sed "/^$/d")
@@ -8,7 +9,9 @@ SESSION=$(echo "$UNION" | dmenu -i -p "Session:" | tr -d '[[:space:]]')
[[ -n $SESSION ]] || exit
# Rename i3 workspace
-command -v i3-msg && i3-msg workspace "$SESSION"
+! grep -Fxq "$SESSION" <(echo "$ATTACHED_SESSIONS") \
+ && command -v i3-msg \
+ && i3-msg workspace "$SESSION"
grep -Fxq "$SESSION" <(echo "$TMUXINATOR") \
&& COMMAND="tmuxinator start $SESSION" \
diff --git a/bin/bin/username b/bin/bin/username
index 704ea98..b124733 100755
--- a/bin/bin/username
+++ b/bin/bin/username
@@ -1,3 +1,4 @@
-#!/bin/bash
-target=$(find $HOME/.password-store/ -name "*.gpg" -exec sh -c 'echo ${1#*password-store/}' _ {} \; | dmenu -i -p "Get identifier for:")
+#!/usr/bin/env bash
+
+target=$(find $HOME/.password-store/ -name "*.gpg" -printf "%P\n" | dmenu -i -p "Get identifier for:")
basename $target .gpg | xclip -i
diff --git a/pkgs/base-packages/PKGBUILD b/pkgs/base-packages/PKGBUILD
index 344e4fb..3e78e75 100644
--- a/pkgs/base-packages/PKGBUILD
+++ b/pkgs/base-packages/PKGBUILD
@@ -1,3 +1,4 @@
+# yaourt -P && makepkg -i
pkgname=base-packages
pkgver=0
pkgrel=1
@@ -10,8 +11,11 @@ depends=(alsa-utils autocutsel autopep8 awesome-terminal-fonts biber cmus
networkmanager-pptp nmap npm pandoc pass pkgfile pulseaudio pulseaudio-alsa
python-jedi python-matplotlib python-neovim python-pip python-unidecode
python2-matplotlib python2-neovim qemu qutebrowser redshift ripgrep rofi
- rsync rxvt-unicode shellcheck sshfs stow surfraw texlive-most tig tldr tmux
- ttf-dejavu ttf-ubuntu-font-family urxvt-perls vifm weechat xcape xclip
- xdotool xfce4-screenshooter xorg-server xorg-server-common xorg-setxkbmap
+ rsync rxvt-unicode shellcheck sshfs stow surfraw texlive-bibtexextra
+ texlive-core texlive-fontsextra texlive-formatsextra texlive-games
+ texlive-humanities texlive-latexextra texlive-pictures texlive-pstricks
+ texlive-publishers texlive-science tig tldr tmux ttf-dejavu
+ ttf-ubuntu-font-family urxvt-perls vifm weechat xcape xclip xdotool
+ xfce4-screenshooter xorg-server xorg-server-common xorg-setxkbmap
xorg-xbacklight xorg-xev xorg-xkill xorg-xmodmap xorg-xrandr xorg-xrdb xsel
youtube-dl zathura zathura-djvu zathura-pdf-mupdf zathura-ps zenity zsh)
diff --git a/pkgs/local-packages/PKGBUILD b/pkgs/local-packages/PKGBUILD
index 4ec504f..9ac2a07 100644
--- a/pkgs/local-packages/PKGBUILD
+++ b/pkgs/local-packages/PKGBUILD
@@ -1,3 +1,4 @@
+# yaourt -P && makepkg -i
pkgname=local-packages
pkgver=0
pkgrel=1
diff --git a/vim/.vimrc b/vim/.vimrc
index 2afe954..55737ac 100644
--- a/vim/.vimrc
+++ b/vim/.vimrc
@@ -358,6 +358,7 @@ augroup vimrc
au FileType gnuplot setlocal commentstring=#%s
au FileType freefem comp freefem
au FileType dirvish setlocal relativenumber
+ au FileType dirvish setlocal errorformat=%f
au FileType tex set spell
augroup END
diff --git a/zsh/.zsh/.zshrc b/zsh/.zsh/.zshrc
index 7bce5fe..3da2f82 100644
--- a/zsh/.zsh/.zshrc
+++ b/zsh/.zsh/.zshrc
@@ -1,3 +1,15 @@
+## My bindings {{{
+bindkey -v
+bindkey -a 'k' history-beginning-search-backward
+bindkey -a 'j' history-beginning-search-forward
+bindkey '^P' history-beginning-search-backward
+bindkey '^N' history-beginning-search-forward
+bindkey '^b' backward-char
+bindkey '^f' forward-char
+bindkey '^a' beginning-of-line
+bindkey '^e' end-of-line
+bindkey '^v' visual-mode
+# }}}
## zgen {{{
[ ! -d ~/.zsh/zgen ] && git clone https://github.com/tarjoilija/zgen.git ~/.zsh/zgen
@@ -13,10 +25,10 @@ if ! zgen saved; then
# Oh-my-zsh plugins
zgen oh-my-zsh plugins/git
- zgen oh-my-zsh plugins/vi-mode
# Navigation plugins
zgen load urbainvaes/fzf-marks
+ # zgen load wfxr/fzf-marks
# Other plugins
zgen load rupa/z
@@ -37,16 +49,8 @@ fi
}
# }}}
-
-# Custom key bindings for built-in widgets
-bindkey -a 'k' history-beginning-search-backward
-bindkey -a 'j' history-beginning-search-forward
-bindkey '^P' history-beginning-search-backward
-bindkey '^N' history-beginning-search-forward
-
PROMPT='%0~ $ '
-
# Options
unsetopt histverify
@@ -124,6 +128,11 @@ alias rd='cd $(git rev-parse --show-toplevel)'
alias mi='make install'
alias mc='make clean'
alias mca='make clean-all'
+
+# Applications
alias -s pdf='xdg-open'
+# Global
+alias -g grep='grep --color=auto --exclude-dir={.git,.hg}'
+
# }}}