作者dryman (dryman)
看板EE_DSnP
标题[闲聊] gnu readline library
时间Thu Nov 26 23:00:34 2009
刚刚无意中逛到这个有趣的东西(又从孤陋寡闻中往上爬了一步啦~)
http://tiswww.case.edu/php/chet/readline/rltop.html
它就是我们作业中的cmdParser
我觉得最有趣的地方是它支援开启时读入设定档(~/.xxxxrc)
bash, emacs都是用这个library XD
下面节录的指令是emacs like的
但是居然还可以设成vi like
set editing-mode vi
The GNU Readline library provides a set of functions for use by
applications that allow users to edit command lines as they are
typed in. Both Emacs and vi editing modes are available. The
Readline library includes additional functions to maintain a list
of previously-entered command lines, to recall and perhaps reedit
those lines, and perform csh-like history expansion on previous
commands.
1.2.1 Readline Bare Essentials
C-b
Move back one character.
C-f
Move forward one character.
DEL or Backspace
Delete the character to the left of the cursor.
C-d
Delete the character underneath the cursor.
Printing characters
Insert the character into the line at the cursor.
C-_ or C-x C-u
Undo the last editing command. You can undo all the way back
to an empty line.
1.2.2 Readline Movement Commands
C-a
Move to the start of the line.
C-e
Move to the end of the line.
M-f
Move forward a word, where a word is composed of letters and
digits.
M-b
Move backward a word.
C-l
Clear the screen, reprinting the current line at the top.
看到跟作业有相关就忍不住贴上来了:p
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.45.172.193
※ 编辑: dryman 来自: 114.45.172.193 (11/26 23:01)
1F:推 ric2k1:当初就是想要写一个简单的 readline lib 才有这个作业的.. 11/26 23:28
2F:推 hrs113355:cool 11/26 23:41
3F:推 verysure:哇好酷哦!!! 11/27 10:22