Todd,
Couple of comments below that may be helpful
A newbie question: How do I print out the strings?Copying some methods within the geany code, the below builds:
[keys]line_down=C+K CA+Kline_up=C+I CA+I
static void setup_sci_keys(ScintillaObject *sci){gchar *keyconfigfile;GKeyFile *keyconfig = g_key_file_new();keyconfigfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "keys.conf", NULL);g_key_file_load_from_file(keyconfig, keyconfigfile, G_KEY_FILE_NONE, NULL);get_keybindings(keyconfig);
g_free(keyconfigfile);g_key_file_free(keyconfig);
static void get_keybindings(GKeyFile *config){const gchar group[] = "keys";gchar **keys = g_key_file_get_keys(config, group, NULL, NULL);gchar **ptr = keys;
gchar **list;gsize len;if (!ptr)return;
while (1){const gchar *key = *ptr;
if (!key)break;list = g_key_file_get_string_list(config, group, key, &len, NULL);// int i=0;// for(i<list.length; i++) {// printf("%s", list[i]);// }}g_strfreev(keys);}
On Sun, Jan 30, 2011 at 8:42 PM, Lex Trotman <elextr@gmail.com> wrote:
On 31 January 2011 12:15, Todd Chambery <todd.chambery@gmail.com> wrote:
Just browsing the Notepad++ code, it looks like this is the method to update Scintilla's mappings:void ScintillaAccelerator::updateKeys(){NppParameters *pNppParam = NppParameters::getInstance();vector<ScintillaKeyMap> & map = pNppParam->getScintillaKeyList();size_t mapSize = map.size();size_t index;for(int i = 0; i < _nrScintillas; i++){::SendMessage(_vScintillas[i], SCI_CLEARALLCMDKEYS, 0, 0);for(size_t j = mapSize - 1; j >= 0; j--) //reverse order, top of the list has highest priority{ScintillaKeyMap skm = map[j];if (skm.isEnabled()){ //no validating, scintilla accepts more keyssize_t size = skm.getSize();for(index = 0; index < size; index++)::SendMessage(_vScintillas[i], SCI_ASSIGNCMDKEY, skm.toKeyDef(index), skm.getScintillaKeyID());}if (skm.getMenuCmdID() != 0){updateMenuItemByID(skm, skm.getMenuCmdID());}if (j == 0) //j is unsigned, so default method doesnt workbreak;}}}where they send a map of Scintilla key codes to each of the buffers?
Yes, Geany has a binding for sending the SCI_ASSIGNCMDKEY message but it isn't used anywhere. All you need to do is write code to read the settings and shove them into Scintilla.
Here is my Scintilla config from Notepad++:<ScintillaKeys><ScintKey ScintID="2302" menuCmdID="0" Ctrl="yes" Alt="yes" Shift="no" Key="73"><NextKey Ctrl="yes" Alt="no" Shift="no" Key="73" /></ScintKey><ScintKey ScintID="2300" menuCmdID="0" Ctrl="yes" Alt="yes" Shift="no" Key="75"><NextKey Ctrl="yes" Alt="no" Shift="no" Key="75" /></ScintKey><ScintKey ScintID="2308" menuCmdID="0" Ctrl="yes" Alt="no" Shift="no" Key="37"><NextKey Ctrl="yes" Alt="yes" Shift="no" Key="74" /></ScintKey><ScintKey ScintID="2310" menuCmdID="0" Ctrl="yes" Alt="no" Shift="no" Key="39"><NextKey Ctrl="yes" Alt="yes" Shift="no" Key="76" /></ScintKey><ScintKey ScintID="2307" menuCmdID="0" Ctrl="no" Alt="no" Shift="yes" Key="39"><NextKey Ctrl="yes" Alt="no" Shift="yes" Key="76" /></ScintKey><ScintKey ScintID="2337" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="0" /><ScintKey ScintID="2338" menuCmdID="0" Ctrl="yes" Alt="no" Shift="no" Key="69" /><ScintKey ScintID="2304" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="37"><NextKey Ctrl="yes" Alt="no" Shift="no" Key="74" /></ScintKey><ScintKey ScintID="2453" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="36"><NextKey Ctrl="yes" Alt="no" Shift="no" Key="72" /></ScintKey><ScintKey ScintID="2451" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="35"><NextKey Ctrl="yes" Alt="no" Shift="no" Key="186" /></ScintKey><ScintKey ScintID="2180" menuCmdID="42006" Ctrl="no" Alt="no" Shift="no" Key="46"><NextKey Ctrl="yes" Alt="no" Shift="no" Key="68" /></ScintKey><ScintKey ScintID="2442" menuCmdID="0" Ctrl="yes" Alt="no" Shift="yes" Key="0" /><ScintKey ScintID="2311" menuCmdID="0" Ctrl="yes" Alt="yes" Shift="yes" Key="76"><NextKey Ctrl="yes" Alt="no" Shift="yes" Key="39" /></ScintKey><ScintKey ScintID="2301" menuCmdID="0" Ctrl="yes" Alt="no" Shift="yes" Key="75"><NextKey Ctrl="yes" Alt="yes" Shift="yes" Key="75" /></ScintKey><ScintKey ScintID="2303" menuCmdID="0" Ctrl="yes" Alt="no" Shift="yes" Key="73"><NextKey Ctrl="yes" Alt="yes" Shift="yes" Key="73" /></ScintKey><ScintKey ScintID="2309" menuCmdID="0" Ctrl="yes" Alt="no" Shift="yes" Key="37"><NextKey Ctrl="yes" Alt="yes" Shift="yes" Key="74" /></ScintKey><ScintKey ScintID="2315" menuCmdID="0" Ctrl="yes" Alt="no" Shift="yes" Key="186"><NextKey Ctrl="yes" Alt="yes" Shift="yes" Key="186" /></ScintKey><ScintKey ScintID="2332" menuCmdID="0" Ctrl="no" Alt="no" Shift="yes" Key="36"><NextKey Ctrl="yes" Alt="no" Shift="yes" Key="72" /></ScintKey><ScintKey ScintID="2306" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="39"><NextKey Ctrl="yes" Alt="no" Shift="no" Key="76" /></ScintKey><ScintKey ScintID="2312" menuCmdID="0" Ctrl="yes" Alt="no" Shift="no" Key="72"><NextKey Ctrl="yes" Alt="yes" Shift="no" Key="72" /></ScintKey><ScintKey ScintID="2313" menuCmdID="0" Ctrl="yes" Alt="no" Shift="yes" Key="72"><NextKey Ctrl="yes" Alt="yes" Shift="yes" Key="72" /></ScintKey><ScintKey ScintID="2314" menuCmdID="0" Ctrl="yes" Alt="no" Shift="no" Key="186"><NextKey Ctrl="yes" Alt="yes" Shift="no" Key="186" /></ScintKey><ScintKey ScintID="2305" menuCmdID="0" Ctrl="no" Alt="no" Shift="yes" Key="37"><NextKey Ctrl="yes" Alt="no" Shift="yes" Key="74" /></ScintKey></ScintillaKeys>Do the ScintIDs look familiar?
Just guessing what the XML means, but Ids look ok, see Geany source sciltilla/include/Scintilla.h
To be compatible with the rest of Geanys config files it would be best to use a GKeyfile format instead of Notepads XML to store the settings.
Cheers
LexOn Sat, Jan 29, 2011 at 2:32 PM, Lex Trotman <elextr@gmail.com> wrote:
On 30 January 2011 01:38, Todd Chambery <todd.chambery@gmail.com> wrote:
Hi all,Is there a mechanism for customizing the cursor movement keybindings in Geany?I'm a happy Notepad++ user on WIndows, largely because it accommodates my "inverted T" editor navigation keybindings:Notepad++ uses Scintilla underneath, maybe I can port these over?
Hi Todd,
You are correct that these keybindings are handled by Scintilla. Scintilla can have the keybindings configured, but Geany currently does not have the ability to do it. It could be a useful addition but someones got to do it (tm) patches welcome.
Cheers
Lex
PS doesn't have to be a GUI configurator, just loading a file would doThanks,Todd
_______________________________________________
Geany mailing list
Geany@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
_______________________________________________
Geany mailing list
Geany@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
_______________________________________________
Geany mailing list
Geany@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
_______________________________________________
Geany mailing list
Geany@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
_______________________________________________
Geany mailing list
Geany@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany