After trying for a while, geany is really easy to use. But it could be great if it could support more shortcuts:
**Suggested shortcuts:**
- To upper case e.g `ctrl + u` - To lower case * camel case, * * quick scroll down/up, via: ctrl + mouse wheel, *
These are the sorts of things that a plugin could easily do, did you check that none of them already do?
Some of your suggested keybindings are already taken (eg `ctrl+u` is unindent) but you can change them to your hearts content except `ctrl+scroll` which is taken for zoom and can't be changed.
I didn't find a suitable plugin to add these shortcuts. Editor/IDE like `Editplus` or `Eclipse` have such shortcut by default.
What the actual key is doesn't matter, as long as it's configurable.
The `ctrl` + `scroll` is wasted when used on zoom, nobody would use it for that, people rarely change the font size, but they do need to scroll quickly on a file that has many lines _(Both `Editplus` and `Eclipse` use it that way)_.
**So, my suggestions are:** - If you know a plugin that can do this please suggest. - If there is no such plugin: - Provide the additional keys that don't exists yet. - Make those keys configurable, include ctrl + scroll.
When using a editor/IDE, actually such small features make a huge difference, because that's the actions are used repeatedly & frequently, many times a day. They are more important than a fashion feature from my view.
`ctrl+scroll` is set by the [Scintilla](www.scintilla.org) widget, it would have to be changed there first I think.
Anybody can write a plugin, or if a suitable one exists the feature can be added, plugins are [here](https://github.com/geany/geany-plugins).
Different people have different ideas on what makes a huge difference to their experience. Clearly nobody who currently uses Geany missed the feature enough to implement and contribute it, not even in a plugin.
@elextr So, when editing a large file, how do you scroll down/up quickly? And,
And the upper/lower keys are also very common I guess, otherwise they won't be implemented in most editors.
when editing a large file, how do you scroll down/up quickly?
scrollbar?
As I said, scrolling is a function of the editing widget Geany uses, any extra features need to be implemented there first.
And the upper/lower keys are also very common I guess, otherwise they won't be implemented in most editors.
Mixed case is very common in particular programming languages and not in others, maybe most Geany users don't use mixed case so much. I'm just pointing out that the lack hasn't annoyed anyone enough so far for them to contribute anything more than `Toggle case of selection`. To be clear Geany is a totally volunteer project, things happen only because somebody contributes it, so if it doesn't exist then either its not wanted enough to make the effort or far too hard (and it really isn't far too hard).
@kuchaguangjie if case fiddling is so important to your workflow then maybe you could contribute a pull request?
@elextr I want to, but I am not a professional C programmer. But I always like C programming, so I might have a try.
You probably know, toggling case (lower vs. upper case) can already be done with `Ctrl`-`Alt`-`u` and this shortcut can also be configured.
For CamelCase conversion, ages ago I wrote a simple little Python script to just do that: https://gist.github.com/eht16/52067a31f2d8cfc3c0fac87d2ab70e28
Configure this script in Geany as command in the "Send selection to" settings, like in the screenshot. Then select some text and use `Edit->Send Selection to->CamelCase`. The script also tries to detect if it is CamelCase to convert to lower_case and vice versa. For me this works fine since a couple of years.
If I find time, I'll put it in the wiki. HTH. ![geany_camel_case](https://user-images.githubusercontent.com/617017/44619652-9eebb200-a88a-11e8...)
@eht16 I think toggle case is still different from to lower/upper, because if you want to change `Hi` to `HI`, with `ctrl + alt + u`, you need to press the shortcut twice to perform the transaction. So, I think it's better to have 2 separated shortcuts for to upper & to lower.
@kuchaguangjie you can use the custom command feature @eht16 referred to for any kind of transformation like this, using any programming language you want. For example in Python you could make the up/down commands something like this (untested):
```bash # up python -c 'import sys; sys.stdout.write(sys.stdin.read().upper())' # down python -c 'import sys; sys.stdout.write(sys.stdin.read().lower())' ```
As for fast scrolling, a couple alternatives are to use the <kbd>Page Up</kbd> and <kbd>Page Down</kbd> keys (available on full US keyboards at least), and/or you could use the [Overview Plugin](https://github.com/codebrainz/overview-plugin/) to quickly jump over large ranges in the file.
If those aren't suitable and you know more Python than C, C++, or Vala, you could use [GeanyPy](https://plugins.geany.org/geanypy.html) to implement such a feature in your own plugin.
@codebrainz I will give a try thanks.
@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`
Closed #1929.
@kuchaguangjie neat, nice info. You can get the same result without writing separate files or adjusting `$PATH` using the one-liners I posted above, can just plug them right in as "custom commands".
@codebrainz Ok, got it, and I just update the comment with a capital case script.
@codebrainz Just make it work on windows with command only without script file as suggested.
**Commands:**
* lower `python -c "import sys; sys.stdout.write(sys.stdin.read().lower())"` * upper `python -c "import sys; sys.stdout.write(sys.stdin.read().upper())"` * capital `python -c "import sys; sys.stdout.write(sys.stdin.read().title())"`
**But it's a bit different from linux**, to make it work need to make sure following tips are applied.
**Tips:**
- Make sure **python** is in `PATH`. Refer: https://stackoverflow.com/questions/11439607/geany-unable-to-execute-python - In the script line, need to use double quote, other than single quote, otherwise will get error. e.g `python -c "import sys; sys.stdout.write(sys.stdin.read().lower())"` Refer: https://stackoverflow.com/a/39401530
github-comments@lists.geany.org