Tcsh

From Leo's Notes
Revision as of 06:31, 29 March 2015 by Leo (talk | contribs)
This page was last edited on 29 March 2015, at 06:31.

An alternative c-shell

Configuration

The .tcshrc file defines the tcsh configuration. An example file follows:

# .tcshrc

# User specific aliases and functions

alias rm 'rm -i'
alias cp 'cp -i'
alias mv 'mv -i'

set prompt = "%m:%~ %h# "
set histfile = ~/.tcsh_history
set autolist

bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[2~" overwrite-mode    # Ins
bindkey "\e[3~" delete-char       # Delete
bindkey "\e[4~" end-of-line       # End
bindkey "\e[8~" end-of-line       # End rxvt

Issues

The following things are covered by the example file above, but are covered in a little more detail.

Auto Completion

The tab key will by default not do anything, unless the following line is in your tcshrc file:

set autolist

History Logging

Similar to the .bash_history file in bash, you can tell tcsh to log your commands in a file by adding the following to your tcshrc file:

set histfile = ~/.tcsh_history

Remapping Home,End,Delete Keys in tcsh

Add the following to your tcshrc file:

bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[2~" overwrite-mode    # Ins
bindkey "\e[3~" delete-char       # Delete
bindkey "\e[4~" end-of-line       # End
bindkey "\e[8~" end-of-line       # End rxvt