作者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)
推 ric2k1:當初就是想要寫一個簡單的 readline lib 才有這個作業的.. 11/26 23:28
推 hrs113355:cool 11/26 23:41
推 verysure:哇好酷哦!!! 11/27 10:22