Jump to content

cygwin - tcsh


TheUsualAlex

Recommended Posts

Hi,

Does anyone here know how to get tcsh to launch by default with all the shell functionality in tact? When I set the tcsh to be the default launch in the cygwin.bat file, I can't even do things like "ls" and such. Only when I launch bash by default first and invoke the tcsh shell -- then that'd work.

I guess I just like to launch tcsh by default first on the fly instead of typing tcsh and 2 exits afterwards...

Thanks.

Alex

Link to comment
Share on other sites

Here's how I setup a unix environment on Windows.

1. Download cygwin from http://www.cygwin.com I can't remember what packages I downloaded but the default ones should be good. Install it to c:/cygwin

2. Create the c:/bin directory. Copy the csh.exe from your latest Houdini distribution and put it into c:/bin.

3. Now set up a HOME environment variable to point to your home directory (eg. c:/home).

4. Inside $HOME, create a .login file. In the first lines, do something like this:

setenv PATH '.;'$HOME'/bin;c:/bin;c:/cygwin/bin;'$PATH

On my home system, I use the Windows version of vim and gvim (download from http://www.vim.org) which I

install to c:/Vim. Which means my .login has:

setenv PATH '.;'$HOME'/bin;c:/Vim/vim61;c:/bin;c:/cygwin/bin;'$PATH
setenv EDITOR vim.exe
setenv VISUAL gvim.exe

5. Copy a shortcut from c:/bin/csh.exe to your desktop (and/or quicklaunch bar). Right-click on the new shortcut and choose Properties... In the Target name add the -l option after csh.exe. This tells csh.exe to source your .login file when it starts.

6. To launch, click on shortcut.

After this, you can further modify your .login file. A good start is to launch this csh and then do "printrc >> .login" which gives you a nice starting point. I generally comment out the lines "set correct=all" and "set autocorrect" as I find those features annoying. I dislike having my aliases stored in my .login file so I extracted those lines at the end out and put it into a separate file and use "source ~/.alias" instead.

Here's what I currently have in my ~/.alias file at home:

alias	ls  ls-F 
alias	l  ls-F 
alias	ll  ls-F -l
alias  h  history
alias  rm  rm -i
alias  rd	rmdir
alias  md	mkdir
alias  mv	mv -i
alias   cp 	 cp -i
alias	pwd 'echo $cwd'
alias   env printenv
alias   unsave unset savehist savedirs

alias	ali 'gvim ~/.alias; source ~/.alias'

Link to comment
Share on other sites

Hi Edward,

Well, in the cygwin.bat file, I specify it to launch tcsh by default (rem-ed the line on bash). tcsh launched just fine. But, default command such as ls, grep, pwd, etc. will not work. It's just a command not found. The strange thing is that it's fine if I launch bash shell first, and lauch tcsh from within bash shell. Not sure how to fix this, but I guess I'll just deal with bash-tcsh instead.

Thanks, Edward.

Alex

Link to comment
Share on other sites

  • 2 weeks later...

Hi Edward, I finally got it to work last night. What I didn't do in the past was that I forgot to specify "tcsh -l" in the cygwin.bat file, hence the ls stuff wouldn't even work. Now everything worked. I guess emulation still has no match for the real UNIX environment still. But, I am happy. :)

Thanks, Edward!

Link to comment
Share on other sites

  • 1 year later...

I use tcsh as well and everything works fine for me. I don't even really remember how I set things up, it's been a while. I did back-up all the configuration files, but I don't remember what I changed originally.

To think of it: The Cygwin toolset is one of the few things that makes Windows still, quite, worthwhile. I wonder if Microsoft realizes this, amidst all the 'new' and 'modern' (read: useless) features for each and - more hardware-demanding - release of Windows...

Link to comment
Share on other sites

  • 2 years later...

hey guys,

gonna revive the thread from 2005 a little ;)

i set up everything like edward described, and it works fine so far, but i'm having a problem with external editors.. i'm trying to use crimson editor(some windows editor) which apparently doesn't understand the unixy path houdini sends from the .tmp.str file it creates.

everything works fine with gvim but crimson complains about an invalid path which looks something like 'C:\bin\C:\Users\Aearon\AppData\Local\Temp\hfsblabla.tmp.str' while in gvim it shows up correctly as '~\AppData\Local\Temp\hfsblabla.tmp.str' and opens the file just fine

where the C:\bin at the start of the path is wherever y run houdini from in the shell

is there maybe some way to change the string houdini sends to the editor or anything i can change in my shell setup?

Link to comment
Share on other sites

and another beginner question:

running csh.exe like this, how do you get key bindings as with cygwin? e.g. for the arrow keys (char back, char forward, up-history)

things like bindkey <ctrl-v>HOME beginning-of-line on the shell don't seem to have any effect? same for anything i tried in .login

Link to comment
Share on other sites

Here's the .loginbindkeys file that I source from .login

#Bind keys for tcsh

# Set vi bindings for keys
#bindkey -v

bindkey -b ^W backward-delete-word
bindkey -b ^U backward-kill-line
bindkey -b ^R complete-word-fwd
bindkey -b M-g list-glob
bindkey -b M-* expand-glob
bindkey -b M-v expand-variables
bindkey -b M-w normalize-command
bindkey -b M-/ which-command

bindkey -b N-up up-history
bindkey -b N-down down-history
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

Link to comment
Share on other sites

  • 5 months later...

I'm afraid I'm having some trouble getting my keybindings to work. When I run them from the command line, they work fine, but when I put them in one of my dot files, they don't work. Here's what I've got in a file I created (called .tcshkeybindings) that I source from my .tcshrc file:

echo "Running .tcshkeybindings"

bindkey "^[[b" "history-search-forward"

bindkey "^[[A" "history-search-backward"

This allows me to auto-complete a command by typing a few characters, then hitting the up-arrow - an extremely convenient feature of the tcsh shell. I've tried adding a line in there like you suggested

bindkey -b N-up up-history

but then I get the following error:

Bad key spec N-up

Any ideas how to fix this? Thanks a lot!

Here's the .loginbindkeys file that I source from .login

#Bind keys for tcsh

# Set vi bindings for keys
#bindkey -v

bindkey -b ^W backward-delete-word
bindkey -b ^U backward-kill-line
bindkey -b ^R complete-word-fwd
bindkey -b M-g list-glob
bindkey -b M-* expand-glob
bindkey -b M-v expand-variables
bindkey -b M-w normalize-command
bindkey -b M-/ which-command

bindkey -b N-up up-history
bindkey -b N-down down-history
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...