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

Keybinding Suggestions and Contribution Opportunities #1423

Open
glennsl opened this issue Mar 5, 2020 · 39 comments
Open

Keybinding Suggestions and Contribution Opportunities #1423

glennsl opened this issue Mar 5, 2020 · 39 comments
Labels
A-configuration Area: Configuration, settings, options, preferences etc. A-input Area: Input management, keyboard layout, IME etc. E-good-first-issue Call for participation: Good first issue E-help-wanted Call for participation: Help is requested to fix this issue. enhancement New feature or request meta A big-picture issue, often collecting a number of other issues for discussing overarching solutions

Comments

@glennsl
Copy link
Member

glennsl commented Mar 5, 2020

This is the place to be if you want to suggest a keybinding, or find a nice and (usually) easy task to start contributing.

Suggestions

Name Command/
Default
Assignee/
PR/Issue
✔️ Save workbench.action.files.save
Mod+S
@jakeday
#1426
Focus Tab # workbench.action.openEditorAtIndex[1-9]
Mod+1 - Mod+9
@leavengood
✔️ Previous Tab workbench.action.previousEditor
Mod+PgUp / Cmd+Shift+[
@leavengood
#778/#1447
✔️ Next Tab workbench.action.nextEditor
Mod+PgDn / Cmd+Shift+]
@leavengood
#778/#1447
Copy input.copy?
Mod+C
@fanantoxa
#1233
Cut input.cut?
Mod+X
@fanantoxa
#1233
Paste input.paste?
Mod+V
@fanantoxa
#1233
Go to next error editor.action.marker.nextInFiles
F8
#1349
Go to previous error editor.action.marker.prevInFiles
Shift + F8
#1349
Go to next search result search.action.focusNextSearchResult
F4
Go to previous search result search.action.focusPreviousSearchResult
Shift + F4
Open settings workbench.action.openSettings
Cmd+,
✔️ Zoom In workbench.action.zoomIn
Ctrl++
@ArtemDrozdov
#1556/#1629
✔️ Zoom Out workbench.action.zoomOut
Ctrl+-
@ArtemDrozdov
#1556/#1629
✔️ Zoom Reset workbench.action.zoomReset
Ctrl+0
@ArtemDrozdov
#1556/#1629

Do you have other suggestions? Post a comment below! If the keybinding exists in vscode as well, it would be nice if you could post the name, command and default keybinding used there.

How to contribute

Keybindings are defined in KeyBindingsStoreConnector. Here's the keybinding for unfo, for example:

{
key: "<D-Z>",
command: "undo",
condition: "editorTextFocus" |> WhenExpr.parse,
},

When invoked this will generate a Command("undo") action, which needs to be handled in a Store somewhere. The undo comamnd is handled in VimStoreConnector here:

| Command("undo") => (state, undoEffect)

Which invokes the effect defined a bit further up, here:

let undoEffect =
Isolinear.Effect.create(~name="vim.undo", () => {
let _ = Vim.input("<esc>");
let _ = Vim.input("<esc>");
let cursors = Vim.input("u");
updateActiveEditorCursors(cursors);
();
});

A lot of keybindings will be like this, just delegating to libvim to handle it. Some might require a bit more though, but a good place to start is to look into how this is done and vim, and whether it can be delegated in the same manner as this.

If you feel ready to tackle one of the suggestions above, post a comment below to lets us know, then dive in! If you have questions, the best place to ask is in the #dev channel on our Discord server.

@glennsl glennsl added enhancement New feature or request E-help-wanted Call for participation: Help is requested to fix this issue. E-good-first-issue Call for participation: Good first issue A-input Area: Input management, keyboard layout, IME etc. A-configuration Area: Configuration, settings, options, preferences etc. meta A big-picture issue, often collecting a number of other issues for discussing overarching solutions labels Mar 5, 2020
@glennsl glennsl pinned this issue Mar 5, 2020
@irevived1
Copy link

Hello,
would be nice if we have something like vim-tmux-navigator which allows user to seamlessly navigate through vim splits/terminals/file trees via ctrl+(h,j,k,l)

