2006/01/27

VIM TIP17

VimTip 17: Erasing previosuly entered characters in insert mode
在插入模式删除先前录入字符


In insert mode, to erase previously entered characters, set the following option:
在插入模式下,删除先前字符可以做以下设定:
set backspace=2

By default, this option is empty. If this option is empty, in insert mode, you can not erase characters entered before this insert mode started. This is the standard Vi behavior.
默认此选项为空。如果选项为空的话,在插入模式,你将无法删掉录入的字符除非你打开backspace。这是标准的VI行为#莫非俺的vi为非标准的非传统的?有可能,我测试结果使在windows下的gvim6.4 backspace为空亦能够删除字符
To get more help on this, use
更多帮助请看:
:help 'backspace'

#奇怪?根据帮助我的backspace的默认值indent, eol, start,即backspace =2。所以嘛,传统也是要改变的……


Technorati Tags: ,

2006/01/25

VIP TIP14

VimTip 14: Highlighting all the search pattern matches 高亮显示所有搜索匹配项 To highlight all the search pattern matches in a file set the following option: 高亮显示所有搜索的匹配项可以通过命令 :set hlsearch After this option is set, if you search for a pattern, all the matches in the file will be highlighted in yellow. 这样设定后高亮显示所有搜索的匹配项#又唐僧了不是?! To disable the highlighting temporarily, use the command 暂时废除高亮使用命令 :nohlsearch This command will remove the highlighting for the current search.The highlighting will come back for the next search. 命令可以取消当前搜索的高亮。下次搜索还会高亮 To disable the highlighting completely, set the following option: 废除高亮使用命令 :set nohlsearch By default, the hlsearch option is turned off. 默认高亮搜索是关闭的#我的是开启的,哈哈 To get more help on this option, use 想知道更多,请查阅帮助 :help 'hlsearch' :help :nohlsearch Technorati Tags:

VIM TIP15

VimTip 15: Displaying status line always
总是显示状态行

To display the status line always, set the following option in your .vimrc file:
总是显示状态行,在配置文件中加入:
set laststatus=2

The advantage of having the status line displayed always is, you can see the current mode, file name, file status, ruler, etc.
总是显示状态行的优点就是可以随时看到文件名,及其状态和标尺等等信息。
To get more help on this, use
更多信息请查阅帮助

:help laststatus



Technorati Tags:

2006/01/24

上帝与Google,玉帝与Baidu

最早的时候,上帝很无聊,平时只能看看电视听听广播,偶尔玩玩超级玛丽,再就是和圣母玛丽亚通通电话.时间长了,这种生活越发枯燥.上帝觉得这样的生活太乏味,于是他说:“要有网”.然后就有了互联网,计算机都可以连在一起,这是第一天.  
  光是有互联网也不行,起码得有点东西看吧。上帝说:“要有网站”。然后就有了全世界各种各样的大小网站,上帝在网站上看新闻、看图片,顺便还到论坛上发发贴,觉得互联网有些意思,这是第二天。  
  圣母玛丽亚看上帝这两天没怎么打电话,比较生气,威胁上帝说要把互联网毁了,上帝觉得这样不好,于是上帝说:“要有即时通讯”。然后就有了即时通讯软件,上帝和圣母玛丽亚在互联网上视频语音聊天,圣母玛丽亚也觉得互联网很好玩,这是第三天。  
  网站的数量太多了,也不知道那个网站更好看,上帝觉得这样太杂乱,于是上帝说:“要有导航网站”,然后就有了导航网站,上帝觉得分类目录挺好的,这是第四天。  
  没想到,网站越来越多,网页也越来越多,找分类目录都找不过来了,上帝觉得比较郁闷,心想找个东西怎么这么难呢?但这难不倒上帝,上帝说:
