Lua script for Geany to view manpage of functions

Wed 22 September 2010
  • 装备 tags:
  • c
  • foss
  • geany
  • linux
  • lua published: true comments: true

Requirement

When editing when Geany, you need some document of system library functions at hand. So you want to browse manpage at any time.

Solution

Just two lines:
[cc lang="lua"]
sel=geany.selection()
geany.launch('rxvt-unicode', '-e', 'man', sel)
[/cc] http://gist.github.com/591279

Install

Make sure you have geany-plugin-lua installed: sudo apt-get install geany-plugin-lua

Create a lua source file named 'ShowMan.lua' in ~/.config/geany/plugins/geanylua/ . If the direcotry does not exist, you should create it first.

Copy two lines of lua code into this file, save and close.

Create a file named hotkeys.cfg in ~/.config/geany/plugins/geanylua/, add following content: ShowMan.lua

Restart geany, then open Preferences->Keybindings, Lua Script-> ShowMan, bind a key, for example, Alt+m

Usage

Select the function name, and press Alt+m (or from menu Tools->Lua Scripts->ShowMan), then you see the terminal and the manpage.

geany-lua-manpage

The post is brought to you by lekhonee v0.7