would also be nice to alias j and k to down and up for non-input fields too.

thanks for welcoming suggestions!

@fanantoxa
Copy link
Contributor

@glennsl Select All already implemented with Selection PR

@escorponox
Copy link
Contributor

escorponox commented Mar 6, 2020

I would like to be able to "kind of import" my mappings from init.vim regarding tabs and splits.

" windows
nnoremap ,z <C-W>\|
nnoremap ,h <C-W>h
nnoremap ,j <C-W>j
nnoremap ,k <C-W>k
nnoremap ,l <C-W>l
nnoremap ,= <C-W>=
nnoremap ,x <C-W>x
nnoremap ,c :close<CR>

" tabs
nnoremap ,tg :tabnew<CR>
nnoremap ,tt :tabn<CR>
nnoremap ,tr :tabc<CR>
nnoremap ,tp :tabp<CR>

@glennsl
Copy link
Member Author

glennsl commented Mar 6, 2020

@irevived1 Yeah, that's definitely planned, although probably using Ctrl+W - h/j/k/l. It's a feature that require significantly more work than just adding some keybindings though, since at the moment we have no concept of where parts of the UI are relative to each other. I don't think there's an issue for it, but we have it noted down elsewhere and it's on the top of our minds since it's an essential part of the UX we're aiming for.

@fanantoxa Oh, lol, of course. I just use it all the time! Removed from the list.

@escorponox There's already experimental support for VimL, including remapping. See https://onivim.github.io/docs/configuration/settings#experimental

@jakeday
Copy link
Contributor

jakeday commented Mar 6, 2020

@glennsl The save request is handled via #1426 and is good to go!

@glennsl
Copy link
Member Author

glennsl commented Mar 6, 2020

Thanks @jakeday. Noted.

@leavengood
Copy link
Contributor

leavengood commented Mar 6, 2020

The VSCode actions for focusing tabs by number is workbench.action.openEditorAtIndex[1-9]. And there are key bindings for Ctrl-[num] and Cmd-[num] (on macOS at least.)

I think I will look into adding this and the nextEditor/previousEditor commands.

I will probably will make a loop for defining the commands and key bindings for the numbered ones, and then map those to :b1-:b9. Also :bnext and :bprevious don't seem to be implemented yet, so it might make sense to implement those and just connect nextEditor/previousEditor to them. I don't yet know how to do that though.

@glennsl
Copy link
Member Author

glennsl commented Mar 6, 2020

Thanks @leavengood. I've updated the OP and assigned you to those.

Also :bnext and :bprevious don't seem to be implemented yet

I think they are, but they're pretty broken? No idea what the problem might be though. Maybe @bryphe has some ideas.

leavengood added a commit to leavengood/oni2 that referenced this issue Mar 8, 2020
leavengood added a commit to leavengood/oni2 that referenced this issue Mar 8, 2020
@jakeday
Copy link
Contributor

jakeday commented Mar 9, 2020

I added #1450 for indenting and outdenting with tab and shift tab when in visual mode. Let me know if I need to change anything!

bryphe pushed a commit that referenced this issue Mar 10, 2020
* Implement the next/previous editor commands and keybindings

This wraps around like VSCode.

Fixes #778 and part of #1423.

* Remove unneeded new actions

* Adjust how the next/previous editor code works in EditorGroup

Resolve the TODO for _getIndexOfElement by making it return option(int).
List.find_opt is not actually the right choice to get an index.

Also ran `esy format`.
@CrossR
Copy link
Member

CrossR commented Apr 17, 2020

It'd be nice for the keybinding docs to be updated as well (and then kept up to date with any changes from this issue).

There is a complete list here https://github.com/onivim/oni2/blob/master/src/Store/KeyBindingsStoreConnector.re, which could be used to fill in any default bindings and missing conditions for the documentation.

The website file lives here: https://github.com/onivim/oni2/blob/master/docs/docs/configuration/key-bindings.md

@igniscyan
Copy link

Is there any way we could get an Xcode-like minimap mark feature? Example here
image

@glennsl
Copy link
Member Author

glennsl commented May 7, 2020

