feat(zsh): improve neovide integration into term
This commit is contained in:
parent
b11ca1a51c
commit
d3528370bd
@ -1,83 +1,88 @@
|
|||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
### Eza ###
|
() {
|
||||||
if command -v eza >/dev/null 2>&1; then
|
### Eza ###
|
||||||
alias exa='eza' # This helps some preview commands work from separate repos
|
if command -v eza >/dev/null 2>&1; then
|
||||||
alias ls="eza --icons --group --group-directories-first --octal-permissions --classify"
|
alias exa='eza' # This helps some preview commands work from separate repos
|
||||||
alias l="ls -alh"
|
alias ls="eza --icons --group --group-directories-first --octal-permissions --classify"
|
||||||
alias ll="l"
|
alias l="ls -alh"
|
||||||
alias tree="ls --tree"
|
alias ll="l"
|
||||||
fi
|
alias tree="ls --tree"
|
||||||
|
|
||||||
### Git ###
|
|
||||||
if command -v git >/dev/null 2>&1; then
|
|
||||||
|
|
||||||
if command -v nvim >/dev/null 2>&1; then
|
|
||||||
alias gg="nvim -c 'Neogit'"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias gc="git commit"
|
### Git ###
|
||||||
alias gcm="git commit -m"
|
if command -v git >/dev/null 2>&1; then
|
||||||
alias ga="git add"
|
if command -v nvim >/dev/null 2>&1; then
|
||||||
alias gp="git push"
|
local editor_to_use=nvim
|
||||||
alias gb="git branch"
|
if [[ -n "${XDG_CURRENT_DESKTOP}" ]] && [[ "${EDITOR}" =~ "^neovide*" ]] && command -v neovide >/dev/null 2>&1; then
|
||||||
alias gco="git checkout"
|
editor_to_use="${EDITOR} --"
|
||||||
alias gpl="git pull"
|
fi
|
||||||
alias gs="git status"
|
alias gg="${editor_to_use} -c 'Neogit'"
|
||||||
alias gst="git stash"
|
alias gd="${editor_to_use} -c 'DiffviewOpen'"
|
||||||
alias gstc="git stash clear"
|
alias gl="${editor_to_use} -c 'call feedkeys(\":Neogit log\<CR>l\")'"
|
||||||
alias gsw="git switch"
|
fi
|
||||||
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"
|
|
||||||
alias gwr="git worktree remove"
|
|
||||||
alias git-remote="git config --get remote.origin.url"
|
|
||||||
alias git-head-default="git rev-parse --abbrev-ref origin/HEAD | cut -d '/' -f2"
|
|
||||||
alias gbc="git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
### Mac ###
|
alias gc="git commit"
|
||||||
if [[ "$OSTYPE" = "darwin"* ]]; then
|
alias gcm="git commit -m"
|
||||||
alias c="pbcopy"
|
alias ga="git add"
|
||||||
alias p="pbpaste"
|
alias gp="git push"
|
||||||
alias grep="ggrep"
|
alias gb="git branch"
|
||||||
alias find="gfind"
|
alias gco="git checkout"
|
||||||
alias sed="gsed"
|
alias gpl="git pull"
|
||||||
fi
|
alias gs="git status"
|
||||||
|
alias gst="git stash"
|
||||||
### Linux ###
|
alias gstc="git stash clear"
|
||||||
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
|
alias gsw="git switch"
|
||||||
if command -v wl-copy >/dev/null 2>&1; then
|
alias gr="git remote"
|
||||||
alias c="wl-copy"
|
alias glo="git log --oneline"
|
||||||
alias p="wl-paste"
|
alias gw="git worktree"
|
||||||
|
alias gwa="git worktree add"
|
||||||
|
alias gwr="git worktree remove"
|
||||||
|
alias git-remote="git config --get remote.origin.url"
|
||||||
|
alias git-head-default="git rev-parse --abbrev-ref origin/HEAD | cut -d '/' -f2"
|
||||||
|
alias gbc="git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v open >/dev/null 2>&1 && command -v xdg-open >/dev/null 2>&1; then
|
### Mac ###
|
||||||
alias open="xdg-open"
|
if [[ "$OSTYPE" = "darwin"* ]]; then
|
||||||
alias o="xdg-open"
|
alias c="pbcopy"
|
||||||
|
alias p="pbpaste"
|
||||||
|
alias grep="ggrep"
|
||||||
|
alias find="gfind"
|
||||||
|
alias sed="gsed"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
### Bat ###
|
### Linux ###
|
||||||
if command -v bat >/dev/null 2>&1; then
|
if [[ "${OSTYPE}" == "linux-gnu"* ]]; then
|
||||||
alias cat="bat"
|
if command -v wl-copy >/dev/null 2>&1; then
|
||||||
fi
|
alias c="wl-copy"
|
||||||
|
alias p="wl-paste"
|
||||||
|
fi
|
||||||
|
|
||||||
### Wezterm ###
|
if ! command -v open >/dev/null 2>&1 && command -v xdg-open >/dev/null 2>&1; then
|
||||||
if command -v wezterm >/dev/null 2>&1; then
|
alias open="xdg-open"
|
||||||
alias img="wezterm imgcat"
|
alias o="xdg-open"
|
||||||
alias ssh="TERM=xterm-256color ssh"
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Misc ###
|
### Bat ###
|
||||||
alias Get-Public-IPV4="dig @resolver4.opendns.com myip.opendns.com +short -4"
|
if command -v bat >/dev/null 2>&1; then
|
||||||
alias Get-Public-IPV6="dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6"
|
alias cat="bat"
|
||||||
alias cv="command -v"
|
fi
|
||||||
alias se="sudo -e"
|
|
||||||
|
|
||||||
if command -v arecord >/dev/null 2>&1; then
|
### Wezterm ###
|
||||||
alias audio-record="arecord -f dat -r 41000 -d 5 $(date_iso_8601).wav"
|
if command -v wezterm >/dev/null 2>&1; then
|
||||||
fi
|
alias img="wezterm imgcat"
|
||||||
|
alias ssh="TERM=xterm-256color ssh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Misc ###
|
||||||
|
alias Get-Public-IPV4="dig @resolver4.opendns.com myip.opendns.com +short -4"
|
||||||
|
alias Get-Public-IPV6="dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6"
|
||||||
|
alias cv="command -v"
|
||||||
|
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
|
||||||
|
}
|
||||||
|
@ -110,18 +110,33 @@ 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
|
||||||
elif command -v vim >/dev/null 2>&1; then
|
if [[ -n "${XDG_CURRENT_DESKTOP}" ]] && command -v neovide >/dev/null 2>&1; then
|
||||||
export EDITOR=vim
|
new_editor="neovide --no-fork"
|
||||||
export VISUAL=vim
|
new_visual="neovide --no-fork"
|
||||||
else
|
new_manpager="${XDG_CONFIG_HOME}/zsh/config/profile/profile/manpager_wrapper_func.bash"
|
||||||
export EDITOR=vi
|
elif command -v nvim >/dev/null 2>&1; then
|
||||||
export VISUAL=less
|
new_editor=nvim
|
||||||
fi
|
new_visual=nvim
|
||||||
|
new_manpager="nvim +Man!"
|
||||||
|
elif command -v vim >/dev/null 2>&1; then
|
||||||
|
new_editor=vim
|
||||||
|
new_visual=vim
|
||||||
|
new_manpager=less
|
||||||
|
else
|
||||||
|
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 ###
|
### Rust ###
|
||||||
export CARGO_HOME="${HOME}/.cargo"
|
export CARGO_HOME="${HOME}/.cargo"
|
||||||
|
7
dots/.config/zsh/config/profile/profile/manpager_wrapper_func.bash
Executable file
7
dots/.config/zsh/config/profile/profile/manpager_wrapper_func.bash
Executable 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 "${@}"
|
Loading…
Reference in New Issue
Block a user