Register
4coder»Forums»Rebind tab key
3 posts
Rebind tab key
10 months ago Edited by Stromberg on Feb. 4, 2019, 11:34 a.m. Reason: Initial post
I want to rebind the tab key in code mode, cause I often use languages that are not bracket based.
I tried this and it does not work for me.

1
2
3
4
5
begin_map(context, mapid_file);
{
    bind(context, '\t', MDFR_NONE, write_character);
}
end_map(context);


my other keybindings do work.
Simon Anciaux
690 posts
Rebind tab key
10 months ago
mapid_file is for text file, not code. Try with default_code_map instead.
3 posts
Rebind tab key
10 months ago
Thanks, that works great :D
I'm wondering though I have this

1
2
3
4
5
6
7
begin_map(context, mapid_file);
{
    bind(context, key_del, MDFR_SHIFT, delete_line);
    bind(context, 'a', MDFR_CTRL, select_all);
    bind(context, ' ', MDFR_CTRL, word_complete);
}
end_map(context);


and those work fine in the code mode, how do I "know" which one I should use?
Simon Anciaux
690 posts
Rebind tab key
10 months ago
mapid_default_code_map is used by files with the extensions specified in the config.4coder file. The treat_as_code value that defaults to .cpp.c.hpp.h.cc.cs.java.rs.glsl.m .

File with other extensions will use mapid_file.

mapid_default_code_map inherits mapid_file's bindings. Meaning that any binding that is present in mapid_file will be present in mapid_default_code_map unless you overwrite it in mapid_default_code_map. It was probably why remapping tab didn't work since it's bound to autocomplete in mapid_default_code_map by default.
3 posts
Rebind tab key
10 months ago
I see, thanks a lot for clearing it up :)