Commits

Martin Tournoij committed f3582eb

Windows support for tcsh

Comments (0)

Files changed (1)

 #
 # tcsh configuration
 # Martin Tournoij <martin@arp242.net>
-# Should work on: FreeBSD, OpenBSD, Linux, OpenSolaris
+# Should work on: FreeBSD, OpenBSD, Linux, OpenSolaris, Windows 7
 #
 
 # NetBSD
     set prefix = 0
 endif
 
-set uname = `uname`
+if (-X uname) then
+	set uname = `uname`
+else
+	set uname = win32
+endif
+
+if ($uname == MINGW32_NT-6.1) then
+	set uname = win32
+endif
 
 ###################
 ### Environment ###
 ###################
 umask 022
 
-setenv PATH ~/bin
-setenv PATH ${PATH}:/sbin:/bin:/usr/sbin:/usr/bin
-if (-d /usr/local/bin) then
-	setenv PATH ${PATH}:/usr/local/bin:/usr/local/sbin
+if ($uname != win32) then
+	setenv PATH ~/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games
+
+	if (-d /usr/local/bin) then
+		setenv PATH ${PATH}:/usr/local/bin:/usr/local/sbin
+	endif
+	if ($prefix != 0) then
+		setenv PATH ${PATH}:${prefix}/bin:/${prefix}/sbin
+	endif
 endif
-if ($prefix != 0) then
-    setenv PATH ${PATH}:${prefix}/bin:/${prefix}/sbin
-endif
-setenv PATH ${PATH}:/usr/games
 
 # Some commonly installed packages on OpenSolaris
 if ($uname == SunOS) then
-	setenv PATH ${PATH}:/opt/VirtualBox
-	setenv PATH ${PATH}:/opt/csw/gcc4/bin
+	setenv PATH ${PATH}:/opt/VirtualBox:/opt/csw/gcc4/bin
 endif
 
 # /var/ is a memory device on my laptop
 # Aliases
 #################################################
 # Update xterm title on directory change (special alias)
-alias cwdcmd 'echo -n "\033]2;tcsh: $cwd\007"'
+if ($uname != win32) then
+	alias cwdcmd 'echo -n "\033]2;tcsh: $cwd\007"'
+endif
 
 # Modestly color my ls. But not christmas tree Linux colors! (See environment
 # variable $LS_COLOR above)
 	alias lac ls -lhA
 
 	alias sockstat "netstat -lnptu"
+else if ($uname == win32) then
+	alias ls ls-F
+	alias la "ls -a"
+	alias lc "ls -l"
+	alias lac "ls -la"
+
+	alias clear cls
 else
 	# These should work on almost any platform ...
 	alias la "ls -a"
 ##############
 # Keybinds ###
 ##############
-# Delete
-bindkey ^[[3~ delete-char
+if ($uname == win32) then
+	bindkey -b N-up history-search-backward
+	bindkey -b N-down history-search-forward
+	bindkey -b N-right forward-char
+	bindkey -b N-left backward-char
+	bindkey -b N-del delete-char
+	bindkey -b N-ins overwrite-mode
+	bindkey -b N-1 which-command
+	bindkey -b N-2 expand-history
+	bindkey -b N-3 complete-word-raw
+	bindkey -b N-home beginning-of-line
+	bindkey -b N-end end-of-line
+else
+	# F1
+	bindkey ^[[M run-help
+	bindkey OP run-help
+	bindkey ^[[11~ run-help # Putty
 
-# Home
-bindkey ^[[H beginning-of-line
-bindkey ^[[1~ beginning-of-line
+	# Delete
+	bindkey ^[[3~ delete-char
 
-# End
-bindkey ^[[F end-of-line
-bindkey ^[[4~ end-of-line
+	# Home
+	bindkey ^[[H beginning-of-line
+	bindkey ^[[1~ beginning-of-line
 
-# F1
-bindkey ^[[M run-help
-bindkey OP run-help
-bindkey ^[[11~ run-help # Putty
+	# End
+	bindkey ^[[F end-of-line
+	bindkey ^[[4~ end-of-line
 
-# Arrow keys
-bindkey -k up history-search-backward
-bindkey -k down history-search-forward
+	# Arrow keys
+	bindkey -k up history-search-backward
+	bindkey -k down history-search-forward
+endif
 
 # Insert
 bindkey ^[[L yank
 endif
 
 unset noglob
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.