From bc4df04626b3d7029354793b93d50bafe95caa68 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 31 Mar 2024 18:51:42 -0500 Subject: [PATCH] refactor(zsh): improve `img` alias --- dots/.config/nvim/lua/neovide.lua | 3 +++ dots/.config/zsh/config/profile/profile/aliases.zsh | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dots/.config/nvim/lua/neovide.lua b/dots/.config/nvim/lua/neovide.lua index 248e4dba..816917a7 100644 --- a/dots/.config/nvim/lua/neovide.lua +++ b/dots/.config/nvim/lua/neovide.lua @@ -29,3 +29,6 @@ vim.keymap.set({ "n" }, "", "vertical belowright terminal", vim.keymap.set({ "n" }, "", "vertical aboveleft terminal", { noremap = true, silent = true }) vim.keymap.set({ "n" }, "", "horizontal aboveleft terminal", { noremap = true, silent = true }) vim.keymap.set({ "n" }, "", "horizontal belowright terminal", { noremap = true, silent = true }) + +-- Set Neovide specific vars for use elsewhere (e.g. terminal sessions) +vim.env.NEOVIDE_SESSION = 1 diff --git a/dots/.config/zsh/config/profile/profile/aliases.zsh b/dots/.config/zsh/config/profile/profile/aliases.zsh index c1aed910..de25ca53 100644 --- a/dots/.config/zsh/config/profile/profile/aliases.zsh +++ b/dots/.config/zsh/config/profile/profile/aliases.zsh @@ -88,7 +88,7 @@ fi ### Wezterm ### - if command -v wezterm >/dev/null 2>&1; then + if [[ -v WEZTERM_CONFIG_DIR ]] && command -v wezterm >/dev/null 2>&1; then alias img="wezterm imgcat" alias ssh="TERM=xterm-256color ssh" fi @@ -102,4 +102,9 @@ if command -v arecord >/dev/null 2>&1; then alias audio-record="arecord -f dat -r 41000 -d 5 $(date_iso_8601).wav" fi + + # Override the `img` alias if we're in Neovide + if ! alias img >/dev/null 2>&1 && command -v swappy >/dev/null 2>&1; then + alias img="swappy -f -" + fi }