Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
210 lines (163 sloc) 4.77 KB
# Basic environment ... (? I think?)
\: "${TERM:=vt100}${HOSTNAME:=$(\ulimit -c \
0; hostname 2>/dev/null)}${EDITOR:=/bin/ed}${USER:=$(\ulimit -c 0; id -un \
2>/dev/null || \echo \?)}${MKSH:=$(\builtin whence -p mksh)}"
HOSTNAME=${HOSTNAME%%*([ ]).*}
HOSTNAME=${HOSTNAME##*([ ])}
[[ $HOSTNAME = ?(ip6-)localhost?(6) ]] && HOSTNAME=
\: "${HOSTNAME:=nil}${MKSH:=/bin/mksh}"
export EDITOR HOSTNAME MKSH TERM USER
PS1='#' # Root
(( USER_ID )) && PS1='%' # Regular user
PS1=$'\001\r''${|
# Store exit code for later
\typeset e=$?
\typeset d=${PWD:-?}/
\typeset p=~
# Replace $HOME with ~
[[ $p = ?(*/) ]] || d=${d/#$p\//\~/}
d=${d%/}
# Hmmm...?
\typeset m=${%d} n p=…
(( m > 0 )) || m=${#d}
(( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || p=
REPLY+="[$p$d]"
# Add exit code
(( e )) && REPLY+=" $e "
\return $e
}'"$PS1 "
PS4='[$EPOCHREALTIME] '
###
### ENV
###
export HISTFILE=~/.mksh_history
export HISTSIZE=32767
# Path
export PATH=~/Local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games
[ -d /usr/local/bin ] && export PATH=$PATH:/usr/local/bin:/usr/local/sbin
[ -d /usr/X11R6/bin ] && export PATH=$PATH:/usr/X11R6/bin:/usr/X11R6/sbin
if [ -d ~/.gem/ruby/2.3.0/bin ]; then
export PATH=$PATH:~/.gem/ruby/2.3.0/bin
elif [ -d ~/.gem/ruby/2.2.0/bin ]; then
export PATH=$PATH:~/.gem/ruby/2.2.0/bin
fi
# Go stuff
\export GOPATH=~/gocode
\export PATH=$PATH:~/gocode/bin
# Various applications settings
\export BLOCKSIZE=K
\export PAGER=less
\export LESS='--ignore-case --LONG-PROMPT --SILENT --no-init --no-lessopen'
# Make man pages 80 characters wide at the most; this is the default on BSD, but
# not Linux
\export MANWIDTH=80
# Colors for ls(1)
\export LS_COLORS="no=00:fi=00:di=34:ln=01;31:pi=34;43:so=31;43:bd=30;43:cd=30;43:or=01;35:ex=31:"
# Older GNU grep; BSD grep
\export GREP_COLOR=31
# Newer GNU grep, I guess GREP_COLOR was too easy to use
\export GREP_COLORS="ms=31:mc=31:sl=0:cx=0:fn=0:ln=0:bn=0:se=0"
# Fix scrolling in GTK3; https://www.pekwm.org/projects/pekwm/tasks/350
\export GDK_CORE_DEVICE_EVENTS=1
# Make compose key work for GTK, Qt
\export GTK_IM_MODULE=xim
\export QT_IM_MODULE=xim
# Disable retarded "overlay scrollbar"
\export GTK_OVERLAY_SCROLLING=0
# Don't output to a pager
\export SYSTEMD_PAGER=
\export TERM=screen-256color
# Do the $TERM dance; these options seem to work best on various systems...
#if (($?TMUX)) then
# setenv TERM screen-256color
#else if ($uname == OpenBSD) then
# setenv TERM xterm-xfree86
#else if ($uname == FreeBSD) then
# if ($tty =~ ttyv*) then
# setenv TERM cons25
# else
# setenv TERM xterm-256color
# endif
#else if ($uname == Linux) then
# setenv TERM xterm-256color
# #setenv TERM xterm-color
#else
# setenv TERM vt220
#endif
# UTF-8
if [ -x "$(command -v locale)" ]; then
\export LANG=en_US.UTF-8
\export LC_CTYPE=en_US.UTF-8
\export LC_COLLATE=en_US.UTF-8
#setenv I18NPATH ~/.locale
#setenv LOCPATH ~/.locale
fi
# Set editor
\export EDITOR=vim
\alias vim='vim -p'
\alias vi='vim'
\export BROWSER=chromium
# Run commands from this file; only run for interactive prompt
[ -f ~/Local/python-startup ] && \
\export PYTHONSTARTUP=~/Local/python-startup
#foreach f ( /etc/profile.d/*.csh )
# if ( -r $f ) source $f
#end
#unset f
###
### Aliases
###
\alias ls='ls -F --quoting-style=literal --color'
\alias l='ls'
\alias lc='ls -lhN'
\alias la='l -A'
\alias lac='ls -lhA'
\alias pdiff='diff -urN -x .git -x .hg'
# Run last command as root
\alias dosu='sudo mksh -c "$(\builtin fc -ln -1)"'
[ -x "$(\command -v systemctl)" ] && \
\alias zzz='systemctl suspend'
# bsdtar/libarchive works with many file formats, not just tar
[ -x "$(\command -v bsdtar)" ] && \
\alias tar=bsdtar
# Linux top is an unusable piece of shit after recent changes
[ -x "$(\command -v htop)" ] && \
\alias top=htop
\alias cp='cp -i'
\alias mv='mv -i'
\alias make='nice -n 20 make'
\alias lman='groff -man -Tascii' # `local man' <file>.1
\alias dejson='python -mjson.tool'
\alias ag='ag -S --color-match 31 --color-line-number 35 --color-path 1\;4'
\alias decolor="sed 's|\x1b\[[;0-9]*m||g'"
# I type mplayer out of habbit...
\alias mplayer=mpv
\alias muttp='mutt -F ~/.mutt/muttrc-prive'
\alias muttw='mutt -F ~/.mutt/muttrc-work'
\alias mutt-sunbeam='mutt -F ~/.mutt/muttrc-sunbeam'
# Use title in filename
\alias youtube-dl='youtube-dl --no-part -t'
# Some typos
\alias sl="ls"
\alias l="ls"
\alias c="cd"
\alias vo="vi"
\alias ci="vi"
\alias iv="vi" # Some image viewer I never use, annoying
\alias grpe="grep"
\alias Grep="grep"
\alias les=less
# TODO
#alias helpcommand man
#bind -m '^[OP'=man
#alias cwdcmd source ~/.tcsh/cwdcmd.tcsh
###
### Key bindings
###
\bind '^L'=clear-screen
# Up/down arrows
\bind '^[[A'=search-history-up
\bind '^[[B'=search-history-down
#\bind -m '^[[A'='^[[5~^E'
#\bind -m '^[[B'='^[[6~^E'
# vim:filetype=sh
You can’t perform that action at this time.