代码: 全选
tlcr: 0 庚寅年八月廿五日 23:26:56 ~
● dog ~/.fvwm/config
# vim: filetype=fvwm
SetEnv fvwm $[HOME]/.fvwm/
ImagePath +":$[fvwm]icons:/usr/share/icons/"
SetEnv RegularFont "xft:ZhunYuan:pixelsize=22:Medium"
SetEnv HeiFont "xft:WenQuanYi Micro Hei:pixelsize=20:Medium"
DesktopSize 3x3
DesktopName 0 Main
MenuStyle * BorderWidth 1, Font "$[RegularFont]"
DestroyMenu MenuFvwmRoot
Module FvwmCommandS
CursorStyle DEFAULT right_ptr
Exec habak "$[fvwm]desktop.jpg"
# 字体
Style * Font $[RegularFont]
Style * IconFont $[RegularFont]
####################################################
Style * !Title, HandleWidth 3
#Style * !Borders
Style * MouseFocusClickRaises #点击窗体上升
#IgnoreModifiers L25
########################
# Super,用于热键组合。位于Mod4。xmodmap -pm查看
# 热键启动程式。
Key w A 4 JumpExec "Namoroka" firefox
Key d A 4 JumpExec "Document Viewer" evince
#Key t A 4 JumpExec "好友列表" pidgin
Key g A 4 JumpExec "gimp" gimp
Key f A 4 JumpExec "F-Spot" f-spot
Key c A 4 Exec ~/应用/脚本/sd-截图.bash
Key s A 4 Exec exec xterm -geometry 60x40 -title SnakeGame -e sn-贪吃蛇.bash
Key t A 4 Exec exec xterm-多彩
Key a A 4 Exec exec xterm -geometry 80x27-0+0 -bg blue4 -title "Mutt" -e mutt
Key r A 4 Exec exec xterm -geometry 80x27-0-0 -bg tan4 -title "Irssi" -e Irssi-Alias
# xdg-open 自动打开。
Key e A 4 Exec exec AutoOpen
#Key c A 4 JumpExec "Chromium" chromium
#Key v A 4 JumpExec "VirtualBox" VirtualBox
#Key q A 4 JumpExec "GQview" gqview
#Key n A 4 JumpExec "zim" zim
#Key t A 4 Exec exec xterm
#Key z A 4 All (xterm) shadex
########################
# 声音调节。
# Fn-[F10...F12]
Key XF86AudioMute A A Exec exec amixer set Master toggle
Key XF86AudioLowerVolume A A Exec exec amixer set Master 10%-
Key XF86AudioRaiseVolume A A Exec exec amixer set Master 10%+
# Fn加上下光标,
#Key XF86AudioPlay A A Exec exec amixer set Master 10%-
#Key XF86AudioStop A A Exec exec amixer set Master 10%+
# Fn加左右光标,定义于~/.xmodmaprc
Key XF86AudioPrev A A Exec exec mocp -r
Key XF86AudioNext A A Exec exec mocp -f
# 菜单
Mouse 1 R A Menu RootMenu
Mouse 3 R A WindowList mouse -1p -1p
#mouse 3 r c windowlist mouse -1p -1p onlylistskip
#窗口的按钮
#mouse 1 2 a close
#mouse 2 2 a all ($c) close
#mouse 3 2 a destroy
#mouse 1 4 a maximize 100 100
#mouse 2 4 a maximize 0 100
#mouse 3 4 a maximize 100 0
#mouse 1 6 a iconify
#mouse 2 6 a all ($c) iconify on
#mouse 3 6 a all ($c) windowshade on
#mouse 1 8 a togglestaysontop
#mouse 1 0 a funcfullscreen
#-------------Super+ 窗口操作---------------
Mouse 1 R 4 Exec kupfer
Mouse 1 W 4 Move
Mouse 2 W 4 Stick
Mouse 3 W 4 Resize
Mouse 4 W 4 Maximize
Mouse 5 W 4 Iconify
Key x W 4 Close
Mouse 1 I A WindowListFunc
#+方向键,对齐到屏幕边缘
Key Up W 4 Move w 0
Key Down W 4 Move w -0
Key Left W 4 Move 0 w
Key Right W 4 Move -0 w
# Super + 1 2 3 4 5 6 7 8 9 移动到指定桌面。
# 1 2 3
# 4 5 6
# 7 8 9
Key 1 W 4 PointerWindow MoveToPage 0 0
Key 2 W 4 PointerWindow MoveToPage 1 0
Key 3 W 4 PointerWindow MoveToPage 2 0
Key 4 W 4 PointerWindow MoveToPage 0 1
Key 5 W 4 PointerWindow MoveToPage 1 1
Key 6 W 4 PointerWindow MoveToPage 2 1
Key 7 W 4 PointerWindow MoveToPage 0 2
Key 8 W 4 PointerWindow MoveToPage 1 2
Key 9 W 4 PointerWindow MoveToPage 2 2
# Windows Map
# Fx Dict Gimp,F-Spot
# Evince Pidgin Float
# Chromium VirtualBox Float
#
Style Namoroka StartsOnPage 0 0, SkipMapping
Style Irssi StartsOnPage 0 0, SkipMapping
Style stardict StartsOnPage 1 0, SkipMapping
Style Mutt StartsOnPage 1 0, SkipMapping
Style gimp StartsOnPage 2 0, SkipMapping
Style F-Spot StartsOnPage 2 0, SkipMapping
#Style screen StartsOnPage 1 1, SkipMapping
Style "Document Viewer" StartsOnPage 0 1, SkipMapping
Style "好友列表" StartsOnPage 1 1, SkipMapping
Style GMChess StartsOnPage 2 1
Style SnakeGame StartsOnPage 2 1
Style chromium StartsOnPage 0 2, SkipMapping
Style VirtualBox StartsOnPage 1 2, SkipMapping
#Style rox StartsOnPage 0 1, PositionPlacement Center
#-------------IconBox 设置
Style * IconBox 1000x100+40-40, IconGrid 20 20, IconFill right bottom, IconSize 48 48
Style * !IconTitle, IconTitleRelief 0, IndexedIconName, IconBackgroundPadding 0, IconBackgroundRelief 0
########################
# 修正系统函数:恢复窗口时,鼠标居中
AddToFunc WindowListFunc
+ I WarpToWindow 50 50
########################
# Jump & Exec 函数
DestroyFunc JumpExec
AddToFunc JumpExec
+ I All ($0) WindowListFunc
+ I TestRc (NoMatch) Exec exec $1 &
########################
# 切换xterm卷帘的函数
DestroyFunc shadex
AddToFunc shadex
+ I ThisWindow PipeRead '[ $[w.y] -gt 200 ] && echo WindowShade S || echo WindowShade N'
########################
# 样式设置
Style * NoPPosition
Style Namoroka NoPPosition
#Style xterm !Title, !Borders, !Iconifiable, Sticky, StaysOnTop, WindowListSkip
Style xterm !Title, !Borders, !Iconifiable, WindowListSkip
Style dock !Title, !Borders, !Iconifiable, Sticky, StaysOnBottom, WindowListSkip
Style tint2 UseStyle dock
Style *panel UseStyle dock
Style *dock UseStyle dock
Style *tray UseStyle dock
Style *clock UseStyle dock
Style trayer UseStyle dock
Style conky UseStyle dock
Style Namoroka Title
DestroyFunc InitFunction
AddToFunc InitFunction
# 自动启动的脚本。
+ I Exec exec $[fvwm]autostart.bash
# 不生效!要把第一个启动的xterm,就是fq的那个,搞到Page 1 0
#+ I Wait (fq)
#+ I All (fq) MoveToPage 1 0
#+ I All (stardict) MoveToPage 1 0
# Colors
Colorset 0 fg white, fgsh white, bg #969b0c, sh #969b0c, hi #ffffff, Translucent #283e5e 80, Tint white 15, bgTint #0c0c9b 15
Colorset 1 fg white, fgsh white, bg #283e5e, hi #fff, sh #283e5e, Translucent #969b0c 70, Tint white 15, bgTint #318bcf 15
Colorset 3 fg #9aafbf, bg #000000, fgsh #000000, NoShape, RootTransparent, Tint #283e5e 70
Colorset 4 fg #ffffff, bg #000000, fgsh #000000, Noshape, RootTransparent, Tint #101f36 70
# 透明的。(假透明。)
Colorset 41 RootTransparent buffer, fg white, bg average, Tint white 15, bgTint blue 15
Colorset 42 RootTransparent buffer, fg white, bg average, Tint white 15, bgTint cyan 15
# Border, Title and Button Styles
#Style * BorderWidth 10, HandleWidth 5
#ButtonStyle 1 MiniIcon (-- flat)
#ButtonStyle all -- UseTitleStyle Flat
#ButtonStyle 2 Pixmap w-关.png -- flat
#ButtonStyle 4 Pixmap w-大.png -- flat
#ButtonStyle 6 Pixmap w-小.png -- flat
#ButtonStyle 8 Pixmap w-顶.png -- flat
#ButtonStyle 0 Pixmap w-全.png -- flat
Style "*" MWMBorder
Style "*" MWMButtons
TitleStyle Centered
ButtonStyle all -- UseTitleStyle
# 边框和标题样式
# 透明的。
Style * Colorset 42, HilightColorset 42
BorderStyle Inactive Colorset 42 -- flat
BorderStyle Active Colorset 42 -- flat
TitleStyle AllInactive Colorset 42 -- flat
TitleStyle AllActive Colorset 42 -- flat
MenuStyle * Hilight3DOff, HilightBack #424164, ActiveFore white
Colorset 0 Transparent,fg white
MenuStyle * MenuColorset 0
MenuStyle * Foreground grey90
MenuStyle * Background #1c5572
MenuStyle * Font $[RegularFont]
MenuStyle * BorderWidth 1, TitleUnderlines1, SeparatorsLong, TrianglesSolid
MenuStyle * ItemFormat "%.2|%.5i%.5l%.5i%2.3>%2|"
MenuStyle * AutomaticHotKeys
MenuStyle * MenuFace VGradient 128 1 #2c80A0 1 #1c5572
ColormapFocus FollowsFocus
DestroyMenu RootMenu
AddToMenu RootMenu "主菜单" Title
+ "终端(&T)%mini.term.xpm%" Exec exec xterm-多彩
+ "文本编辑器(&E)%mini.edit.xpm%" Exec exec gvim
#+ "文件管理器(&F)%mini.filemgr.xpm%" Exec exec rox # 要rox干吗?
+ "" Nop
+ "程式(&P)" Popup Programs
+ "" Nop
+ "重启 Fvwm(&R)" Restart fvwm -s
+ "&Quit fvwm%mini.stop.xpm%" FvwmForm FvwmForm-QuitVerify
+ "重启系统(&B)" Exec exec gksu -m "想重启?输入密码。" reboot
+ "关机(&X)" Exec exec gksu -m "想关机?输入密码。" halt
DestroyMenu Programs
AddToMenu Programs
+ "网络(&N)" Popup Network
+ "工具(&T)" Popup Tools
+ "图像(&G)" Popup Graphics
+ "游戏(&A)" Popup Games
DestroyMenu Tools
AddToMenu Tools
+ "g&Vim编辑器" Exec exec gvim
+ "星际译王(&S)" Exec exec stardict
+ "V&irtualBox" Exec exec VirtualBox
#+ "完全配置 &Ubuntu" Exec exec ubuntu-tweak
+ "&FvwmConsole" Module FvwmConsole
DestroyMenu Network
AddToMenu Network
+ "&Firefox" JumpExec "Namoroka" firefox
+ "&Pidgin" JumpExec "Pidgin" pidgin
#+ "&Irssi" Exec exec xterm -geometry 90x27-0-0 -bg tan4 -title "Irssi" -e ~/应用/脚本/Irssi-Alias
#+ "&Mutt" Exec exec xterm -geometry 90x27-0+0 -bg blue4 -title "Mutt" -e mutt
#+ "&Start Dropbox" Exec exec dropboxd
#+ "S&top Dropbox" Exec exec pkill -9 dropboxd
DestroyMenu Graphics
AddToMenu Graphics
+ "&GIMP" JumpExec "图像" gimp
+ "&Evince 文档查看器" JumpExec "Document Viewer" evince
DestroyMenu Games
AddToMenu Games
+ "贪吃蛇(&S)" Exec exec xterm -geometry 60x40+0+0 -title SnakeGame -e sn-贪吃蛇.bash
+ "象棋(&C)" Exec exec gmchess
# 重新载入Conky配置,否则Conky会显示在其他窗口上面
Exec killall -USR1 conky
tlcr: 0 庚寅年八月廿五日 23:27:05 ~
●
代码: 全选
tlcr: 0 庚寅年八月廿五日 23:27:33 ~
● dog ~/.conkyrc
# Use Xft?
use_xft yes
xftfont ZhunYuan:size=12
# Update interval in seconds
update_interval 1
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type override
own_window_hints undecorate,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 400 400
maximum_width 400
# Draw shades?
draw_shades yes
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
#border_margin 5
# border width
border_width 0
# Default colors and also border colors
default_color ffffff
default_shade_color black
default_outline_color black
own_window_colour 262626
# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 5
gap_y 0
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2
# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer right
color0 000000
color1 B64040
color2 5DBE63
color3 E1A738
color4 7372D7
color5 CA4AB3
color6 5DBCBE
color7 FFFFFF
TEXT
${color blue}${tab 200}${font OpenLogos:size=48}B${voffset -5}${font}
${voffset -100}
${font ZhunYuan:size=23} ${color}${time %k:%M:%S}${font}
${color3}${execi 300 lc-农历.py -s}${color}
${color4}${hr}
${color}系统${alignr}
${color3}CPU${color2}${tab 30}${execp echo $(dog /sys/class/hwmon/hwmon1/device/temp1_input) / 1000 | bc}°C
${color3}风扇${color2}${tab 30}${execp echo $(dog /proc/acpi/ibm/fan | grep speed | awk '{print $2}')} /分钟
#Top CPU CPU% MEM%
${color3}cpu${color2}${tab 30}${top name 1}${alignr}${top cpu 1}${top mem 1}
#${top name 2}$alignr${top cpu 2}${top mem 2}
#${top name 3}$alignr${top cpu 3}${top mem 3}
#
#Top MEM CPU% MEM%
${color3}mem${color2}${tab 30}${top_mem name 1}${alignr}${top_mem cpu 1}${top_mem mem 1}
${execp net.perl}
#${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}
#${top_mem name 3}$alignr${top_mem cpu 3}${top_mem mem 3}
#${color}时间${stippled_hr}
#$HOME/应用/脚本/lc-农历.py -s}
#${color}天气${stippled_hr}
#${color yellow}${execpi 300 wg-天气.perl -c | sed -e 's@,@,\n@g' | sed -e 's@°C @&\n@g'}
${color4}${hr}
${color3}RSS${alignr}
${execpi 600 rr-RSS.perl} # | sed -re 's/.{29}/&\n/g'}
${color4}${hr}
${color3}天气${alignr}
#${color2}${voffset -20}${execpi bash -c '300 weather.perl | grep "$(lc-农历.py -s)" | awk -f"\t" \'{print $2,$3,$4;}\' | sed -re "s/\x1b\[.*?[mK]//g;s/\t/\n/g'}
${color2}${execi 300 wg-天气.perl | sed -e 's@, @, \n@g' | sed -e 's@°C @&\n@g'}
${color4}${hr}
${color3}后台${alignr}
${if_running mlnet}${color3}mlnet${color}
${execp mlinfo.perl -s | ansi2conky.perl}${endif}
#${color}网络${stippled_hr}
${color4}${hr}
${color3}待办事项${alignr}
${execpi 20 devtodo --force-colour | ansi2conky.perl | sed -re 's#^\x1b\[\?[0-9]+?h##g'}
${color4}${hr}
tlcr: 0 庚寅年八月廿五日 23:27:38 ~
●
代码: 全选
tlcr: 0 庚寅年八月廿五日 23:31:39 ~
● dog ~/.zshrc
#color{{{
autoload colors
colors
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval _$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval $color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
FINISH="%{$terminfo[sgr0]%}"
#}}}
#命令提示符 {{{
#RPROMPT=$(echo "$RED%D %T$FINISH")
#PROMPT=$(echo "$BLUE%M$GREEN%/
#$CYAN%n $_YELLOW>>>$FINISH ")
#}}}
#标题栏、任务栏样式{{{
#case $TERM in
# (*xterm*|*rxvt*|(dt|k|E)term)
# precmd () { print -Pn "\e]0;%n@%M//%/\a" }
# preexec () { print -Pn "\e]0;%n@%M//%/\ $1\a" }
# ;;
#esac
#}}}
#关于历史纪录的配置 {{{
#历史纪录条目数量
export HISTSIZE=10000
#注销后保存的历史纪录条目数量
export SAVEHIST=10000
#历史纪录文件
#export HISTFILE=~/.zhistory
#以附加的方式写入历史纪录
setopt INC_APPEND_HISTORY
#如果连续输入的命令相同,历史纪录中只保留一个
setopt HIST_IGNORE_DUPS
#为历史纪录中的命令添加时间戳
setopt EXTENDED_HISTORY
#启用 cd 命令的历史纪录,cd -[TAB]进入历史路径
setopt AUTO_PUSHD
#相同的历史路径只保留一个
setopt PUSHD_IGNORE_DUPS
#在命令前添加空格,不将此命令添加到纪录文件中
#setopt HIST_IGNORE_SPACE
#}}}
#每个目录使用独立的历史纪录{{{
#cd() {
# builtin cd "$@" # do actual cd
# fc -W # write current history file
# local HISTDIR="$HOME/.zsh_history$PWD" # use nested folders for history
# if [ ! -d "$HISTDIR" ] ; then # create folder if needed
# mkdir -p "$HISTDIR"
# fi
# export HISTFILE="$HISTDIR/zhistory" # set new history file
# touch $HISTFILE
# local ohistsize=$HISTSIZE
# HISTSIZE=0 # Discard previous dir's history
# HISTSIZE=$ohistsize # Prepare for new dir's history
# fc -R #read from current histfile
#}
#mkdir -p $HOME/.zsh_history$PWD
#export HISTFILE="$HOME/.zsh_history$PWD/zhistory"
export HISTFILE="$HOME/.zhistory"
#function convhistory {
# sort $1 | uniq |
# sed 's/^:\([ 0-9]*\):[0-9]*;\(.*\)/\1::::::\2/' |
# awk -F"::::::" '{ $1=strftime("%Y-%m-%d %T",$1) "|"; print }'
#}
#使用 histall 命令查看全部历史纪录
#function histall { convhistory =(allhistory) |
# sed '/^.\{20\} *cd/i\\' }
#使用 hist 查看当前目录历史纪录
#function hist { convhistory $HISTFILE }
#全部历史纪录 top44
function top44 { dog "$HISTFILE" | awk -F':[ 0-9]*:[0-9]*;' '{ $1="" ; print }' | sed 's/ /\n/g' | sed '/^$/d' | sort | uniq -c | sort -nr | head -n 44 }
#}}}
#杂项 {{{
#允许在交互模式中使用注释 例如:
#cmd #这是注释
setopt INTERACTIVE_COMMENTS
#启用自动 cd,输入目录名回车进入目录
#稍微有点混乱,不如 cd 补全实用
#setopt AUTO_CD
#扩展路径
#/v/c/p/p => /var/cache/pacman/pkg
setopt complete_in_word
#禁用 core dumps
limit coredumpsize 0
#Emacs风格 键绑定
bindkey -e
#设置 [DEL]键 为向后删除
bindkey "\e[3~" delete-char
#以下字符视为单词的一部分
WORDCHARS='*?_-[]~=&;!#$%^(){}<>'
# 不显示bad pattern的信息。
unsetopt badpattern
#}}}
#自动补全功能 {{{
. ~/.zsh/complete
#}}}
##行编辑高亮模式 {{{
# Ctrl+@ 设置标记,标记和光标点之间为 region
zle_highlight=(region:bg=magenta #选中区域
special:bold #特殊字符
isearch:underline)#搜索时使用的关键字
#}}}
##空行(光标在行首)补全 "cd " {{{
user-complete(){
case $BUFFER in
"" ) # 空行填入 "cd "
BUFFER="cd "
zle end-of-line
;;
"cd --" ) # "cd --" 替换为 "cd +"
BUFFER="cd +"
zle end-of-line
;;
"cd +-" ) # "cd +-" 替换为 "cd -"
BUFFER="cd -"
zle end-of-line
;;
esac
zle expand-or-complete
}
zle -N user-complete
bindkey "\t" user-complete
#}}}
##在命令前插入 sudo {{{
#定义功能
#sudo-command-line() {
# [[ -z $BUFFER ]] && zle up-history
# [[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
# zle end-of-line #光标移动到行末
#}
#zle -N sudo-command-line
#定义快捷键为: [Esc] [Esc]
#bindkey "\e\e" sudo-command-line
#}}}
#命令别名 {{{
#alias -g rm='RemoveFile'
alias ls='ls -h --color=always -X '
#alias l='ls-l -h --color=always -X --time-style="+[%Y-%m-%d %k:%M]"'
alias l='ls -l'
alias sed='sed -r'
alias make=ColorMake
alias grep='egrep'
alias egrep="GREP_COLOR=\"\$(echo 3\$[\$(date +%N)%6+1]';1;4;40')\" egrep --color=always"
alias less='less -R'
alias df='df -Th'
alias du='du -h'
alias a=awk
alias s=sed
alias p=less
#alias g=grep
alias showip='curl ifconfig.me' # 显示计算机外网ip
alias irssi='Irssi-Alias'
#alias vim='screen -c $HOME/.screenrc-vim vim'
# 后缀别名
alias -g A='|awk'
alias -g L='|less'
alias -g P='|perl'
alias -g G="|g"
alias -g S='|sed'
alias -g B='S "s@\x1B\[[0-9;]*[mK]@@g"'
#[Esc][h] man 当前命令时,显示简短说明
alias run-help >&/dev/null && unalias run-help
autoload run-help
#历史命令 top10
#alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
#alias top10='history 0 | awk \'{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10'
# Screen Aliases
if [ "$TERM" = screen ] ; then
alias mutt='screen -t email mutt'
alias irssi='screen -t chat Irssi-Alias'
fi
#}}}
#路径别名 {{{
#进入相应的路径时只要 cd ~xxx
hash -d dw="$HOME/个人/下载"
hash -d scripts="$HOME/应用/脚本"
hash -d games="$HOME/应用/脚本/游戏"
hash -d tslinux="$HOME/应用/TusooaLinux"
#}}}
##for Emacs {{{
#在 Emacs终端 中使用 Zsh 的一些设置 不推荐在 Emacs 中使用它
if [[ "$TERM" == "dumb" ]]; then
setopt No_zle
PROMPT='%n@%M %/
>>'
alias ls='ls -F'
fi
#}}}
#{{{ F1 计算器
arith-eval-echo() {
LBUFFER="${LBUFFER}echo \$(( "
RBUFFER=" ))$RBUFFER"
}
zle -N arith-eval-echo
bindkey "^[[11~" arith-eval-echo
#}}}
####{{{
function timeconv { date -d @$1 +"%Y-%m-%d %T" }
# }}}
# vim:filetype=zsh foldmethod=marker autoindent expandtab shiftwidth=4
# PATHs manager
pathappend()
{
local dir="$1" pathvar="$2"
[ -z "$pathdir" ] && pathvar="PATH"
[ -d "$dir" ] &&
{
#eval "in_arg_list_PATH \"$dir\" \"\$$pathvar\"" ||
eval "$pathvar=\"\$$pathvar\${$pathvar+:}$dir\""
}
}
pathprepend()
{
local dir="$1" pathvar="$2"
[ -z "$pathdir" ] && pathvar="PATH"
[ -d "$dir" ] &&
{
#eval "in_arg_list_PATH \"$dir\" \"\$$pathvar\"" ||
eval "$pathvar=\"$dir\${$pathvar+:\$$pathvar}\""
}
}
PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/lib/pkgconfig"
# Sbin
pathappend /sbin
pathappend /usr/sbin
# Tusooa Tree
pathprepend "$HOME/应用/脚本"
pathprepend "$HOME/应用/脚本/游戏"
pathprepend "$HOME/应用/二进制"
# scripts-eexp
pathprepend "$HOME/应用/脚本/scripts-eexp"
# scripts-bones
pathprepend "$HOME/应用/脚本/scripts-bones"
# scripts-xiooli
pathprepend "$HOME/应用/脚本/scripts-xiooli"
# Opera
#pathprepend "/opt/opera/bin"
#pathprepend "/opt/opera/share/man" MANPATH
. ~/.zsh/distro
# Install File
pathprepend "$HOME/应用/链接/Executables"
#pathappend "$HOME/应用/安装/库/pkgconfig" PKG_CONFIG_PATH
#pathappend "$HOME/应用/安装/库" LD_LIBRARY_PATH
pathprepend "$HOME/应用/链接/Libraries" LD_LIBRARY_PATH
pathprepend "$HOME/应用/链接/Libraries/pkgconfig" PKG_CONFIG_PATH
# Compile-Program
pathprepend "$HOME/应用/源码/gcode-svn/compile-program"
# clean up
typeset -U PATH
export PATH
export PKG_CONFIG_PATH
export LD_LIBRARY_PATH
if distro arch ; then
# Pacman
pacman()
{
if [ -x '/usr/bin/powerpill' ] ; then
sudo powerpill "$@"
elif [ -x '/usr/bin/pacman-color' ] ; then
sudo /usr/bin/pacman-color "$@"
else
sudo /usr/bin/pacman "$@"
fi
local var
[ "$(echo "$@" | grep Sy)" ] || return 0
print -Pn "${_BLUE}::${FINISH} ${_WHITE}Do you want to upgrade the programs list?[Y/n]${FINISH} \n"
read var
case $var in
([Yy]|"") ;;
(*) return ;;
esac
sudo pacfile -S
mkdir -p $HOME/.share/
pacfile 'bin/[^\/]+$' > $HOME/.share/programsList && echo "programs list is up to date"
}
yaourt()
{
/usr/bin/yaourt "$@"
local var
[ "$(echo "$@" | grep Sy)" ] || return 0
print -Pn "${_BLUE}::${FINISH} ${_WHITE}Do you want to upgrade the programs list?[Y/n]${FINISH} \n"
read var
case $var in
([Yy]|"") ;;
(*) return ;;
esac
sudo pacfile -S
mkdir -p $HOME/.share/
pacfile 'bin/[^\/]+$' > $HOME/.share/programsList && echo "programs list is up to date"
}
srcpac()
{
sudo srcpac "$@"
local var
[ "$(echo "$@" | grep Sy)" ] || return 0
print -Pn "${_BLUE}::${FINISH} ${_WHITE}Do you want to upgrade the programs list?[Y/n]${FINISH} \n"
read var
case $var in
([Yy]|"") ;;
(*) return ;;
esac
sudo pacfile -S
mkdir -p $HOME/.share/
pacfile 'bin/[^\/]+$' > $HOME/.share/programsList && echo "programs list is up to date"
}
elif distro ubuntu ; then
apt-file()
{
sudo apt-file "$@"
if [ "$1" = update ] ; then
sudo apt-file search bin/ > "$HOME/.share/programsList"
fi
}
fi
command_not_found_handler() {
local l="$(grep /$1$ < $HOME/.share/programsList)"
if [ "$l" ]; then
echo "下列软件包含有命令 $1 :"
echo "$l" | awk '{print "\033[0;1;32m" $1 "\t\t\033[31m /" $2}'
else
echo "未搜索到含有命令 $1 的软件包"
fi
return 127
}
export EDITOR=vim PACKAGER='[email protected]'
export RM_DESTDIR="$HOME/.del"
rm()
{
local dest file i
mkdir -p $RM_DESTDIR
while [ $# -gt 0 ]
do
case "$1" in
-*)
shift
;;
*)
[ -z "$1" ] && continue
case "$1" in
/*)file=$1;;
*)file=$PWD/$1;;
esac
i=0
dest=$((i++))-$(basename $file)
while [ -f "$RM_DESTDIR/$dest" ] || [ -d "$RM_DESTDIR/$dest" ]; do
dest=$((i++))-$(basename $file)
done
mv $file $RM_DESTDIR/$dest
cat >> $HOME/.rm << EOF
Source:$file
Dest:$dest
EOF
shift
;;
esac
done
}
export FCDWDIR="$HOME/个人/下载/full circle"
# 输入法
export XMODIFIERS="@im=fcitx"
export QT_IM_MODULE=xim GTK_IM_MODULE=xim
export XIM=fcitx XIM_PROGRAM=fcitx
#export XMODIFIERS=@im=SCIM
#export GTK_IM_MODULE="scim"
#export QT_IM_MODULE="scim"
mkcd()
{
mkdir "$1" && cd "$1"
}
# Python
# 太烦了!居然有这么长的路径。
export PYTHONPATH2="$HOME/应用/库/脚本"
# 笨兔就是烦!
distro ubuntu &&
export PYTHONPATH2="$PYTHONPATH2:$HOME/应用/链接/Libraries/python2.6:$HOME/应用/链接/Libraries/python2.6/site-packages/gtk-2.0"
export PYTHONPATH3="$HOME/应用/库/脚本/Py3k"
. ~/.zsh/python
# LANG
if [[ $TERM = linux ]] ; then
LANG=en_US.UTF-8
else
LANG=zh_CN.UTF-8
fi
#autoload -U promptinit
#promptinit
#prompt adam2
precmd_增强()
{
local ret="$?" datenow
datenow="$(lc-农历.py -s 2>/dev/null) $(date +%T)"
cwd="$(pwd | sed -e "s#^$HOME#\~#")"
PROMPT="%{%}tlcr: ${ret} ${datenow} %~%{%}
%{%}●%{%} "
[ "$TERM" != linux ] && print -Pn "%{\e]2;term $cwd\a%}" || true
#print -Pn "%{\ekzsh\e\\%}"
}
# preexec()
#{
# # 其实对于不带标题的Fvwm没有什么作用
# [ "$TERM" != linux ] && print -Pn "${NOCOL}%{\e]2;$1 $(pwd | sed -e "s#^$HOME#\~#")\a%}" || true
#}
# preexec()
#{
# # 自动更换screen标题
# print -Pn "%{\ek$1\e\\%}"
#}
precmd_简单()
{
PROMPT="%K{green}%B%F{white}>>%b%f%k "
[ "$TERM" != linux ] && print -Pn "%{\e]2;term $cwd\a%}" || true
}
sp()
{
precmd(){ precmd_简单; }
}
ep()
{
precmd(){ precmd_增强; }
}
[ "$TERM" = linux ] && sp || ep
bin-exist() {[[ -x `whence -cp $1 2>/dev/null` ]]}
# less
#MOST like colored man pages
export PAGER=less
export LESS_TERMCAP_md=$'\E[1;31m' #bold1
export LESS_TERMCAP_mb=$'\E[1;31m'
export LESS_TERMCAP_me=$'\E[m'
export LESS_TERMCAP_so=$'\E[01;44;33m' #search highlight
export LESS_TERMCAP_se=$'\E[m'
export LESS_TERMCAP_us=$'\E[1;2;32m' #bold2
export LESS_TERMCAP_ue=$'\E[m'
export LESS="-M -i -R --shift 5"
export LESSCHARSET=utf-8
export READNULLCMD=less
# In archlinux the pipe script is in PATH, how ever in debian it is not
(bin-exist src-hilite-lesspipe.sh) && export LESSOPEN="| src-hilite-lesspipe.sh %s"
[ -x /usr/share/source-highlight/src-hilite-lesspipe.sh ] && export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s" || :
# Glob匹配失败的时候使用原来内容,不报错
setopt nonomatch
# Tips
. ~/.zsh/tips-"$(distro)"
. ~/.zsh/tips
tlcr: 0 庚寅年八月廿五日 23:32:21 ~
●