addet correct tmux and neovim configuration
This commit is contained in:
parent
748f91e772
commit
4645dcf0a1
1 changed files with 33 additions and 21 deletions
|
@ -219,25 +219,50 @@ _alias() {
|
|||
alias ll="ls --color=always -lph"
|
||||
fi
|
||||
|
||||
# ─< t stands for tmux >────────────────────────────────────────────────────────────────────
|
||||
# Function to determine which Neovim command to use
|
||||
choose_nvim() {
|
||||
if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
# If in a graphical environment, use Neovide
|
||||
if command_exists neovide; then
|
||||
echo "neovide --fork"
|
||||
return
|
||||
fi
|
||||
elif [ -n "$TMUX" ]; then
|
||||
# If inside an active tmux session, use nvim
|
||||
echo "command nvim"
|
||||
return
|
||||
fi
|
||||
# Default to nvim
|
||||
echo "command nvim"
|
||||
}
|
||||
|
||||
# Set up Neovim aliases based on environment
|
||||
if command_exists nvim; then
|
||||
alias cnvim="command nvim"
|
||||
alias nvim="$(choose_nvim)"
|
||||
|
||||
if [ -d "$HOME/.config/nvchad" ]; then
|
||||
alias nvchad='NVIM_APPNAME="nvchad" command nvim'
|
||||
alias neochad='NVIM_APPNAME="nvchad" neovide --fork'
|
||||
fi
|
||||
fi
|
||||
|
||||
# Tmux session manager
|
||||
if command_exists tmux; then
|
||||
local tmux_y="$(echo '-- tmux-session active! | connecting to active session --')"
|
||||
local tmux_n="$(echo '-- no tmux-session found! | creating one --')"
|
||||
ta() {
|
||||
command tmux list-sessions >/dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "${tmux_y}"
|
||||
if tmux list-sessions >/dev/null 2>&1; then
|
||||
echo "-- tmux session active! | Connecting to active session --"
|
||||
sleep 0.3
|
||||
tmux attach
|
||||
else
|
||||
echo "${tmux_n}"
|
||||
echo "-- No tmux session found! | Creating one --"
|
||||
sleep 0.3
|
||||
tmux
|
||||
fi
|
||||
}
|
||||
|
||||
alias ts="tmux source $HOME/.tmux.conf"
|
||||
fi
|
||||
|
||||
# ─< t stands for trash(-cli) >───────────────────────────────────────────────────────────────
|
||||
if command_exists trash; then
|
||||
alias rm="trash"
|
||||
|
@ -412,19 +437,6 @@ _coding_() {
|
|||
export EDITOR="codium"
|
||||
fi
|
||||
|
||||
# ─< neovide, the best frontend for any neovim-config >───────────────────────────────────
|
||||
if command_exists nvim; then
|
||||
alias cnvim="command nvim"
|
||||
if command_exists neovide; then
|
||||
alias nvim="neovide --fork"
|
||||
fi
|
||||
|
||||
if [ -d "$HOME/.config/nvchad" ]; then
|
||||
alias nvchad='NVIM_APPNAME="nvchad" command nvim'
|
||||
alias neochad='NVIM_APPNAME="nvchad" neovide --fork'
|
||||
fi
|
||||
fi
|
||||
|
||||
# Function to get the IP address
|
||||
get_ip() {
|
||||
ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d/ -f1 | head -n 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue