前面两篇文章已经分别介绍了安装cygwin和安装配置poderosa,基本上这个虚拟的linux环境就可以工作了,但是使用起来还不那么顺手,还有一些习惯的shell环境需要配置一下,主要是home目录~/下的.bashrc, .inputrc, .vimrc这三个文件。
由于cygwin的公共bash配置文件是/etc/bash.bashrc, 我们可以将一些配置放在这个文件中。这里就不详细讲解每项配置的含义,一般在#注释中有讲解,或者参考网上的文章。
1、bash配置:
/etc/bash.bashrc
# base-files version 3.7-1
# # IF THIS bash IS MODIFIED IT WILL NOT BE UPDATED BY THE CYGWIN # SETUP PROGRAM. IT BECOMES YOUR RESPONSIBILITY. # # The latest version as installed by the Cygwin Setup program can # always be found at /etc/defaults/etc/bash.bashrc
# System-wide .bashrc file if [[ $- != *i* ]] ; then # Bash won't get SIGWINCH if another process is in the foreground. # Enable history appending instead of overwriting. #139609 # Change the window title of X terminals use_color=false # Set colorful PS1 only on colorful terminals. if ${use_color} ; then if [[ ${EUID} == 0 ]] ; then alias ls='ls --color=auto' # Try to keep environment pollution down, EPA loves us. |
~/.bashrc
# base-files version 3.7-1 # To pick up the latest recommended .bashrc content, # Modifying /etc/skel/.bashrc directly will prevent # The copy in your home directory (~/.bashrc) is yours, please # User dependent .bashrc file # See man bash for more options... # Don't wait for job termination notification # Don't use ^D to exit # Use case-insensitive filename globbing # Make bash append rather than overwrite the history on disk # When changing directory small typos can be ignored by bash # Completion options # These completion tuning parameters change the default behavior of bash_completion: # Define to access remotely checked-out files over passwordless ssh for CVS # Define to avoid stripping description in --option=description of './configure --help' # Define to avoid flattening internal contents of tar files # If this shell is interactive, turn on programmable completion enhancements. # History Options # Don't put duplicate lines in the history. # Ignore some controlling instructions # Whenever displaying the prompt, write the previous line to disk # Aliases # Some example alias instructions # Interactive operation... # Default to human readable figures # Misc :) # Some shortcuts for different directory listings colour |
~/.inputrc
set meta-flag on set convert-meta off set input-meta on set output-meta on set editing-mode vi set completion-ignore-case on |
~/.vimrc
运行命令 cp /usr/share/vim/vim72/vimrc_example.vim ~/.vimrc
直接使用cygwin提供的配置文件,这里就不详细设置了。上面路径中vim72可能根据具体安装的版本会有所不同。
至此,windows上的Linux已经初具规模了。