“要有搜索引擎”,然后就有了搜索引擎,上帝使用搜索引擎,很快的就可以找到自己想要的东西,上帝觉得非常有成就感,这是第五天。  
  在第一天上帝搞互联网的时候,远在天界东边的玉皇大帝就从千里眼和顺风耳那里得到了线报。玉帝有点迷惑,“这哥们搞什么东东呢?”问了所有神仙,大家都不知道,玉帝觉得这样不行,我们得与时俱进,向西方学习。玉帝说:“要有中国互联网”。于是中国也有了互联网。  
  第二天,玉帝上互联网,全是英文网站,除了图片以外,什么都看不懂,玉帝很头大。玉帝说:“要有中文网站”。于是中文网站雨后春笋般的出现了。  
  第三天,玉帝不爽了,为什么?联系不方便啊,还是要叫千里眼和顺风耳,丫的,太麻烦了,可是ICQ、MSN都是英文的啊?玉帝说:“要有中文的及时通讯。”于是有了QQ。玉帝玩上了QQ,跟王母娘娘聊的很开心。  
  第四天,中文网站也太多了,看的玉帝眼花缭乱,心情也比较烦乱,就问太白金星怎么办。太白金星这个老家伙说:“好,一得给他们分类,二得推荐
些好网站,三得经常有新东西……”玉帝觉得他很罗嗦。玉帝说,你说什么“好一二三”?然后,hao123就解决了玉帝和中国大众上网导航的问题。    
/>白金星凑过来说,上帝那有个Google,挺不错的,推荐你用用。于是玉帝上Google,一眼看过去,全是英文的,玉帝直接爆炸了,回头把太白金星骂了
个狗血喷头:“你这什么馊主意?让我用他们搞的东西?没听过国货当自强吗?这个玩意我们得自己搞!”玉帝转过身问文曲星该怎么办,文曲星慢条斯里的吟开场
白:“众里寻她千百度,那人却在……”,玉帝说:“千你个头啊,百度!”这一瞬间,百度中文搜索引擎诞生了!  
  玉帝很满意百度。在百度,不但可以便捷的找到想要的信息,还可以在百度mp3搜索上找些小曲听听,更可以躲开王母偷偷的在百度图片搜索弄几张
嫦娥的写真照片看看,更绝的,是玉帝在百度贴吧开了个“玉皇大帝”吧来了解天下百姓对自己的歌功颂德——而这些是Google所没有的。时间长了,甚至在
众神仙为某个事上吵个不停的时候,玉帝就会说:“有问题,百度一下!”然后就没问题了。  
  然而众神仙不明白,为什么玉帝不喜欢同样有中文版的Google,仅仅因为百度更符合中国大众使用习惯吗?后来,玉帝终于自揭谜底:这些洋网站总说用户是上帝,用户是上帝,用户真的是上帝?在中国,用户是玉帝!”大家恍然大悟。

Technorati Tags:

VIM TIP8

VimTip 8: Jumping to the declaration of a local/global variable

'gd' command To jump to the declaration of a local variable in a C program, position the cursor on the name of the variable and use the gd command.
gd 在c语言中就是跳到光标下本地变量的声名处
'gD' command: To jump to the declaration of a global variable in a C program, position the cursor on the name of the variable and use the gD command.
gD 在c语言中就是跳到光标下全局变量的声名处
#其实啊,在普通的文件中我觉得两个命令跟*和#基本上是一样的
My del.icio.us Tags




Technorati Tags:

VIM TIP13

VimTip 13: Incremental search 增强版搜索 To move the cursor to the matched string, while typing the search string, set the following option in the .vimrc file: 在输入关键字的时候移动光标到匹配词,可以在配置文件中添加 set incsearch You can complete the search by pressing the Enter key. To cancel the search, press the escape key. 可以通过按Enter完成搜索,ESC取消搜索 #又是挺无聊的一个技巧 Technorati Tags:

VIM TIP12

VimTip 12: Converting tabs to spaces 让制表符变成空格 To insert space characters whenever the tab key is pressed, set the 'expandtab' option: 想要按下TAB的时候插入的是空格的话,请做如下设定: set expandtab With this option set, if you want to enter a real tab character use Ctrl-V key sequence. 在此设定下,想要输入真正的TAB制表符,用Ctrl-V #说实话,这条tip似乎没有什么用啊~用ts什么的停方便的啊 Technorati Tags:

VIM TIP11

