summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.config/zsh/alias.zsh18
-rwxr-xr-x.local/bin/linkview22
2 files changed, 36 insertions, 4 deletions
diff --git a/.config/zsh/alias.zsh b/.config/zsh/alias.zsh
index d65edd3..b779c07 100644
--- a/.config/zsh/alias.zsh
+++ b/.config/zsh/alias.zsh
@@ -54,7 +54,23 @@ alias v='nvim $(fzf --preview="head -$FZF_PREVIEW_LINES {}")'
vbi() {
p=$(pwd)
cd "$HOME"/.local/bin || return
- nvim $(fzf --preview='head -$FZF_PREVIEW_LINES {}')
+ sc=$(fzf --preview='head -$FZF_PREVIEW_LINES {}')
+ if [ ! "$sc" ]; then
+ cd $p
+ return
+ fi
+ nvim $sc
+ cd $p
+}
+vco() {
+ p=$(pwd)
+ cd "$HOME"/.config || return
+ sc=$(fzf --preview='head -$FZF_PREVIEW_LINES {}')
+ if [ ! "$sc" ]; then
+ cd $p
+ return
+ fi
+ nvim $sc
cd $p
}
pa() {
diff --git a/.local/bin/linkview b/.local/bin/linkview
index 50b04c5..7681c05 100755
--- a/.local/bin/linkview
+++ b/.local/bin/linkview
@@ -8,6 +8,7 @@ use File::Basename qw(basename);
use Cwd qw(cwd);
use Term::ReadKey;
use Term::ANSIColor qw(colored);
+use Capture::Tiny qw(capture);
use constant {
MPVIEW_PATH => '/home/jozan/.local/bin/mpview',
@@ -80,10 +81,20 @@ sub open_link
);
$ret = -1;
if ($a == 2) {
- $ret = system(YTDL_PATH . " -q '" . $url . "' 2>/dev/null");
+ (undef, undef, $ret) = capture {
+ system(
+ YTDL_PATH,
+ $url
+ );
+ };
}
else {
- $ret = system(FETCH_PATH . " -q '" . $url . "' 2>/dev/null");
+ (undef, undef, $ret) = capture {
+ system(
+ FETCH_PATH,
+ $url
+ );
+ };
}
if ($ret == 0) {
system(
@@ -142,7 +153,12 @@ sub open_link
elsif ($a == 8) {
$pid = fork();
if (not $pid) {
- exec(FIREFOX_PATH . ' --kiosk ' . $url . ' >/dev/null 2>&1');
+ capture {
+ exec(
+ FIREFOX_PATH,
+ '--kiosk',
+ $url);
+ };
}
}
elsif ($a == 9) {