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

View File

@ -110,19 +110,34 @@ if [[ -r "${usr/libexec/java_home}" ]]; then
export JAVA_HOME="$(/usr/libexec/java_home)" export JAVA_HOME="$(/usr/libexec/java_home)"
fi fi
### Editor ### # ### Editor ###
if command -v nvim >/dev/null 2>&1; then () {
export EDITOR=nvim local new_editor
export VISUAL=nvim local new_visual
export MANPAGER="nvim +Man!" 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 elif command -v vim >/dev/null 2>&1; then
export EDITOR=vim new_editor=vim
export VISUAL=vim new_visual=vim
new_manpager=less
else else
export EDITOR=vi new_editor=vi
export VISUAL=less new_visual=vi
new_manpager=less
fi fi
export EDITOR="${EDITOR:-$new_editor}"
export VISUAL="${VISUAL:-$new_visual}"
export MANPAGER="${MANPAGER:-$new_manpager}"
}
### Rust ### ### Rust ###
export CARGO_HOME="${HOME}/.cargo" export CARGO_HOME="${HOME}/.cargo"
source "${CARGO_HOME}/env" 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 "${@}"