VimTip 11: Completing words quicky in insert mode 自动单词补全 In Insert mode, press the Ctrl-p or Ctrl-n key to complete part of a word that has been typed. 在插入模式下,Ctrl-pCtrl-n 可以补全已经录入单词 This is useful while typing C programs to complete long variable and function names. This also helps in avoiding typing mistakes. 很有用在编程过程中有长的变量或函数名时,也可以有效的避免拼写错误 Note that using the 'complete' option, you can complete keywords defined in one of the include files, tag file, etc. 值得注意的时,使用补全模式,可以补全在include文件或tag文件中的单词 To get more help on this, use 想知道更多,请查阅帮助 :help i_Ctrl-N :help i_Ctrl-P :help ins-completion :help complete Technorati Tags:

VIM TIP10

VimTip 10: Jumping to previosuly visited locations in a file 跳转到文件先前浏览过的位置 Vim remembers all the locations visited by you in a file in a session. You can jump to the older locations by pressing the Ctrl-O key. You can jump to the newer locations by pressing the Ctrl-I or the key. Vim 记得在编辑过程中光标所有的移动位置。可以通过Ctrl-O 来跳转先前位置,Ctrl-I 可以跳转到后来的位置。 #经试验,似乎两个命令发生打开历史文件的作用。类似浏览器中的前进、后退命令。 To get more help on these keys, use 想知道更多,请查阅帮助 :help CTRL-O :help CTRL-I :help jump-motions Technorati Tags:

VIM TIP9

VimTip 9: Displaying a variable/macro definition
显示变量、宏定义


To display the definition of a variable, place the cursor on the variable and use the [i command. To display a macro definition, place the cursor on the macro name and use the [d command.
显示变量、宏定义可将光标放在变量下用[i 命令。宏定义使用[d
Note that these commands will work most of the time (not all the time).
以上命令在绝大多数场合都使用(非所有)#唐僧了吧又
To get more help on these commands, use
想知道更多,请查阅帮助
:help [i
:help [d

Technorati Tags:

Technorati Tags:

2006/01/23

VIM TIP8

VimTip 8: Jumping to the declaration of a local/global variable



'gd' command:
To
jump to the declaration of a local variable in a C program, position
the cursor on the name of the variable and use the gd command.
gd 在c语言中就是跳到光标下本地变量的声名处
'gD' command:
To
jump to the declaration of a global variable in a C program, position
the cursor on the name of the variable and use the gD command.
gd 在c语言中就是跳到光标下全局变量的声名处
#其实啊,在普通的文件中我觉得两个命令跟*和#基本上是一样的
My del.icio.us Tags

VIM TIP6

VimTip 6: Using the % key 使用% The % key can be used %是很有用的!

  1. To jump to a matching opening or closing parenthesis, square bracket or a curly brace i.e. ([{}])
  2. To jump to start or end of a C-style comment /* */.
  3. To jump to a matching #if, #ifdef, #else, #elif, #endif C preprocessor conditionals.
  1. 找到匹配得括号
  2. 找到匹配得c语言风格注释/**/
  3. 找到匹配得c语言预处理块#if, #ifdef,#else, #elif, #endif
To get more information about this, do 想知道更多,请查阅帮助: :help % The % key can be extended to support other matching pairs by modifying the "matchpairs" option. Read the help on 当然,%也可以通过扩展来增加对其他匹配对得匹配查找,想知道请: :help matchpairs
My del.icio.us Tags

VIM TIP7

VimTip 7: Jumping to the start and end of a code block 在代码块中头尾间的跳跃 To jump to the beginning of a C code block (while, switch, if etc),use the [{ command. 跳到代码块头,用[{ To jump to the end of a C code block (while, switch, if etc),use the ]} command. 跳到代码块头,用]} The above two commands will work from anywhere inside the code block. 上边两个命令在代码块中的任何地方都适用 To jump to the beginning of a parenthesis圆括号 use the [( command. 跳到 To jump to the end of a parenthesis圆括号 use the ]) command. To get more help on these commands, do 想知道更多,请查阅帮助
:help [{ :help ]} :help [( :help ])
My del.icio.us Tags

VIM TIP5

VimTip 5: Quickly searching for a word 快速单词搜索技巧 To search for a word under the cursor in the current file you can use either the "*" or "#" keys. 可以用“*”或“#”来搜索光标下的单词 The "*" key will search for the word from the current cursor position to the end of the file. The "#" key will search for the word from the current cursor position to the top of the file. “*”是下文搜索,“#”是上文搜索。 Note that the above two keys will search for the whole word and not the partial word. This is equivalent to using the pattern in the search commands (/ and ?). 注意以上*和#两种用法同/ 和?的用法都是,用来查找整词而不是检索词是被包含在其中单词 To search for partial matches, you can use the "g*" and "g#" keysequence. 找检索词被包含在检索结果中单词 可以用g*和g# You can also use the mouse to search for a word. 同样可以用鼠标来搜索单词 This will only work in the GUI version of VIM (gvim) or a console version of VIM in an xterm which accepts a mouse. 当然实在gvim或支持鼠标的xterm类似的终端环境下 Also, the 'mousemodel' should be set to 'extend'. Add the following line to your .vimrc: 想用的话当然得扩展一下 。在配置文件中加: set mousemodel=extend To search for a word under the cursor from the current cursor position to the end of the file, press the shift key and click on the word using the left mouse button. To search in the opposite direction, press the shift key and click on the word using the the right mouse button. 这样就可以使用shift+左键来搜索下文中光标下得单词咯,上文搜索是shift+右键 To get more help on these, use 想多知道得话查帮助吧! :help * :help # :help g* :help g# :help :help My del.icio.us Tags

由vi和emacs的圣战想

vi抑或Emacs,这是个问题。
对于国外的geek来说,这个问题引发了一次次口诛笔伐,可谓geek圣战。不经意间发现了这样几片文章:
或许对大多数人会说“有什么好争的,编辑器 Notepad就够了,许多IDE中自带的编辑器就够了嘛”;一如浏览器ie就够了,大不了用Maxthon嘛。其中暴露出来的是一种及其恶劣的惰性,懒惰是一种美德,而精致的懒惰或许就是另外的一种境界了。
很多的时候,如同布道者一样苦口婆心介绍,如同传教士一样推广,得到怕麻烦之类的反映亦已习以为常。
所谓人性化、科技以人为本原是广告自我标榜得字汇,易用性、用户习惯是商家产品设计的目标,如今确成为各色人等的人生信条。哪怕是牺牲暂时的适应来获得长久的快捷。对于用户来说,这,的确是个台阶。

希望自己能够成为精致的懒惰的强迫症,偏执狂患者

My del.icio.us Tags:vi,emacs
Technorati Tags: ,

好想一起去旅行

有一什么乐队来着?对,叫星期三的旅行吧?赝品MazzyStar,赝的有点多的那种,不过名字这会听来极为受用。

她在旅行,一个人,为了那个12年前许诺,经历了进15个小时历史上罕见的铁路晚点,出发了……

好想一起去旅行。

其实我们一直都是在旅行,当然不是空间上的那种旅行。因为我们不是叮当,所以这种非空间旅行没有双程票,只是单行道,且不知道目的地,不定到哪就是终点了;没法停,一旦停就是永久的停了;路上及其容易被沿途的风光、旅途的疲劳所淹没,忘记自己是谁,在干吗,一迷糊就一位自己是上帝在天堂巡游要么就是绑老虎凳上嘴里灌了辣椒水的严刑拷打宁死不屈的共产党。其实就一旅客旅行嘛。切

真的,好想一起去旅行。随便什么地,一起就行



Technorati Tags:

2006/01/17

踏上归途

东西还没有收拾好

归心似箭……

一年了吧要有

继续加油

2006/01/15

VIM TIP4

VimTip 4: Any word completion
#自动拼写补齐 ;谁能想想中文的输入补齐?×_×

Either when programming or writing, I tend to have some identifiers or words that I use all the time.
#在写字或编程的时候,总想弄点我总用的标识符来省事;懒惰是灵感的源泉!

By sheer accident, I noticed the 'ctrl-n' command, that will attempt to complete the word under the cursor.
#撞大运后发现 ctrl-n 是在自动补齐
Hit it once, and it will try to complete it with the first match in the current file.
#一次一个
If there is no match, it will (at least in the case of C code) search through all files included from the current one.
#若没有的话,在C 语言的环境下,它将会补齐库的名字
Repeated invocations#符咒。哇,魔法耶 will cycle through all found matches.
#重复ctrl-n 会循环来补齐

VIM TIP3


VimTip 3: use vim to quickly compile java files
#快速编译java

For a number of years I used vim on an SGI box.
#老外的电脑品种那叫个多啊,这里的SGI box也是其中的一种
When I left my job at SGI I went to a company that developed on PCs.
#PC基本上是大白菜级别的玩意
For 2 years I used IDEs. I was unhappy. I was frustrated. #失落,挫败,怎么还没记住这词啊?
I couldn't figure out why. (Beyond my machine crashing twice a day.)
#大白菜老是要坏,整的特郁闷
Finally I upgraded to windows 2000 (kind of stable!) and started using vim as an IDE. All was good.
#还好,用了稳定的win2000。译者注:m$里算是稳定的win2000,艾,帮他加个
is how you use vim to compile your java:
#配置开发java的环境
1.While I'm sure this works with javac, javac is slow slow slow. So download the Jikes complier first. (Jikes is from ibm, search on google for jikes and you will find it..available on most platforms.)
#javac太烂了,用ibm的jikes吧~
2.Add the following to your vimrc:
set makeprg=jikes -nowarn -Xstdout +E
set errorformat=%f:%l:%c:%*\d:%*\d:%*\s%m
#加上边两行进vimrc
3. When you are editing a java file type :make and it will compile the current file and jump you to the first error in the file (if any). Read ":help quickfix" for how to move between errors.
#当你编辑一个java文件时,:make 会编译当前文件,并且跳转到第一个错误的地方。想知道怎#么在错误中跳来跳去嘛?看:help quicktext
To setup your classpath environment either launch gvim from a shell that has your classpath/path setup or use the "let" command to configure it in your vimrc.
#设定classpath环境……

其实java俺不懂,有空汇报一下我的python在vim中的设定


2006/01/14

VIM TIP2

VimTip 2: easy edit of files in the same directory #如何方便的编辑相同文件夹下的文件 It was often frustrating #挫败 when I would open a file deep in the code tree and then realize I wanted to open another file in that same directory. #如果这样的话的确很烦 Douglas Potts taught me a nice way to do this. Add the following snipit to your vimrc: #Douglas高手指点说: " Edit another file in the same directory as the current file " uses expression to extract path from current file's path " (thanks Douglas Potts) if has("unix") map ,e :e . "/" />else map ,e :e . "\" />endif #在配置文件里加这么一段 Then when you type ,e in normal mode you can use tab to complete to the file. You can also expand this to allow for spitting, etc. Very very nice. #当你敲“,e”的时候,就可以用Tab来选你想编辑的文章咯 p.s. 为什么不用类似filetree或者winmanager这样的plugin呢?方便的很啊!另外vim官方网站本条tip下的评论还是有点意思的~感兴趣自己刨哈!

VIM TIP1

VimTip 1: the super star When a discussion started about learning vim on the vim list Juergen Salk mentioned the "*" key as something that he wished he had know earlier. When I read the mail I had to go help on what the heck the "*" did. I also wish I had known earlier... “菊花”键是很有用的,老外说话好费劲啊~中国四个字足以:相见恨晚 Using the "*" key while in normal mode searches for the word under the cursor. “菊花”是查找光标下相同单词用的~ If that doesn't save you a lot of typing, I don't know what will. 如果这样都不能减少你的录入的话,我真不知道什么会了~哈哈,似乎用虚拟语态的话更有感情一些哦

2006/01/13

每日一踢 VIM TIP0

VimTip 0: downloading Vim tips If you are reading this in a help window, then you have probably already installed the "Tip of the Day" script, totd.vim . Congratulations! You can now replace this skeleton#学单词啊学单词:骨架,框架 file with a real vimtips.txt file downloaded from #废话半天的意思就是 鼓励一下! http://vim.sourceforge.net/tip_download.php If you have not yet installed the totd.vim plugin #可能嘛? check that it is in the plugin/ directory. (This file should be in plugin/vimtips/ .) #继续做广告 Then either wait until the next time you start up vim, or source the plugin and get a tip: :runtime plugin/totd.vim :TipOfTheDay (The usual abbreviation rules apply: you can probably just use :Tip .) This file should then show up in a help window #找踢有很多中办法,:Tip,:TipOfTheDay,:runtime plugin/totd.vim

2006/01/05

不可思议

成都的天空竟然在飘雪……
瑞雪兆丰年啊
we will be lucky