From 12ce9451ee1c24ad245d33e8944ba77a1108b5b2 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Thu, 18 Apr 2019 19:41:39 +0530 Subject: Move nlaunch from user-scripts --- README.md | 2 +- scripts/nlaunch/nlaunch | 20 ++++++++++++++++++++ user-scripts/README.md | 1 - user-scripts/nlaunch | 18 ------------------ 4 files changed, 21 insertions(+), 20 deletions(-) create mode 100755 scripts/nlaunch/nlaunch delete mode 100755 user-scripts/nlaunch diff --git a/README.md b/README.md index 3b07b03..ab24f6a 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ Option completion scripts for Bash, Fish and Zsh can be found in respective subd 2. Configure [cd on quit](https://github.com/jarun/nnn/wiki/hacking-nnn#cd-on-quit). 3. Optionally open all text files in `$EDITOR` (fallback vi): `export NNN_USE_EDITOR=1` 4. Run `n`. -5. To use `nnn` as a GUI app launcher with fuzzy selection menu, drop [`nlaunch`](https://github.com/jarun/nnn/blob/master/user-scripts/nlaunch) somewhere in your `$PATH`. +5. To use `nnn` as a GUI app launcher with fuzzy selection menu, drop [`nlaunch`](https://github.com/jarun/nnn/blob/master/scripts/nlaunch/nlaunch) somewhere in your `$PATH`. Note that the launcher requires fzy. 6. Don't memorize keys. Arrows, / and q suffice. Press ? for help on keyboard shortcuts anytime. - For additional functionality [setup custom scripts](#user-scripts). diff --git a/scripts/nlaunch/nlaunch b/scripts/nlaunch/nlaunch new file mode 100755 index 0000000..18d0f8b --- /dev/null +++ b/scripts/nlaunch/nlaunch @@ -0,0 +1,20 @@ +#!/usr/bin/env sh + +# Description: Fuzzy find executables in $PATH and launch an application. +# stdin, stdout, stderr are suppressed so CLI utilities exit silently. +# Works as an independent app launcher. +# +# Requires fzy. +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +IFS=':' + +get_selection() { + ls -H $PATH | sort | fzy +} + +if selection=$( get_selection ); then + "$selection" 2>/dev/null 1>/dev/null & +fi diff --git a/user-scripts/README.md b/user-scripts/README.md index 5b481c3..40aae40 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -8,7 +8,6 @@ | imgur | bash | [imgur](https://github.com/jomo/imgur-screenshot) | Upload an image to imgur | | kdeconnect | sh | kdeconnect-cli | Send selected files to an Android device | | ndiff | sh | vimdiff | File and directory diff for selection | -| nlaunch | sh | fzy | Drop-down app launcher. Copy in `$PATH`; fallback regular prompt | | nwal | sh | nitrogen | Set the selected image as wallpaper using nitrogen | | paste | sh | [pastebinit](https://launchpad.net/pastebinit) | Paste contents of current (text) file to paste.ubuntu.com | | picker | sh | nnn | Pick files and pipe the newline-separated list to another utility | diff --git a/user-scripts/nlaunch b/user-scripts/nlaunch deleted file mode 100755 index 7448ca9..0000000 --- a/user-scripts/nlaunch +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env sh - -# Description: Fuzzy find executables in $PATH and launch an application. -# stdin, stdout, stderr are suppressed so CLI utilities exit silently. -# Works as an independent app launcher. -# -# Shell: POSIX compliant -# Author: Arun Prakash Jana - -IFS=':' - -get_selection() { - ls -H $PATH | sort | fzy -} - -if selection=$( get_selection ); then - "$selection" 2>/dev/null 1>/dev/null & -fi -- cgit v1.2.3-70-g09d2