It's been brought up before, but I can't find that there's any existing issues for it. You should create one for it. It's a cool feature. I can't see how it relates to keybindings though.

@lettertwo
Copy link

lettertwo commented Aug 15, 2020

Does the file explorer currently support keybindings? In vscode, i find it natural to map h,j,k,l to move between files and directories in the explorer tree. Is this a possible configuration for Oni yet, and if not, is it a roadmap or desirable feature?

Edit: Should've searched issues more before commenting 🤦 #528

@schinns
Copy link

schinns commented Aug 26, 2020

It would be nice when you are in Search to be able to select all the text. Perhaps Cmd + a?

Happy to take a stab at this, if there isn't someone assigned to this already.

@fanantoxa
Copy link
Contributor

@benschinn There already a implemented. Ctrl + A works on linux/window on all inputs (like Ctrl+P, file search, git, etc)
it uses binding <C-a> so it might be working already, if it not please create an issue (I don't have any mac to check)

bryphe pushed a commit that referenced this issue Sep 7, 2020
…2397)

A simple change that allows keybindings to invoke ex commands directly, and could address quite a few of the requests in #1423. The downside of doing this instead of implementing proper commands is of course that they won't be discoverable through the command palette, but this doesn't prevent proper commands to be added either, so I think it might be a nice convenient stop-gap solution to unblock people at least.

Example:

```
  {key: "kk", command: ":split", when: "editorTextFocus"}
```

Let me know if you think this is a viable approach @bryphe, then I'll add a few integration tests before it's merged.

Fixes #807
@Th3Whit3Wolf
Copy link

I'm a big fan of using enter for completion and / to move through suggestion. This actually easier to set in vim than in vim with some autocompletion plugins.

{
      "key":"<S-Tab>",
      "command":"selectPrevSuggestion",
      "when":"editorTextFocus && suggestWidgetVisible"
   },
   {
      "key":"<Tab>",
      "command":"selectNextSuggestion",
      "when":"editorTextFocus && suggestWidgetVisible"
   },
   {
      "key":"<CR>",
      "command":"acceptSelectedSuggestion",
      "when":"suggestWidgetVisible && editorTextFocus"
   }

@Th3Whit3Wolf
Copy link

I think it would be cool if there was a list of all possible values for command so that someone could make a mapping.vim => keybindings.json webapp.

@spar7453
Copy link

spar7453 commented Oct 17, 2020

I wish :enew or "workbench.action.files.newUntitledFile" is implemented in keybindings
Also, how can I set key bindings when I am focusing on FileExplorer?
I tried to find something like listFocus, but could not find one.

@glennsl
Copy link
Member Author

glennsl commented Oct 18, 2020

@spar7453
Copy link

spar7453 commented Oct 20, 2020

@glennsl
I tried to bind as the following
{ "key": "< space>fn", "command": ":enew", when: "normalMode" }
and it did not work.

I think that we cannot bind every vim commands in this way
and also waiting for binding
{ "key": "< space>b1", "command": ":b2", when: "normalMode" }

(I had to put empty space in front of "s" because the editor removes "< space>")

@glennsl
Copy link
Member Author

glennsl commented Oct 21, 2020

@spar7453 Yeah that does seem broken. When trying it myself I can see from the logs that it's running the command, but then nothing happens. I've created #2604 to track it.

@RilDev
Copy link

RilDev commented Dec 6, 2020

How about Ctrl+] to toggle the terminal windows?
As suggested here: https://discordapp.com/channels/417774914645262338/424012160696582144/785130754446327809

Is there a way we could bind the command :term ++curwin tmux to Ctrl+]?

@marcinkoziej
Copy link
Contributor

The issue should be updated to link to src/Model/State.re for list of all key bindings

@Szune
Copy link

Szune commented Feb 18, 2021

Is #1349 "Go to next error" done? Otherwise I might take a look at it this weekend, would be fun to get into the codebase and start contributing.

@bryphe
Copy link
Member

bryphe commented Feb 20, 2021

Hi @Szune ,

Go to next error is not implemented yet - it would be awesome to have though! I find myself wanting it all the time 😄 Let me know if you need help getting started

