Scite 手冊頁 |
|
Linux:開啟 Scite 中選取字詞的手冊頁。
注意:這現在已內建 scite 中,或是我之前沒有注意到。只要反白關鍵字並按下 F1 即可。範例:反白 C 程式中的「printf」關鍵字並按下 F1。輸出窗格中將會顯示一個手冊頁。
不過,如果你寧願...
這個附加元件還提供了更多一點的功能。它會搜尋手冊頁的幾個區段:選項 -S 3:3p:2:2p:4:5:6:7:8:0p:1:1p 指示我們先搜尋「程式設計師手冊」區段。這些區段在你的平台上編號可能有所不同。更新:現在使用 c 風格語法突顯。
將函式插入 Scite 啟動腳本中。
範例自訂啟動腳本。.SciTEUser.properties 應包含類似以下的行
ext.lua.startup.script=$(SciteUserHome)/.SciTE/startup.lua現在將以下函式(可能需要 Lua > 5.1?)插入 .SciTE/startup.lua 中
-- Compatibility: Lua-5.1 function man_select(sel) sel=string.gsub(sel, '[<> ,*()\n\t]','') local ext = props['FileExt'] -- open lua manual on selected word if(ext=="lua") then -- todo: customize help for each file type os.execute("gnome-terminal -e 'lynx \"file:///usr/share/doc/lua-5.1.4/manual.html#pdf-"..sel.."\"'") else -- open c manual on selected word local tmpfile="/tmp/man_"..sel..".c" local cmd="man "..sel..">/dev/null&&man -S 3:3p:2:2p:4:5:6:7:8:0p:1:1p "..sel.."|col -b > "..tmpfile if Execute then Execute(cmd) else os.execute(cmd) end if(io.open(tmpfile)) then scite.Open(tmpfile) os.remove(tmpfile) end end end
以及在 .SciTEUser.properties 中
command.name.11.*=Programmer's Manual (selected text) command.11.*=man_select $(CurrentWord) command.shortcut.11.*=Ctrl+Shift+M command.subsystem.11.*=3 command.name.15.*=DevHelp (selected text) command.15.*=devhelp --search $(CurrentWord) & command.shortcut.15.*=Ctrl+Shift+G command.subsystem.15.*=1
最後一個指令是選用的,但 DevHelp? 是一個便利的參考,但前提是有安裝額外的 DevHelp? 文件。