diff options
Diffstat (limited to 'user-scripts')
-rwxr-xr-x | user-scripts/copier.sh | 18 | ||||
-rw-r--r-- | user-scripts/edit.sh | 12 | ||||
-rw-r--r-- | user-scripts/fzy.sh | 12 | ||||
-rw-r--r-- | user-scripts/picker.sh | 26 | ||||
-rw-r--r-- | user-scripts/sxiv.sh | 8 | ||||
-rwxr-xr-x | user-scripts/upgrade.sh | 24 |
6 files changed, 100 insertions, 0 deletions
diff --git a/user-scripts/copier.sh b/user-scripts/copier.sh new file mode 100755 index 0000000..a99b88b --- /dev/null +++ b/user-scripts/copier.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +# Description: Copy selection to clipboard +# +# Shell: generic +# Author: Arun Prakash Jana + +# Linux +cat ~/.nnncp | xargs -0 | xsel -bi + +# macOS +# cat ~/.nnncp | xargs -0 | pbcopy + +# Termux +# cat /data/data/com.termux/files/home/.nnncp | xargs -0 | termux-clipboard-set + +# Cygwin +# cat ~/.nnncp | xargs -0 | clip diff --git a/user-scripts/edit.sh b/user-scripts/edit.sh new file mode 100644 index 0000000..f23d7a8 --- /dev/null +++ b/user-scripts/edit.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# Description: Fuzzy find a file in directory subtree with fzy and edit in vim +# +# Shell: generic +# Author: Arun Prakash Jana + +# bash, zsh +vim $(find -type f | fzy) + +# fish +# vim (find -type f | fzy) diff --git a/user-scripts/fzy.sh b/user-scripts/fzy.sh new file mode 100644 index 0000000..ba8cfc9 --- /dev/null +++ b/user-scripts/fzy.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# Description: Fuzzy find a file in directory subtree with fzy and open using xdg-open +# +# Shell: generic +# Author: Arun Prakash Jana + +# bash, zsh +xdg-open $(find -type f | fzy) >/dev/null 2>&1 + +# fish +# xdg-open (find -type f | fzy) >/dev/null 2>&1 diff --git a/user-scripts/picker.sh b/user-scripts/picker.sh new file mode 100644 index 0000000..46168f1 --- /dev/null +++ b/user-scripts/picker.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +# Description: Pick files and pipe the line-separated list to another utility +# +# Shell: generic +# Author: Arun Prakash Jana +# +# Usage: +# Copy this file in your $PATH, make it executable and preferably name it to picker. +# Run commands like: +# ls -l `picker` +# cd `picker` +# vimdiff `picker` +# or, in fish shell: +# ls -l (picker) +# cd (picker) +# vimdiff (picker) +# +# NOTE: This use case is limited to picking files, other functionality may not work as expected. + +nnn -p /tmp/picked + +if [ -f /tmp/picked ]; then + cat /tmp/picked | tr '\0' '\n' + rm /tmp/picked +fi diff --git a/user-scripts/sxiv.sh b/user-scripts/sxiv.sh new file mode 100644 index 0000000..985dce7 --- /dev/null +++ b/user-scripts/sxiv.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +# Description: Open images in current directory in sxiv +# +# Shell: generic +# Author: Arun Prakash Jana + +sxiv -q * >/dev/null 2>&1 & diff --git a/user-scripts/upgrade.sh b/user-scripts/upgrade.sh new file mode 100755 index 0000000..fa044ee --- /dev/null +++ b/user-scripts/upgrade.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Description: Check and update to latest version of nnn manually on Debian 9 Stretch +# +# Shell: bash +# Author: Arun Prakash Jana +# NOTE: This script installs a package, should be issued with admin privilege + +cur=`nnn -v` +new=`curl -s "https://github.com/jarun/nnn/releases/latest" | grep -Eo "[0-9]+\.[0-9]+"` + +if [ $cur_ver == $new_ver ]; then + echo 'Already at latest version' + exit 0 +fi + +# get the package +wget "https://github.com/jarun/nnn/releases/download/v$new/nnn_$new-1_debian9.amd64.deb" + +# install it +dpkg -i nnn_$new-1_debian9.amd64.deb + +# remove the file +rm -rf nnn_$new-1_debian9.amd64.deb |