Monday, July 31, 2006
Sunday, July 30, 2006
Thursday, July 27, 2006
Sunday, July 23, 2006
Tuesday, July 18, 2006
Thursday, July 06, 2006
How to tell emacs what to do when it receives a Delete or Backspace
Put in your .emacs file lines like
Of course you can bind other commands to other keys in the same way. Note that various major and minor modes redefine keybindings. For example, in incremental search mode one finds the code(global-set-key "\?" 'help-command)
(global-set-key "\C-h" 'delete-backward-char)
This means that it may be a bad idea to use the above two global-set-key commands. There are too many places where there are built-in assumptions about Ctrl-H = help and DEL = delete. That doesn't mean that you have to setup keys so that Backspace generates DEL. But if it doesn't then it is easiest to remap them at the lowest possible level in emacs.(define-key map "\177" 'isearch-delete-char)
(define-key map "\C-h" 'isearch-mode-help)
http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html
Below is to redefine keys.
http://cnsnap.cn.freebsd.org/doc/zh_CN.GB2312/books/developers-handbook/emacs.html
http://www-rcf.usc.edu/~christoj/.emacs
mess-up of arrow keys in emacs is solved. Awesome!
I am so excited now.
It is so awesome that the arrow key problem in emacs is solved. The problem is that while I started up some file with emacs, the arrow key will lose its function, and while I press those arrow key, some funny characters like "A", "B", etc will appear on the screen. INitially the problem occured to vim. After surfing internet for a while, I got the answer for vim, it is due to keyboard mapping problem. For the solution, please refer to previous post. Then, I started to work on the emacs keyboard problem. Although I have some idea that it is due to keyboard mapping problem, but still don't know where I should start, since I only know some basic stuff on emacs, like basic commands, no other further knowledge. So I set a direction to solve the problem: (1) To know what command is to bind a key. (2) what key should be bined.
After some test, finally the answer is to put below lines into .emacs.
-------------------------------------------
(global-set-key "^[OC" 'forward-char)
(global-set-key "^[OD" 'backward-char)
(global-set-key "^[OA" 'previous-line)
(global-set-key "^[OB" 'next-line)
-------------------------------------------
It should be pointed out that ^[OC should be braced with "" instead of square bracket which doesn't work as tested.
note that "^[" should be input by (ctrl+v) +[esc], rather than just copy them from screen here.
I got these inspiration from the links below, I really appreciate those people who have given me so much help anomyously.
http://www.xahlee.org/emacs/keyboard_shortcuts.html
Here are some convenient keyboard shortcuts i use, as a example of what type of keyboard shortcuts one can add to enhance productivity.
; keyboard alias for arrow keys
; with meta down,
; keys under the right hand home position become cursor keys
; Dvorak QWERTY
; c i
; htn jkl
(global-set-key "\M-h" 'backward-char) ; was mark-paragraph
(global-set-key "\M-n" 'forward-char) ; was not defined
(global-set-key "\M-c" 'previous-line) ; was capitalize-word
(global-set-key "\M-t" 'next-line) ; was transpose-words
http://gdfan.twbbs.org/blog/2005/09/21/328
http://www.vim.org/tips/tip.php?tip_id=550 (original link)
This doesn't really work very well for me on SunOS -- I have the same problem but :set term=cons25 just gives me OC everywhere before each character until I redraw. Weird.
But, :set term=ansi works great, and the arrow keys work.
A better solution is to, while in vi, type in insert mode [ctrl-v][arrow up] and see what you get.
Then, in your .vimrc, add the lines
set t_ku=[ctrl-v][esc]OA # or whatever you saw
so it ends up looking something like
set t_ku=^[OA
set t_kd=^[OB
set t_kr=^[OC
set t_kl=^[OD
(though you want REAL escape chars instead of ^[.)
how to remove the ^M character in unix.
http://www.vim.org/tips/tip.php?tip_id=26
http://www.computing.net/unix/wwwboard/forum/6031.html
http://web.mit.edu/answers/dialup/other_clean_ctrl_m.html
http://www.physics.ohio-state.edu/~faqomatic/fom-serve/cache/49.html
here is a code to remove the CTRL+M characters in a file.
http://forge.novell.com/modules/xfref_library/detail.php?reference_id=2358
Wednesday, July 05, 2006
solution to vim arrow key mapping problem.
在使用 vim 的插入模式(Insert mode)時候,按方向鍵(arrow key) ,卻出現 A B C D,游標(cursor)沒有正常的移動?多半是因為 TERM 環境變數設定的問題。今天在網路上找到了一個解法,直接在 .vimrc 中設定方向鍵的 mapping. 參考的文件是這裡
文章原文如下:
This doesn't really work very well for me on SunOS -- I have the same problem but :set term=cons25 just gives me OC everywhere before each character until I redraw. Weird.
But, :set term=ansi works great, and the arrow keys work.
A better solution is to, while in vi, type in insert mode [ctrl-v][arrow up] and see what you get.
Then, in your .vimrc, add the lines
set t_ku=[ctrl-v][esc]OA # or whatever you saw
so it ends up looking something like
set t_ku=^[OA
set t_kd=^[OB
set t_kr=^[OC
set t_kl=^[OD
(though you want REAL escape chars instead of ^[.)
Note: Please edit in vi editor.
(http://gdfan.twbbs.org/blog/2005/09/21/328)
http://www.vim.org/tips/tip.php?tip_id=550
Tuesday, July 04, 2006
Sunday, July 02, 2006
how to solve the problem that foobar 2000 cannot play ape file.
(http://forums.afterdawn.com/thread_view.cfm/345467)
You will need to download a seperate plugin in order to play ape files. You can grab it here.
http://www.foobar2000.org/components/foo_input_monkey.zip
Extract the zip file. Place foo_input_monkey.dll in X:\Program Files\foobar2000\components. X being the default drive letter. Run Foobar. Go to file menu, select preferences. Go to file types. Under file type association, check the boxes MAC and APE. Apply the changes. Foobar will now associate APE and MAC (Monkey's Audio) files.
(Note: This component has known unresolved stability issues.)
If you want to look for other plugins to extend Foobars functionality, you can also look here.
http://www.foobar2000.org/components/index.html