Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow .vintageousrc to map any keybinds #167

Closed
gerardroche opened this issue Apr 6, 2017 · 5 comments
Closed

Allow .vintageousrc to map any keybinds #167

gerardroche opened this issue Apr 6, 2017 · 5 comments

Comments

@gerardroche
Copy link
Contributor

Issue by mreq
Tuesday Apr 12, 2016 at 13:22 GMT
Originally opened as guillermooo/Vintageous#1068


It'd be nice if we were able to perform a custom-bound shortcut

Say I'd like to trigger a command, which is bound to ["ctrl+g", "s"] in sublime keymaps. To remap that via .vintageousrc one'd write:

map <Leader>gs <C-g>s

I can do something similar using the leader key (space in my case) in the actual sublime keymaps, but that breaks vintageous a bit (for instance movement towards space (f" ") doesn't work, etc.).

@gerardroche
Copy link
Contributor Author

@mreq This has been resolved in the latest 1.4.0 release (NeoVintageous is a fork of the discontinued Vintageous plugin):

You can now map to Sublime Text commands from your vintageousrc file.

Mapping to Command-line mode commands is supported for basic use-cases: >
:command

Mapping to Sublime Text commands is supported for basic use-cases. The command
must start an Uppercase letter to avoid confusion with built-in Command-line
mode commands. The command is converted to snake_case. For example to map to
the Sublime Text command "toggle_side_bar": >
:ToggleSideBar

Here is an example |vintageousrc| file: >

" The character " (the double quote mark) starts a comment

let mapleader=,

" Toggle the side bar.
nnoremap <leader>d :ToggleSideBar<CR>

See the :help neovintageous command for information.

Also see the forum post on latest release: NeoVintageous 1.4.0 released zap KAPOW.

@mreq
Copy link
Contributor

mreq commented Nov 6, 2017

Cheers! Looking great.

@ghost
Copy link

ghost commented Apr 2, 2018

Here we are calling the command directly which is very nice. Is it also possible to just map to an existing Sublime Key Binding like say:

noremap \u ctrl+enter

where ctrl+enter is just the stock definition from Sublime Keymaps:

{ "keys": ["ctrl+enter"], "command": "run_macro_file", "args": {"file": xs"} }

I did create a custom command in plugin.py and it works fine. But I am repeating the whole thing there. It would be really nice if I can execute a Ctrl+Enter through code like say using a dummy function which can invoke the necessary Sublime Key. Any thoughts?

@gerardroche
Copy link
Contributor Author

@varmanishant No that isn't possible. Hopefully we can add argument support for custom commands which would make things a lot easier; you would be able to do something like: noremap \u :RunMacroFile file=xs, which obviously removes the need for the custom plugin code.

@ghost
Copy link

ghost commented Apr 4, 2018

Thanks @gerardroche. I just did it using the normal plugin way for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants