this post was submitted on 11 Sep 2024
12 points (92.9% liked)

Ask Programming

75 readers
2 users here now

founded 2 years ago
MODERATORS
 

I think I have a pretty good developer env going on, but I'm always looking for more things I haven't thought of.

So does anybody have any uber useful, or fun, or just a general favorite shell/terminal setup or tool?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 1 week ago* (last edited 1 week ago)

A have it so that my shell always opens tmux, unless it's a login shell or dumb shell.

# ~/.bashrc
## Top of your RC
[[ $- != *i* ]] && return          # If not running interactively, don't do anything
[ -z "$PS1" ] && return            # If not running interactively, don't do anything
[[ $TERM == dumb ]] && return      # If called from emacs, don't do anything

## Put the rest of your code here

## Bottom of RC
shopt -q login_shell && return       ## If this is a login shell, load all except tmux

if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
    tmux attach || exec tmux new-session 
fi

That way, I always have persistent terminal sessions and don't need a terminal emulator that has tabs since I can just do multiplexing in tmux