@Szune
Copy link

Szune commented Feb 20, 2021

Cool @bryphe , I'll try to get started on it when I wake up later today 😃

Is there anything I should look at other than https://onivim.github.io/docs/for-developers/contributing before beginning?

@goetzc
Copy link

goetzc commented Mar 5, 2021

I would like to have this working, to be able to use C-j and C-k to navigate in the Quick Open dialog:

// Quick Open
{ "key": "ctrl+k", "command": "workbench.action.quickOpenSelectPrevious", "when": "inQuickOpen" },
{ "key": "ctrl+j", "command": "workbench.action.quickOpenSelectNext", "when": "inQuickOpen" },

@lettertwo
Copy link

@goetzc How about:

  {"key": "ctrl+k", "command": "list.focusUp", "when": "inQuickOpen"},
  {"key": "ctrl+j", "command": "list.focusDown", "when": "inQuickOpen"},

or, to use the same in any list view:

  {"key": "ctrl+k", "command": "list.focusUp", "when": "listFocus"},
  {"key": "ctrl+j", "command": "list.focusDown", "when": "listFocus"},

@goetzc
Copy link

goetzc commented Mar 6, 2021

@lettertwo that works perfect, thank you!

@LiHRaM
Copy link
Contributor

LiHRaM commented Mar 26, 2021

Seems like the "Open settings" keybinding is not being worked on yet, so I'll gladly get started on that. 😄

@rambip
Copy link

rambip commented May 1, 2021

I think the brackets/surroundings of the plugin surround.vim are so great they should be on by default: the nice thing is that they don't conflict with vim keys !
And make sure the "delete brackets" commands are repeatable !
The keys used by doom-emacs are really well made, it would be nice to have some of them too !
In particular vim-sneak.

@lougreenwood
Copy link

@rambip is it possible to use surround.vim with Oni2 at the moment? I didn't see that yet...?

@ninjabreakbot
Copy link

ninjabreakbot commented May 9, 2021

Just found this issue and want to move by open issue to this comment and close it, also going to review info provided to see how this might be resolved. Leaving my comments below to see if anyone has already resolved or dealt with this.

Two items strike me as usability issues for myself and I wanted to welcome any comments on resolving or agreeing with their existence.

EDIT: I've just noticed that the use of :term is opening a terminal in a pane, and control + ` is opening the terminal in a fashion more in line with that was expected. Rather then what I note in (item 1) i would ask, why would these differ. Fine with both existing, but using :term i certainly assumed it would open the terminal seen when pressing control + `

Item 1
Common shortcut for previous commands entered at the command line is control + p. This however opens the file selection pallet when entered with the terminal in focus. Additionally pressing command + p opens this same pallet. It should be noted that once in the pallet you can navigate using control + p / command + p and control + n / command + n.

  • I find this hurts my keyboard control flow, I would suggest that the super + p and shift + super + p be used to access these pallets, and control be left to navigate with p and n

Item 2
Open terminal, then opening a file places new file in the terminal pane area, replacing your view of the terminal.

  • I don't mind that the terminal behaves like any other pane, however i welcome a default or config related to this so it can open new files in the primary panes, assuming everyone feels similarly that the term is likely wanted to stay visible.

Thank you.

@weirdan
Copy link

weirdan commented Jun 27, 2021

I'd like to add a couple of suggestions:

  • Ctrl-W o should hide the sidebar and any splits except the current one (standard vim keybinding)
  • :Ex (not a keybinding, but Ex command) could open / focus file tree (this comes from NetRW, which is a part of standard vim distribution).
  • In vim, Ctrl-Y accepts current autocomplete item, this doesn't seem to be happening in onivim

@Ding-Fan
Copy link

I wish Ctrl + / as toggle comments(single & multi line)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-configuration Area: Configuration, settings, options, preferences etc. A-input Area: Input management, keyboard layout, IME etc. E-good-first-issue Call for participation: Good first issue E-help-wanted Call for participation: Help is requested to fix this issue. enhancement New feature or request meta A big-picture issue, often collecting a number of other issues for discussing overarching solutions
Projects
None yet
Development

No branches or pull requests