-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Vim noremap seems to have no effect #6386
Comments
CodeMirror.Vim.mapCommand('jk', 'action', 'exitInsertMode', {}, { context: 'insert' }); If you also want to use Explanation: |
please try this: |
That didn't work for me. Did you try it on the jsbin demo that I mentioned? |
I'm afraid I don't understand what you're trying to tell me.
I'm not using Jupyter. I'm just trying to use CodeMirror on a plain web
page, just like in the example I wrote previously:
https://jsbin.com/higabaj/edit
…On Wed, Jan 27, 2021 at 9:27 PM tjlujianqiao ***@***.***> wrote:
step 2, means that you need paste the content into the custom.js
moreover, only "CodeMirror.Vim.map("jk", "<Esc>", "insert")" matters, you
can delete the left two
please remember :wq
Jianqiao Lu ***@***.***> 于2021年1月28日周四 下午1:24写道:
> you can follow the step and set "jk" as <esc> in insert mode in
vim/Jupyter
> 1.vi ~/.jupyter/custom/custom.js
> 2. require([
> 'nbextensions/vim_binding/vim_binding', // depends your installation
> ], function() {
> // Map jj to <Esc>
> CodeMirror.Vim.map("jk", "<Esc>", "insert");
> CodeMirror.Vim.map("jk", "<S-Esc>", "normal");
> CodeMirror.Vim.mapCommand('jk', 'action', 'exitVisualMode', {}, {
> context: 'insert' });
> // Swap j/k and gj/gk (Note that <Plug> mappings)
> });
> kanreki ***@***.***> 于2021年1月28日周四 下午1:02写道:
>
>> That didn't work for me. Did you try it on the jsbin demo that I
>> mentioned?
>>
>> —
>> You are receiving this because you commented.
>> Reply to this email directly, view it on GitHub
>> <
#6386 (comment)
>,
>> or unsubscribe
>> <
https://github.com/notifications/unsubscribe-auth/ANWQNL57ARJE6N5AF3PZGV3S4DVVBANCNFSM4QEEUGIA
>
>> .
>>
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6386 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHXQWYIPHEBGWJ6452DM2PDS4DYSRANCNFSM4QEEUGIA>
.
|
@tjlujianqiao The markdown formatter allows HTML tags so you need to encode the I can confirm Here noremap is effectively a shorthand for mapCommand; it copies a mapped command. So for keys that are not mapped to a command (e.g. <Esc>), it does nothing. It should throw an error upon failure, would be more helpful. |
Thank you, @benhormann. My evil twin previously claimed that the Also, |
I tried mapping 'jk' to
<Esc>
in insert mode, using thenoremap()
method; but it didn't seem to have any effect. (The 'jk' trick is a popular substitution for exiting insert mode: example.)If I instead use the
map()
method it does work, but I'm in the habit of using "non-recursive" mapping whenever possible, as suggested here.I wrote a jsbin to demonstrate it: https://jsbin.com/higabaj/edit
I was using Chrome version 85.0.4183.59 on a Chromebook. And CodeMirror version 5.56.0.
The text was updated successfully, but these errors were encountered: