feat(zsh): improve neovide integration into term

This commit is contained in:
Price Hiller 2024-03-01 04:15:20 -06:00
parent b11ca1a51c
commit d3528370bd
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
3 changed files with 110 additions and 83 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env zsh
() {
### Eza ###
if command -v eza >/dev/null 2>&1; then
alias exa='eza' # This helps some preview commands work from separate repos
@ -11,9 +12,14 @@ fi
### Git ###
if command -v git >/dev/null 2>&1; then
if command -v nvim >/dev/null 2>&1; then
alias gg="nvim -c 'Neogit'"
local editor_to_use=nvim
if [[ -n "${XDG_CURRENT_DESKTOP}" ]] && [[ "${EDITOR}" =~ "^neovide*" ]] && command -v neovide >/dev/null 2>&1; then
editor_to_use="${EDITOR} --"
fi
alias gg="${editor_to_use} -c 'Neogit'"
alias gd="${editor_to_use} -c 'DiffviewOpen'"
alias gl="${editor_to_use} -c 'call feedkeys(\":Neogit log\<CR>l\")'"
fi
alias gc="git commit"
@ -27,9 +33,7 @@ if command -v git >/dev/null 2>&1; then
alias gst="git stash"
alias gstc="git stash clear"
alias gsw="git switch"
alias gd="nvim -c 'DiffviewOpen' -R"
alias gr="git remote"
alias gl="nvim -c 'call feedkeys(\":Neogit log\<CR>l\")'"
alias glo="git log --oneline"
alias gw="git worktree"
alias gwa="git worktree add"
@ -81,3 +85,4 @@ alias se="sudo -e"
if command -v arecord >/dev/null 2>&1; then
alias audio-record="arecord -f dat -r 41000 -d 5 $(date_iso_8601).wav"
fi
}

View File

@ -110,19 +110,34 @@ if [[ -r "${usr/libexec/java_home}" ]]; then
export JAVA_HOME="$(/usr/libexec/java_home)"
fi
### Editor ###
if command -v nvim >/dev/null 2>&1; then
export EDITOR=nvim
export VISUAL=nvim
export MANPAGER="nvim +Man!"
# ### Editor ###
() {
local new_editor
local new_visual
local new_manpager
if [[ -n "${XDG_CURRENT_DESKTOP}" ]] && command -v neovide >/dev/null 2>&1; then
new_editor="neovide --no-fork"
new_visual="neovide --no-fork"
new_manpager="${XDG_CONFIG_HOME}/zsh/config/profile/profile/manpager_wrapper_func.bash"
elif command -v nvim >/dev/null 2>&1; then
new_editor=nvim
new_visual=nvim
new_manpager="nvim +Man!"
elif command -v vim >/dev/null 2>&1; then
export EDITOR=vim
export VISUAL=vim
new_editor=vim
new_visual=vim
new_manpager=less
else
export EDITOR=vi
export VISUAL=less
new_editor=vi
new_visual=vi
new_manpager=less
fi
export EDITOR="${EDITOR:-$new_editor}"
export VISUAL="${VISUAL:-$new_visual}"
export MANPAGER="${MANPAGER:-$new_manpager}"
}
### Rust ###
export CARGO_HOME="${HOME}/.cargo"
source "${CARGO_HOME}/env"

View File

@ -0,0 +1,7 @@
#!/usr/bin/env -S nix --extra-experimental-features "nix-command flakes" shell nixpkgs#bash --command bash
main() {
neovide --no-fork -- "+silent!+Man!" -- <(cat "${@}")
}
main "${@}"