summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2018-01-30 12:03:20 +0100
committerUrbain Vaes <urbain@vaes.uk>2018-01-30 12:03:20 +0100
commitcb3297183a9da5db43556e1391eac1df508c72d5 (patch)
treec8b97c5542496ec4a90e0f6cb04db083984bceed
parent688260bd74442ad04bf91460f497697e019d8d18 (diff)
Add zsh bindings
-rwxr-xr-xbin/bin/downloads2
-rwxr-xr-xbin/bin/tmux_attach2
-rwxr-xr-xbin/bin/workspace12
-rwxr-xr-xgnupg/.gnupg/gpg-agent.conf7
-rwxr-xr-xgnupg/.gnupg/gpg.conf2
-rw-r--r--zsh/.zsh/.zshrc37
6 files changed, 39 insertions, 23 deletions
diff --git a/bin/bin/downloads b/bin/bin/downloads
index 45dc41f..4a5fa7f 100755
--- a/bin/bin/downloads
+++ b/bin/bin/downloads
@@ -1,5 +1,5 @@
#!/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:")
+target=$(find $download_dir -regex '.*\.\(pdf\|PDF\|djvu\|ps\)' -printf "%T+ %f\n" | sort -r | cut -d' ' -f2- | dmenu -i -p "Open File:")
[[ -n $target ]] && exec zathura "$download_dir/$target"
diff --git a/bin/bin/tmux_attach b/bin/bin/tmux_attach
index 7fd5750..b4b35ee 100755
--- a/bin/bin/tmux_attach
+++ b/bin/bin/tmux_attach
@@ -11,7 +11,7 @@ SESSION=$(echo "$UNION" | dmenu -i -p "Session:" | tr -d '[[:space:]]')
# Rename i3 workspace
! grep -Fxq "$SESSION" <(echo "$ATTACHED_SESSIONS") \
&& command -v i3-msg \
- && i3-msg workspace "$SESSION"
+ && $HOME/bin/workspace gw $SESSION
grep -Fxq "$SESSION" <(echo "$TMUXINATOR") \
&& COMMAND="tmuxinator start $SESSION" \
diff --git a/bin/bin/workspace b/bin/bin/workspace
index 3bf9ea9..b42cc56 100755
--- a/bin/bin/workspace
+++ b/bin/bin/workspace
@@ -11,8 +11,9 @@ workspaces=$(i3-msg -t get_workspaces | awk 'BEGIN {
}' | sort)
act_on_container() {
+
# Get desired workspace
- target=$(echo "$workspaces" | awk '{print $2}' | dmenu -i -p "Select workspace: ")
+ [[ -z $2 ]] && target=$(echo "$workspaces" | awk '{print $2}' | dmenu -i -p "Select workspace: ") || target=$2
# Exit if empty
[[ -z $target ]] && exit
@@ -33,13 +34,14 @@ act_on_workspace() {
focused_number=$(echo "$workspaces" | awk '$3 ~ "true" {print $1}')
focused_name=$(echo "$workspaces" | awk '$3 ~ "true" {print $2}' | cut -d":" -f2)
- [[ $1 = 'n' ]] && new_number=$((focused_number + 1))
- [[ $1 = 'p' ]] && new_number=$((focused_number - 1))
+ [[ $1 = 'n' ]] && new_number=$(( (11+focused_number+1) % 11 ))
+ [[ $1 = 'p' ]] && new_number=$(( (11+focused_number-1) % 11 ))
next=$(echo "${workspaces}" | awk '$1 ~ /'$new_number'/ {print $2}')
i3-msg rename workspace to ${new_number}:${focused_name}
+ # ${variable//pattern} replaces all matches of pattern with nothing
if [[ ! -z "${next// }" ]]; then
name_next=${next#*:}
i3-msg "workspace ${next};\
@@ -49,6 +51,6 @@ act_on_workspace() {
}
# Command to use
-[[ $1 = 'gw' ]] && act_on_container "workspace"
-[[ $1 = 'mc' ]] && act_on_container "move container to workspace"
+[[ $1 = 'gw' ]] && act_on_container "workspace" $2
+[[ $1 = 'mc' ]] && act_on_container "move container to workspace" $2
[[ $1 = 'mw' ]] && act_on_workspace "$2"
diff --git a/gnupg/.gnupg/gpg-agent.conf b/gnupg/.gnupg/gpg-agent.conf
index e10673b..19f273e 100755
--- a/gnupg/.gnupg/gpg-agent.conf
+++ b/gnupg/.gnupg/gpg-agent.conf
@@ -1,4 +1,11 @@
+# Time during which gpg remembers password
default-cache-ttl 20000
+
+# Do not re-ask for key if key has been accessed
max-cache-ttl 360000
+
+# Support ssh
enable-ssh-support
+
+# Program to use
pinentry-program /usr/bin/pinentry-qt
diff --git a/gnupg/.gnupg/gpg.conf b/gnupg/.gnupg/gpg.conf
index 8e32306..5918519 100755
--- a/gnupg/.gnupg/gpg.conf
+++ b/gnupg/.gnupg/gpg.conf
@@ -7,7 +7,7 @@ default-key 716064C0
# Encrypt to myself by default
default-recipient-self
-# Encrypt to myself for mutt (better than fcC_clear)
+# Encrypt to myself for mutt (better than fcc_clear)
encrypt-to 716064C0
# Encoding of metadata
diff --git a/zsh/.zsh/.zshrc b/zsh/.zsh/.zshrc
index 3da2f82..b69c258 100644
--- a/zsh/.zsh/.zshrc
+++ b/zsh/.zsh/.zshrc
@@ -1,15 +1,3 @@
-## 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
@@ -45,15 +33,35 @@ fi
# Autosuggestion
{
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
- bindkey '^y' autosuggest-accept
}
# }}}
+## Overwrite default options {{{
PROMPT='%0~ $ '
# Options
unsetopt histverify
-
+# }}}
+## My bindings {{{
+bindkey -v
+bindkey -a 'k' history-beginning-search-backward
+bindkey -a 'j' history-beginning-search-forward
+bindkey '^?' backward-delete-char # backspace
+bindkey '^N' history-beginning-search-forward
+bindkey '^P' history-beginning-search-backward
+bindkey '^a' beginning-of-line
+bindkey '^b' backward-char
+bindkey '^e' end-of-line
+bindkey '^f' forward-char
+bindkey '^g' jump
+bindkey '^h' backward-delete-char
+bindkey '^k' kill-line
+bindkey '^u' kill-whole-line
+bindkey '^v' visual-mode
+bindkey '^w' backward-kill-word
+bindkey '^y' autosuggest-accept
+bindkey '^z' z
+# }}}
## fzf {{{
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
@@ -66,7 +74,6 @@ z() {
zle && zle reset-prompt
}
zle -N z
-bindkey '^z' z
# }}}
## Colors {{{