aboutsummaryrefslogtreecommitdiffstats
path: root/roles/basic/files/csh.cshrc
blob: a8247d026d016dd1ba4f8fdcaaeaf0aa6a9c0f90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#
# /etc/csh.cshrc
# csh/tcsh resource script, read at beginning of execution by each shell
#
# Aaron LI
#

setenv  EDITOR  vi
setenv  PAGER   less

# Locale
# NOTE: mosh (https://github.com/mobile-shell/mosh) requires UTF-8.
# NOTE: login.conf(5) is ignored by SSH since it handles the login by its own
setenv  LANG        en_US.UTF-8
setenv  MM_CHARSET  UTF-8
setenv  LC_COLLATE  C

if ( $?prompt ) then
    # An interactive shell
    set prompt = "%N@%m%# "
    set promptchars = "%#"
    set filec
    set history = 1000
    set savehist = (1000 merge)
    set autolist = ambiguous
    set autoexpand
    set autorehash
    set mail = (/var/mail/$USER)

    # A safer version of rm that isn't as annoying as -i
    alias rm    'rm -I'
    alias h     history 25
    alias j     jobs -l
    alias ls    ls -G  # color!
    alias la    ls -aF
    alias lf    ls -FA
    alias ll    ls -lAF

    if ( $?tcsh ) then
        bindkey    "^W" backward-delete-word
        bindkey -k up   history-search-backward
        bindkey -k down history-search-forward

        # Credit:
        # * https://stackoverflow.com/a/1912527/4856091
        # * http://www.ibb.net/~anne/keyboard/keyboard.html#Tcsh
        bindkey "\e[1~" beginning-of-line  # Home
        bindkey "\e[7~" beginning-of-line  # Home rxvt
        bindkey "\e[2~" overwrite-mode     # Insert
        bindkey "\e[3~" delete-char        # Delete
        bindkey "\e[4~" end-of-line        # End
        bindkey "\e[8~" end-of-line        # End rxvt
    endif
endif