@eht16 @codebrainz I have defined 2 very simple python scripts for **to lower / upper** command separately, based on @eht16 's script, and assigned shortcut `CTRL + L` and `CTRL + U` to them respectively, it works on my Linux machine now.
## The scripts
**geanyLowerCase.py:**
#!/usr/bin/env python # -*- coding: utf-8 -*-
# geany - customized formatting - to lower case, import sys
def lower_case(string): return string.lower()
def main(): data = sys.stdin.read() sys.stdout.write(lower_case(data))
if __name__ == '__main__': main()
**geanyUpperCase.py:**
#!/usr/bin/env python # -*- coding: utf-8 -*-
# geany - customized formatting - to upper case, import sys
def upper_case(string): return string.upper()
def main(): data = sys.stdin.read() sys.stdout.write(upper_case(data))
if __name__ == '__main__': main()
## Additional steps to make it work
* Link these 2 scripts under `$PATH`. * Link script as command in geany. * in geany, * edit -> format -> send selection to -> set custom commands, * add the script, and label it, * remember its order in the commands, * Define shortcut for new commands. * edit -> preference -> keybindings -> format, * change key for "send to custom command x", where `x` is the order of you new command when define it, * Test it. * Done.
## Possible improvements needed
* After format via shortcut, the select text are not selected any more. Maybe it's better to still select those text after the action. * This is tested on Linux, not on windows yet,. Might need to modify the script a bit to make it work, e.g the `shebang` part.
## More scripts? * to Capital case. e.g `aBc` -> `Abc`