"My .vimrc file (Shan Jing)
"
" Part 1. Python Vim settings
" Part 2. Misc Settings
" Part 3. Global Format Settings
" <F1> opens bash in a horizonal split window
" <F2> opens bash in a vertical split window
" <F3> opens ipython in a horizonal split window
" <F4> opens ipython in a vertical split window
" <F5> debug/run current python file in a shell
" <c-,> opens a shell in a buffer/work with tabnew
" <c-w>t<c-w>H swap windows shapes H->V
" <c-w>t<c-w>K swap windows shapes V->H
" :map or :map! to show current mappings
" :nmap - Display normal mode maps
" :imap - Display insert mode maps
" :vmap - Display visual and select mode maps
" :smap - Display select mode maps
" :xmap - Display visual mode maps
" :cmap - Display command-line mode maps
" :omap - Display operator pending mode maps
"1. Python vim settings
set tabstop=4 " numbers of spaces of tab character
set shiftwidth=4 " numbers of spaces to (auto)indent
set smarttab
set expandtab " tabs are converted to spaces,use only when required
set autoindent
set smartindent
if has("autocmd")
" clear au, note: au = autocmd
au!
" Restore cursor position
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
"omnicompletion
filetype plugin on
set ofu=syntaxcomplete#Complete
au FileType python set omnifunc=pythoncomplete#Complete
au FileType javascript set omnifunc=javascriptcomplete#CompleteJS
au FileType html set omnifunc=htmlcomplete#CompleteTags
au FileType css set omnifunc=csscomplete#CompleteCSS
au FileType xml set omnifunc=xmlcomplete#CompleteTags
au FileType php set omnifunc=phpcomplete#CompletePHP
au FileType c set omnifunc=ccomplete#Complete
"http://vim.wikia.com/wiki/Python_-_check_syntax_and_run_ script
"nmap <buffer> <F5> :wmwG:r!python %<cr>`.
au BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
au BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
au BufRead *.py nmap <F5> :!python %<cr>
au BufRead *.py set nowrap
au BufRead *.py set go+=b
au BufRead *.py set tabstop=4
"Python settings: auto indent the next line after these key words:
au BufRead *.py set smartindent cinwords=def,if,elif,else,for,while,try,except,finall
" Automatically chmod +x Python, Perl and Shell scripts
au BufWritePost *.py !chmod +x %
au BufWritePost *.sh !chmod +x %
au BufWritePost *.pl !chmod +x %
"remove all training space when editing
"au BufWritePre *.py :%s/\s\+$//e
endif
"3. Other global setttings
"3a. A Python Calculator
"3b. ConqueShell Mappings
"3c. vim 7+ tabs settings
"3d. color scheme settings
"3e. general coding settings for c,cpp,php,java, etc
"3f. global format settings
"A Python Calculator for python aware vim
"usage : command mode: Calc x*y
:command! -nargs=+ Calc :py print <args>
:py from math import *
" ConqueShell Mappings
nmap <F1> :ConqueTermSplit bash<cr>
nmap <F2> :ConqueTermVSplit bash<cr>
nmap <F3> :ConqueTermSplit ipython<cr>
nmap <F4> :ConqueTermVSplit ipython<cr>
nmap <F6> :ConqueTerm bash -o vi<cr>
let g:ConqueTerm_EscKey = '<c-k>'
"map <F9> :previous<cr> " map F9 to open previous buffer
"map <F10> :next<cr> " map F10 to open next buffer
" turn off highlighted search
map <silent> <c-h> :silent noh<cr>
"editting and sourcing .vimrc
map ,e :vsp ~/.vimrc<cr> " edit my .vimrc file
map ,u :source ~/.vimrc<cr> " update vim setting
"insert the directory name of the current buffer
imap <2> <c-r>=expand('%:p:h')<cr>
"For vim 7.0+ tabs limit (default is 10)
set tabpagemax=15
"open a new tab
map ,t :tabnew<cr>
"command mode mappings
"insert the directory name of the current buffer at command mode
"e.g., :!ls <2> will do ls dir at current cursor
cmap <F2> <c-r>=expand('%:p:h')<cr>
"color scheme setting
if has("gui_running")
" See ~/.gvimrc
set guifont=Monospace\ 10 " use this font
set lines=50 " height = 50 lines
set columns=100 " width = 100 columns
set background=light " adapt colors for background
set selectmode=mouse,key,cmd
set keymodel=
else
colorscheme elflord " use this color scheme
set background=dark " adapt colors for background
endif
if has("autocmd")
" Filetypes (au = autocmd)
au FileType helpfile set nonumber " no line numbers when viewing help
au FileType helpfile nnoremap <buffer><cr> <c-]> " Enter selects subject
au FileType helpfile nnoremap <buffer><bs> <c-t> " Backspace to go back
" When using mutt, text width=72
au FileType mail,tex set textwidth=72
au FileType cpp,c,java,sh,pl,php,asp set autoindent
au FileType cpp,c,java,sh,pl,php,asp set smartindent
au FileType cpp,c,java,sh,pl,php,asp set cindent
"au BufRead mutt*[0-9] set tw=72
" File formats
au BufNewFile,BufRead *.pls set syntax=dosini
au BufNewFile,BufRead modprobe.conf set syntax=modconf
"remove all training space when editing
au BufWritePre *.py :%s/\s\+$//e
endif
"Global format settings
set nocompatible " use vim defaults
set ls=2 " allways show status line
set scrolloff=3 " keep 3 lines when scrolling
set showcmd " display incomplete commands
set hlsearch " highlight searches
set incsearch " do incremental searching
set ruler " show the cursor position all the time
set visualbell t_vb= " turn off error beep/flash
set novisualbell " turn off visual bell
set nobackup " do not keep a backup file
set number " show line numbers
set ignorecase " ignore case when searching
"set noignorecase " don't ignore case
set title " show title in console title bar
set ttyfast " smoother changes
"set ttyscroll=0 " turn off scrolling, didn't work well with PuTTY
set modeline " last lines in document sets vim mode
set modelines=3 " number lines checked for modelines
set shortmess=atI " Abbreviate messages
set nostartofline " don't jump to first character when paging
set whichwrap=b,s,h,l,<,>,[,] " move freely between files
syntax on
Showing posts with label Desktop - vim cygwin mintty firefox etc. Show all posts
Showing posts with label Desktop - vim cygwin mintty firefox etc. Show all posts
.vimrc for Python
Installing Ubuntu 9.10 on Vmware Hosts and Configure Ubuntu Server
It said "Install Windows 7 or better", so I installed Ubuntu.....
Redhat is supposed to be the leader in open source community; however, with long releasing cycle and sort of "closed" packing practices, Redhat is gradually losing the leadership. Issues like the painful process of upgrading Python in Redhat Linux distribution has bothered the open source community. It's time to look for a better open source Linux distribution - Ubuntu.
The installation is very easy - download the iso image of ubuntu from its website, create a new vmware host with 8GB virtual disk and 1GB RAM (my laptop has total 4GB RAM), choose "ubuntu" as operating system (these technology leaders really know how to cooperate with each other!), setup NAT network for the new host and pick the iso image as boot image (With vmware's virtual CDROM, I didn't even need to burn the iso file to CD); finally fire up the vmware host then take a break practicing DJHero Daft Punk Megamix. 20 minutes later, my Toshiba laptop powered by Intel Core 2 Duo Processor, 4GB RAM is welcoming a new vmware host member - ubuntu.
(Ubuntu 9.10 Desktop Screenshots)

