BSDG33KCLUB

.cshrc -- Nice csh prompt

Dec 5th, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.27 KB | None | 0 0
  1. ##################################################
  2. # Environment
  3. #################################################
  4. umask 022
  5.  
  6. setenv PATH ~/bin
  7. setenv PATH ${PATH}:/sbin:/bin:/usr/sbin:/usr/bin
  8. if (-d /usr/X11R6/bin) then
  9. setenv PATH ${PATH}:/usr/X11R6/bin:/usr/X11R6/sbin
  10. endif
  11. if (-d /usr/local/bin) then
  12. setenv PATH ${PATH}:/usr/local/bin:/usr/local/sbin
  13. endif
  14.  
  15. # Various applications settings
  16. setenv PAGER less
  17. # --squeeze-blank-lines
  18. # --chop-long-lines
  19. setenv LESS "--ignore-case --LONG-PROMPT --SILENT --tabs=2 --no-init"
  20.  
  21. setenv BLOCKSIZE K
  22. setenv 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=01;31:"
  23. setenv GREP_COLOR 31
  24. setenv ACK_COLOR_FILENAME red
  25.  
  26. setenv TERM cons25
  27.  
  28. # UTF-8
  29. if (-X locale) then
  30. setenv LANG en_US.UTF-8
  31. setenv LC_CTYPE en_US.UTF-8
  32. endif
  33.  
  34. # Set editor
  35. if (-X vim) then
  36. setenv EDITOR vim
  37. alias vi "vim"
  38. else if (-X vi) then
  39. setenv EDITOR vi
  40. endif
  41.  
  42. #################################################
  43. # Settings
  44. #################################################
  45. # Basic corrections when completing
  46. set autocorrect
  47.  
  48. # Show options when autocompleting
  49. set autolist
  50.  
  51. # Use history to aid expansion
  52. set autoexpand
  53.  
  54. # Never autologout
  55. set autologout
  56.  
  57. # Colorize stuff
  58. set color
  59.  
  60. # set -n and set '\003' will both work
  61. set echo_style=both
  62.  
  63. # file completion
  64. set filec
  65.  
  66. # Keep n items in history
  67. set history = 8192
  68.  
  69. # Logout on ^D
  70. unset ignoreeof
  71.  
  72. # Show '>' for symlink to dir, and '&' for symlink to nowhere
  73. set listlinks
  74.  
  75. # List all jobs after ^Z
  76. set listjobs
  77.  
  78. # Show current dir.
  79. set prompt = " %{\e[0;31m%}%n %{\e[0;36m%}%~ %{\e[0;31m%}#%{\033[0m%} "
  80.  
  81. # Show date & hostname on right side
  82. set rprompt = "%{\e[0;34m%}%B%U%m%b%u:%{\e[0;35m%}%T%{\033[0m%} "
  83.  
  84. # Never print "DING!" as the time
  85. set noding
  86.  
  87. # Use % for normal user and # for super
  88. set promptchars = "%#"
  89.  
  90. # Don't beep
  91. set nobeep
  92.  
  93. # Don't allow > redirection on existing files (only >>)
  94. set noclobber
  95.  
  96. # Print exit value if >0
  97. set printexitvalue
  98.  
  99. # Ask for confirmation if we do rm *
  100. set rmstar
  101.  
  102. # Save history
  103. set savehist = 8192 merge
  104.  
  105. # Lists file name suffixes to be ignored by completion
  106. # TODO Doesn't seem to work ... ?
  107. set fignore = (.o .pyc)
  108.  
  109. #################################################
  110. # Aliases
  111. #################################################
  112. # Modestly color my ls. But not christmas tree Linux colors! (See environment
  113. # variable $LS_COLOR above)
  114. alias ls "ls-F -I"
  115. alias la "ls-F -A"
  116. alias lc "ls-F -lThoI"
  117. alias lac "ls-F -lThoA"
  118. alias pdiff "diff -urN -x CVS -x .svn -I '^# .FreeBSD: '"
  119.  
  120. # bsdgrep is FreeBSD >=9
  121. if (-X bsdgrep) then
  122. alias grep "bsdgrep --color"
  123. else
  124. alias grep "grep --color"
  125. endif
  126.  
  127. # Override the tcsh builtins
  128. if (-x /usr/bin/nice) then
  129. alias nice "/usr/bin/nice"
  130. else if (-x /bin/nice) then
  131. alias nice "/bin/nice"
  132. endif
  133.  
  134. if (-x /usr/bin/time) then
  135. alias time "/usr/bin/time -h"
  136. endif
  137.  
  138. # A few move aliases...
  139. alias cp "cp -i"
  140. alias mv "mv -i"
  141. alias make "nice -n 20 make"
  142. alias lman "groff -man -Tascii"
  143. alias j "jobs -l"
  144.  
  145. if (-X xtermset) then
  146. alias xt "xtermset -title"
  147. alias black "xtermset -fg white -bg black"
  148. alias white "xtermset -fg black -bg white"
  149. else if (-X xtermcontrol) then
  150. alias xt "xtermcontrol --title"
  151. alias black "xtermcontrol --fg=white --bg=black"
  152. alias white "xtermcontrol --fg=black --bg=white"
  153. endif
  154.  
  155. # Typos
  156. alias sl "ls"
  157. alias l "ls"
  158. alias c "cd"
  159. alias vo "vi"
  160. # I know ci is already a command, but not used often and it mangles files!
  161. alias ci "vi"
  162. alias grpe "grep"
  163. alias Grep "grep"
  164.  
  165. alias helpcommand man
  166.  
  167. #################################################
  168. # Keybinds
  169. #################################################
  170. # Delete
  171. bindkey ^[[3~ delete-char
  172.  
  173. # Home
  174. bindkey ^[[H beginning-of-line
  175. bindkey ^[[1~ beginning-of-line
  176.  
  177. # End
  178. bindkey ^[[F end-of-line
  179. bindkey ^[[4~ end-of-line
  180.  
  181. # F1
  182. bindkey ^[[M run-help
  183. bindkey ^[[11~ run-help # Putty
  184.  
  185. # Arrow keys
  186. bindkey -k up history-search-backward
  187. bindkey -k down history-search-forward
  188.  
  189. # Insert
  190. bindkey ^[[L yank
  191. bindkey ^[[2 yank
  192.  
  193. #################################################
  194. # Completion
  195. #################################################
  196. # Show directories only
  197. complete cd 'C/*/d/'
  198. complete rmdir 'C/*/d/'
  199.  
  200. complete alias 'p/1/a/'
  201. complete unalias 'p/1/a/'
  202. complete unset 'p/1/s/'
  203. complete set 'p/1/s/'
  204. complete unsetenv 'p/1/e/'
  205. complete setenv 'p/1/e/'
  206. complete limit 'p/1/l/'
  207. complete bindkey 'C/*/b/'
  208. complete chgrp 'p/1/g/'
  209. complete chown 'p/1/u/' # TODO Support user:group completion
  210. complete uncomplete 'p/*/X/'
  211.  
  212. #complete kill 'c/-/S/' 'p/1/(-)//'
  213. complete kill 'c/-/S/' 'n/*/`ps -axco pid= | sort`/'
  214. complete pkill 'c/-/S/' 'n/*/`ps -axco command= | sort -u`/'
  215.  
  216. # Use available commands as arguments
  217. complete which 'p/1/c/'
  218. complete where 'p/1/c/'
  219. complete man 'p/1/c/'
  220. complete apropos 'p/1/c/'
  221.  
  222. complete find \
  223. 'n/-name/f/' 'n/-newer/f/' 'n/-{,n}cpio/f/' \
  224. 'n/-exec/c/' 'n/-ok/c/' 'n/-user/u/' 'n/-group/g/' \
  225. 'n/-fstype/(nfs 4.2)/' 'n/-type/(b c d f l p s)/' \
  226. 'c/-/(name newer cpio ncpio exec ok user group fstype type atime \
  227. ctime depth inum ls mtime nogroup nouser perm print prune \
  228. size xdev and or)/' \
  229. 'p/*/d/'
  230.  
  231. complete hg 'p/1/(add annotate clone commit diff export forget init log \
  232. merge phase pull push remove serve status summary update)/'
  233.  
  234. complete svn 'p/1/(add blame cat changelist checkout cleanup commit copy \
  235. delete diff export help import info list lock log merge mergeinfo \
  236. mkdir move propdel propedit propget proplist propset resolve \
  237. resolved revert status switch unlock update)/'
  238.  
  239. # Only list make targets
  240. complete make 'n@*@`make -pn | sed -n -E "/^[#_.\/[:blank:]]+/d; /=/d; s/[[:blank:]]*:.*//gp;"`@'
  241.  
  242. # set up programs to complete only with files ending in certain extensions
  243. complete cc 'p/*/f:*.[cao]/'
  244. complete python 'p/*/f:*.py/'
  245. complete perl 'p/*/f:*.[pP][lL]/'
  246. #complete sh 'p/*/f:*.sh/'
  247.  
  248. # set a list of hosts
  249. complete ssh 'p@1@`cut -d " " -f 1 ~/.ssh/known_hosts | sort -u`@'
  250.  
  251. # complete [command [word/pattern/list[:select]/[[suffix]/] ...]] (+)
  252. complete sysctl 'n/*/`sysctl -Na`/'
  253. complete service 'n/*/`service -l`/'
  254.  
  255. complete pkg_delete 'c/-/(i v D n p d f G x X r)/' 'n@*@`/bin/ls /var/db/pkg`@'
Advertisement
Add Comment
Please, Sign In to add comment