Oni: Oni and leader key mapping

Created on 24 Apr 2018  路  4Comments  路  Source: onivim/oni

I was wondering how to set the toggling of the file explorer windows to something like e in the Oni configuration.

Would appreciate some hint how to do this. Thanks.

Most helpful comment

Oni doesn't have the concept of what your leader key is (since that is a vim concept.)

I'd suggest doing something like this:

    const LEADER_KEY = ","
    oni.input.bind(`${LEADER_KEY}e`, "sidebar.toggle")

That way you can re-use the leader key easily, change it easily etc.

All 4 comments

No very sure if you're asking about Vim's file explorer :E or as the title suggested, the Vim leader key.
Regardless, this is my leader remap without using directly init.vim. Hope it helps.

// in the activate section of the config.tsx
oni.editors.activeEditor.neovim.command('let mapleader="\\\"')

// Ref: Support chorded key-presses https://github.com/onivim/oni/issues/1055
oni.editors.activeEditor.neovim.command("imap jj \")

oni.editors.activeEditor.neovim.command("nnoremap \; :")
oni.editors.activeEditor.neovim.command("nnoremap \s :update\")
oni.editors.activeEditor.neovim.command("nnoremap \o :bo cw\")
oni.editors.activeEditor.neovim.command("nnoremap \c :cclose\")
oni.editors.activeEditor.neovim.command("nnoremap \m :marks\")
oni.editors.activeEditor.neovim.command("nnoremap \w \v\l")

@Govinda-Fichtner You mean to toggle the file explorer window with <leader>e?

Oni doesn't have the concept of what your leader key is (since that is a vim concept.)

I'd suggest doing something like this:

    const LEADER_KEY = ","
    oni.input.bind(`${LEADER_KEY}e`, "sidebar.toggle")

That way you can re-use the leader key easily, change it easily etc.

@CrossR's suggestion does not work for the spacebar (using const LEADER_KEY = " ")

Was this page helpful?
0 / 5 - 0 ratings

Related issues

badosu picture badosu  路  20Comments

hboon picture hboon  路  21Comments

jordwalke picture jordwalke  路  25Comments

rococode picture rococode  路  20Comments

Melkor333 picture Melkor333  路  23Comments