Bash is installed as default shell, most popular open source tools are installed. There are two distributions - Desktop and Server. Desktop has the GUI environment and most UNIX end-user tools installed, Python 2.6 and gcc along with other development tools are installed; however, server products like apache, tomcat, are not. yum is also not installed. For Sys Admins, you may have to choose to install the desktop or server edition. I actually have a very good solution - install both and convert the desktop edition to server by reinstalling server's extra packages (the actually upgrade process is at the end of this blog).
Using ubuntu is just as easy as installing it. One of the nice features for ubuntu is the ability to update packages automatically. The system silently checks for the latest packages, releases. When a cluster of new packages is available, it will pop up a menu and suggest users to update... Making it short, I really don't want to look back once I start to use ubuntu.
With 3 major UNIX OSs in one laptop (Solaris, RHEL, Ubuntu), the fun just begins... Very soon, I probably need a new laptop with Quad Core CPU and 8GB - 16GB RAM.
Cheers!

Is the terminal's transparent mode correct?
Ubuntu Server Configuration:
Server installation doesn't come with GUI. For most Intel Duo Core CPU laptops/PCs, installing 64-bit server may create problems. Someone has re-compiled ubuntu kernel on these CPUs, if you need to borrow the compiled kernels, google "ubuntu 64 bit kernel for Intel Duo Core". If you don't care about performance and ubuntu's 3-D desktop features (actually I do!) 32 bit kernel is an easy option for most Laptops/PCs.
The standard server installation doesn't have all the packages by default. But the installation is fairly simple and straight.
Command execution is very very fast!
To install yum, sshd, apache and other packages:
sudo apt-get install yum
sudo apt-get install openssh-server
sudo apt-get install gcc
sudo apt-get install apache2
To get a list of selections:
root@ubuntu:~# dpkg --get-selections | awk '{rpint $1}' > pkglist
To install all perl packages:
root@ubuntu:~# for i in $(dpkg --get-selections | grep perl | awk '{print $1}'); do echo $i; apt-get -y install $i; done
To find out what packages are installed:
root@ubuntu:~#dpkg --list
To find out files owned by a package:
root@ubuntu:~# dpkg -L openjdk-6-jre
/.
/usr
/usr/lib
/usr/lib/jvm
/usr/lib/jvm/java-6-openjdk
/usr/lib/jvm/java-6-openjdk/jre
/usr/lib/jvm/java-6-openjdk/jre/bin
/usr/lib/jvm/java-6-openjdk/jre/bin/javaws
/usr/lib/jvm/java-6-openjdk/jre/bin/pluginappletviewer
/usr/lib/jvm/java-6-openjdk/jre/bin/policytool
/usr/lib/jvm/java-6-openjdk/jre/bin/javaws.real
(Ubuntu 9.10 Server, DJHero Daft Punk Megamix, PacMan)

(auto) Install server packages on ubuntu desktop host: (this will give you GUI and all the packages on the server)
create a list of installed packages on both desktop and server, e.g.
On the desktop:
#dpkg --get-selections* | awk '{print $1}' > pkglist.desktop
On the server:
#dpgk --get-selections* | awk '{print $1}' > pkglist.server
scp server's pkglist to the host running desktop edition.
On the desktop host, install the server's additional packages:
for i in $(diff pkglist pkglist2 | grep '<' | cut -d' ' -f2); do echo $i; apt-get -y install $i; done
Next, install tomcat and verify apache2 mod_jk and mod_proxy modules. Create and import a test database into mysql. Perl's base packages are installed, I cpan a few Perl modules for database and web scripting. For additional packages, apt-get and yum are our best friends.
Because my laptop's video card, I am not able to play with Ubuntu's 3D desktop. I'll leave that to my desktop computer.
That's it! In less than an hour, starting from scratch, we build a fully loaded standalone Linux server with beautiful desktop and faster, smoother performance!
My Desktop (click image for full view)
Besides Mintty's improved function over Putty, the cool transparent mode allows users to read files in the background without switching the terminal back and forth. It's very helpful when you read a pdf file while coding in vim!

My laptop : cygwin+mintty and vim/vimshell.( At this moment, vimshell can only be patched into vim 7.0. You need to recompile vim if you have 7.x)

My Desktop:

My laptop : cygwin+mintty and vim/vimshell.( At this moment, vimshell can only be patched into vim 7.0. You need to recompile vim if you have 7.x)

My Desktop:
vim, vimshell, mintty ( cool stuffs!)
Vim Tricks
Let's see some of vim's advanced features:
1. vim in multiple windows;
2. use vim's tabs function (vim 7.1+) ;
3. vim spelling;
4. vimshell (having a shell inside vim!)
5. more advanced vim commands.

(click the image for large view)
#1.split screens and editing multiple files:
vim -o file1 file2 to start vim in split-mode editing two files
if already inside vim working with one file, use :sp command to split/open new file
:sp filename #opens a new file and split screen in vim
:n new_file #opens a new file and replace current file
:b new_file #opens a new file and replace current file
:args #to see which files are open with
#CTRL W + j,k key to switch/toggle between windows/files
#CTRL W + s or v to split current window horizontally or veritically
#CTRL W + c to close current window
#CTRL W + x to swap window positions
#2. use vim's tabs to edit multiple files- far superior to buffer ( for vim 7.1+)
:tabe filename #opens a file in a new tab (a new thread of vim)
:tabn or gt #go to next file in tab
:tabp or gT #go to previous file in tab
:ls #to see a list of current tabs/buffers
:1b #to switch to the 1st tab/buffer same as gt/tabn cmds
:2b #to switch to the 2nd tab/buffer same as gt/tabn cmds
:help tabe #to see tab's help
#3. vim spelling
To switch on: :setlocal spell spelllang=en_us
To switch off::set nospell
:help spell to see details.
navigation:
]s - next misspelled word
[s - prev "
interaction:
zg - add misspelled word to system dictionary
zG - add misspelled word to buffer-local set of "good" words
zw - add word to 'bad' list
zW - add word to buffer-local 'bad' list
z= - view a numbered list of suggested spellings from which to choose for auto-replacement
#4. Need a shell inside vim window? Isn't just hitting Ctrl_W e/E to drop a shell window in your VIM session cool?!
With this feature, I virtually can do administration tasks without leaving vim. Perfect for coding while doing admin tasks.
To setup is simple, just patch vim with vimshell and define ctrl_w e/E in your .vimrc file with these mappings:
Now, let's see something very cool! - run vim inside mintty in transparent mode...

Or, run mintty in glass mode...

#5. some useful vim commands
#load VIM without .vimrc and plugins (clean VIM)
gvim -u NONE -U NONE -N
" execute multiple command on a single file
vim -c "%s/ABC/DEF/ge | update" file1.c
" execute multiple command on a group of files
vim -c "argdo %s/ABC/DEF/ge | update" *.c
gvim.exe -c "/main" joe.c : Open joe.c & jump to "main"
gvim -d file1 file2 : vimdiff (compare differences)
dp : "put" difference under cursor to other file
do : "get" difference under cursor from other file
--------------------------------------------------------------------------
:reg : display contents of all registers
:reg a : display content of register a
:let @y='yy@"' : pre-loading registers (put in .vimrc)
qqq : empty register "q"
qaq : empty register "a"
:h quickref : VIM Quick Reference Sheet (ultra)
:h tips : Vim's own Tips Help
--------------------------------------------------------------------------
" where was an option set
:scriptnames : list all plugins, _vimrcs loaded (super)
:verbose set history? : reveals value of history and where set
:function : list functions
:func SearchCompl : List particular function
--------------------------------------------------------------------------
:'a,'bg/^/m'b : Reverse a section a to b
:g/^/t. : duplicate every line
:g/fred/t$ : copy(transfer) lines matching fred to EOF
:g/gladiolli/# : display with line numbers
--------------------------------------------------------------------------
:%s#<[^>]\+>##g : delete html tags, leave text (non-greedy)
:%s#<\_.\{-1,}>##g : delete html tags possibly multi-line (non-greedy)

Resources:
1. vi Complete Key Binding List.
2. Hardcore vim tips.
3. Daily vim tip page.
4. vim's color scheme.
5. vim official site for python syntax and all other scripts.
6. A very good vimrc file. (For more, visit vim's home page.)
Warning: vim is fun but can also be addictive, please allocate your time wisely.
I started my day programming Python, but found my self playing vim until mid-night... all I had was a fun day!
sample .bashrc
# To pick up the latest recommended .bashrc content,
# look in /etc/defaults/etc/skel/.bashrc
# Modifying /etc/skel/.bashrc directly will prevent
# setup from updating it.
# The copy in your home directory (~/.bashrc) is yours, please
# feel free to customise it to create a shell
# environment to your liking. If you feel a change
# would be benificial to all, please feel free to send
# a patch to the cygwin mailing list.
# User dependent .bashrc file
# Shell Options
# #############
# See man bash for more options...
# Don't wait for job termination notification
# set -o notify
# Don't use ^D to exit
# set -o ignoreeof
# Use case-insensitive filename globbing
# shopt -s nocaseglob
# Make bash append rather than overwrite the history on disk
# shopt -s histappend
# When changing directory small typos can be ignored by bash
# for example, cd /vr/lgo/apaache would find /var/log/apache
# shopt -s cdspell
# 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
# COMP_CVS_REMOTE=1
# Define to avoid stripping description in --option=description of './configure --help'
# COMP_CONFIGURE_HINTS=1
# Define to avoid flattening internal contents of tar files
# COMP_TAR_INTERNAL_PATHS=1
# If this shell is interactive, turn on programmable completion enhancements.
# Any completions you add in ~/.bash_completion are sourced last.
# case $- in
# *i*) [[ -f /etc/bash_completion ]] && . /etc/bash_completion ;;
# esac
# History Options
# ###############
# Don't put duplicate lines in the history.
# export HISTCONTROL="ignoredups"
# Ignore some controlling instructions
# export HISTIGNORE="[ ]*:&:bg:fg:exit"
# Whenever displaying the prompt, write the previous line to disk
# export PROMPT_COMMAND="history -a"
# Aliases
# #######
# Some example alias instructions
# If these are enabled they will be used instead of any instructions
# they may mask. For example, alias rm='rm -i' will mask the rm
# application. To override the alias instruction use a \ before, ie
# \rm will call the real rm not the alias.
# Interactive operation...
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'
# Default to human readable figures
# alias df='df -h'
# alias du='du -h'
# Misc :)
# alias less='less -r' # raw control characters
# alias whence='type -a' # where, of a sort
alias grep='grep --color' # show differences in colour
# Some shortcuts for different directory listings
alias ls='ls -hF --color=tty' # classify files in colour
# alias dir='ls --color=auto --format=vertical'
# alias vdir='ls --color=auto --format=long'
# alias ll='ls -l' # long list
# alias la='ls -A' # all but . and ..
# alias l='ls -CF' #
# Functions
# #########
# Some example functions
# function settitle() { echo -ne "\e]2;$@\a\e]1;$@\a"; }
Let's see some of vim's advanced features:
1. vim in multiple windows;
2. use vim's tabs function (vim 7.1+) ;
3. vim spelling;
4. vimshell (having a shell inside vim!)
5. more advanced vim commands.

(click the image for large view)
#1.split screens and editing multiple files:
vim -o file1 file2 to start vim in split-mode editing two files
if already inside vim working with one file, use :sp command to split/open new file
:sp filename #opens a new file and split screen in vim
:n new_file #opens a new file and replace current file
:b new_file #opens a new file and replace current file
:args #to see which files are open with
#CTRL W + j,k key to switch/toggle between windows/files
#CTRL W + s or v to split current window horizontally or veritically
#CTRL W + c to close current window
#CTRL W + x to swap window positions
#2. use vim's tabs to edit multiple files- far superior to buffer ( for vim 7.1+)
:tabe filename #opens a file in a new tab (a new thread of vim)
:tabn or gt #go to next file in tab
:tabp or gT #go to previous file in tab
:ls #to see a list of current tabs/buffers
:1b #to switch to the 1st tab/buffer same as gt/tabn cmds
:2b #to switch to the 2nd tab/buffer same as gt/tabn cmds
:help tabe #to see tab's help
#3. vim spelling
To switch on: :setlocal spell spelllang=en_us
To switch off::set nospell
:help spell to see details.
navigation:
]s - next misspelled word
[s - prev "
interaction:
zg - add misspelled word to system dictionary
zG - add misspelled word to buffer-local set of "good" words
zw - add word to 'bad' list
zW - add word to buffer-local 'bad' list
z= - view a numbered list of suggested spellings from which to choose for auto-replacement
#4. Need a shell inside vim window? Isn't just hitting Ctrl_W e/E to drop a shell window in your VIM session cool?!
With this feature, I virtually can do administration tasks without leaving vim. Perfect for coding while doing admin tasks.
To setup is simple, just patch vim with vimshell and define ctrl_w e/E in your .vimrc file with these mappings:
" VIM-Shell
" Ctrl_W e opens up a vimshell in a horizontally split window
" Ctrl_W E opens up a vimshell in a vertically split window
" The shell window will be auto closed after termination
nmap <C-W>e :new \| vimshell bash<CR>
nmap <C-W>E :vnew \| vimshell bash<CR>
Now, let's see something very cool! - run vim inside mintty in transparent mode...

Or, run mintty in glass mode...

#5. some useful vim commands
#load VIM without .vimrc and plugins (clean VIM)
gvim -u NONE -U NONE -N
" execute multiple command on a single file
vim -c "%s/ABC/DEF/ge | update" file1.c
" execute multiple command on a group of files
vim -c "argdo %s/ABC/DEF/ge | update" *.c
gvim.exe -c "/main" joe.c : Open joe.c & jump to "main"
gvim -d file1 file2 : vimdiff (compare differences)
dp : "put" difference under cursor to other file
do : "get" difference under cursor from other file
--------------------------------------------------------------------------
:reg : display contents of all registers
:reg a : display content of register a
:let @y='yy@"' : pre-loading registers (put in .vimrc)
qqq : empty register "q"
qaq : empty register "a"
:h quickref : VIM Quick Reference Sheet (ultra)
:h tips : Vim's own Tips Help
--------------------------------------------------------------------------
" where was an option set
:scriptnames : list all plugins, _vimrcs loaded (super)
:verbose set history? : reveals value of history and where set
:function : list functions
:func SearchCompl : List particular function
--------------------------------------------------------------------------
:'a,'bg/^/m'b : Reverse a section a to b
:g/^/t. : duplicate every line
:g/fred/t$ : copy(transfer) lines matching fred to EOF
:g/gladiolli/# : display with line numbers
--------------------------------------------------------------------------
:%s#<[^>]\+>##g : delete html tags, leave text (non-greedy)
:%s#<\_.\{-1,}>##g : delete html tags possibly multi-line (non-greedy)

Resources:
1. vi Complete Key Binding List.
2. Hardcore vim tips.
3. Daily vim tip page.
4. vim's color scheme.
5. vim official site for python syntax and all other scripts.
6. A very good vimrc file. (For more, visit vim's home page.)
Warning: vim is fun but can also be addictive, please allocate your time wisely.
I started my day programming Python, but found my self playing vim until mid-night... all I had was a fun day!
sample .bashrc
# To pick up the latest recommended .bashrc content,
# look in /etc/defaults/etc/skel/.bashrc
# Modifying /etc/skel/.bashrc directly will prevent
# setup from updating it.
# The copy in your home directory (~/.bashrc) is yours, please
# feel free to customise it to create a shell
# environment to your liking. If you feel a change
# would be benificial to all, please feel free to send
# a patch to the cygwin mailing list.
# User dependent .bashrc file
# Shell Options
# #############
# See man bash for more options...
# Don't wait for job termination notification
# set -o notify
# Don't use ^D to exit
# set -o ignoreeof
# Use case-insensitive filename globbing
# shopt -s nocaseglob
# Make bash append rather than overwrite the history on disk
# shopt -s histappend
# When changing directory small typos can be ignored by bash
# for example, cd /vr/lgo/apaache would find /var/log/apache
# shopt -s cdspell
# 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
# COMP_CVS_REMOTE=1
# Define to avoid stripping description in --option=description of './configure --help'
# COMP_CONFIGURE_HINTS=1
# Define to avoid flattening internal contents of tar files
# COMP_TAR_INTERNAL_PATHS=1
# If this shell is interactive, turn on programmable completion enhancements.
# Any completions you add in ~/.bash_completion are sourced last.
# case $- in
# *i*) [[ -f /etc/bash_completion ]] && . /etc/bash_completion ;;
# esac
# History Options
# ###############
# Don't put duplicate lines in the history.
# export HISTCONTROL="ignoredups"
# Ignore some controlling instructions
# export HISTIGNORE="[ ]*:&:bg:fg:exit"
# Whenever displaying the prompt, write the previous line to disk
# export PROMPT_COMMAND="history -a"
# Aliases
# #######
# Some example alias instructions
# If these are enabled they will be used instead of any instructions
# they may mask. For example, alias rm='rm -i' will mask the rm
# application. To override the alias instruction use a \ before, ie
# \rm will call the real rm not the alias.
# Interactive operation...
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'
# Default to human readable figures
# alias df='df -h'
# alias du='du -h'
# Misc :)
# alias less='less -r' # raw control characters
# alias whence='type -a' # where, of a sort
alias grep='grep --color' # show differences in colour
# Some shortcuts for different directory listings
alias ls='ls -hF --color=tty' # classify files in colour
# alias dir='ls --color=auto --format=vertical'
# alias vdir='ls --color=auto --format=long'
# alias ll='ls -l' # long list
# alias la='ls -A' # all but . and ..
# alias l='ls -CF' #
# Functions
# #########
# Some example functions
# function settitle() { echo -ne "\e]2;$@\a\e]1;$@\a"; }
Setting up X.cygwin
Here's the script I use to setup cygwin's X session on my desktop, it offers very user-friendly X-term sessions with interactive bash login shell.
#! /bin/sh
export DISPLAY=127.0.0.1:0.0
export PATH=/usr/bin:"$PATH"
unset XAPPLRESDIR
unset XCMSDB
unset XKEYSYMDB
unset XNLSPATH
# Cleanup from last run.
rm -rf /tmp/.X11-unix
# The error "Fatal server error: could not open default font 'fixed'" is
# caused by using a DOS mode mount for the mount that the Cygwin/X
# fonts are accessed through. See the Cygwin/X FAQ for more
# information:
# http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-error-font-eof
# Description of XWin-specific options is in XWin(1) manpage.
#
# Startup the programs
#
# Startup the X Server with the integrated Windows-based window manager.
# WARNING: Do not use 'xwinclip' in conjunction with the ``-clipboard''
# command-line parameter for XWin. Doing so would start two clipboard
# managers, which is never supposed to happen.
XWin -multiwindow -clipboard -silent-dup-error &
#XWin -scrollbars -emulate3buttons -clipboard -silent-dup-error &
# Startup an xterm, using bash as the shell.
#xterm -e /usr/bin/bash -l &
xterm -bg black -fg gray +bdc +cm -geometry 80x60 -e /usr/bin/bash -i -l &
xterm -bg black -fg gray +bdc +cm -geometry 80x60 -e /usr/bin/bash -i -l &
xterm -bg black -fg gray +bdc +cm -geometry 80x60 -e /usr/bin/bash -i -l &
#
# Startup the twm window manager.
# WARNING: Do not use an external window manager in conjunction with
# the ``-multiwindow'' command-line parameter for XWin. Doing so
# would start two window managers, which is never supposed to happen.
#
# twm &
# Set a background color. Only needed when not using -multwindow for XWin.
# xsetroot -solid aquamarine4
# Return from sh.
exit
#! /bin/sh
export DISPLAY=127.0.0.1:0.0
export PATH=/usr/bin:"$PATH"
unset XAPPLRESDIR
unset XCMSDB
unset XKEYSYMDB
unset XNLSPATH
# Cleanup from last run.
rm -rf /tmp/.X11-unix
# The error "Fatal server error: could not open default font 'fixed'" is
# caused by using a DOS mode mount for the mount that the Cygwin/X
# fonts are accessed through. See the Cygwin/X FAQ for more
# information:
# http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-error-font-eof
# Description of XWin-specific options is in XWin(1) manpage.
#
# Startup the programs
#
# Startup the X Server with the integrated Windows-based window manager.
# WARNING: Do not use 'xwinclip' in conjunction with the ``-clipboard''
# command-line parameter for XWin. Doing so would start two clipboard
# managers, which is never supposed to happen.
XWin -multiwindow -clipboard -silent-dup-error &
#XWin -scrollbars -emulate3buttons -clipboard -silent-dup-error &
# Startup an xterm, using bash as the shell.
#xterm -e /usr/bin/bash -l &
xterm -bg black -fg gray +bdc +cm -geometry 80x60 -e /usr/bin/bash -i -l &
xterm -bg black -fg gray +bdc +cm -geometry 80x60 -e /usr/bin/bash -i -l &
xterm -bg black -fg gray +bdc +cm -geometry 80x60 -e /usr/bin/bash -i -l &
#
# Startup the twm window manager.
# WARNING: Do not use an external window manager in conjunction with
# the ``-multiwindow'' command-line parameter for XWin. Doing so
# would start two window managers, which is never supposed to happen.
#
# twm &
# Set a background color. Only needed when not using -multwindow for XWin.
# xsetroot -solid aquamarine4
# Return from sh.
exit
Subscribe to:
Posts (Atom)
