vspacecode / vspacecode Goto Github PK
View Code? Open in Web Editor NEWSpacemacs like keybindings for Visual Studio Code
Home Page: https://vspacecode.github.io/
License: MIT License
Spacemacs like keybindings for Visual Studio Code
Home Page: https://vspacecode.github.io/
License: MIT License
Continuation from #1 regarding collaborating with vscode-hydra.
As far as I understand, we have different plugins aiming to solve the following problems.
My proposal involves developing an intermediate interface which maps VSCode commands with semantic-named-commands with the following capabilities
Here is an example of default configuration.
window.terminal.toggle
-> executes vscodes toggle command -> should generate keybinding : wtt
window.terminal.toggle:::true
-> invoke terminal toggle command with argument as true -> should generate keybinding wttt
or ask for configuration if conflict arises. :::
is the separator for argumentWindow.activity.toggle
-> executes vscodes toggle activity bar command -> should generate keybinding Wat
(notice uppercased W)The above commands should create the interfaces below
Assuming that the above commands are default and are provided by us, everyone may not be happy with them. Lets assume someone wants to group them under key a
User defined semantic language could be something like this. $
signifies user namespace.
$application
= window
a
$application.$terminal
= window.terminal
window.terminal
namespace are mapped to a.t
namespace$project.$search
= #editor.action.find
p.s
is mapped to vscode command editor.action.find
Once the interface is developed, we can use it in our respective extension as a command provider.
Let me know your thoughts.
As I said here:
In spacemacs you have major-modes, like "python", "markdown", and so on. So for example if you open a
.md
file ? spacemacs will use Markdown mode in that buffer.When you are using a mode, key bindings under
<spc> m
or under,
will be unique to that mode.This means that when you are editing a markdown,
<spc> m b
could be assigned to "make bold", while in python<spc> m b
could be assigned to "toggle breakpoint" (I am just inventing).
Maybe the discussion in the above linked issue could be relevant.
For example if we decide to adopt emacs temiinology "Move editor group right" becomes "Move window right".
In spacemacs (develop branch) there are a lot of key bindings under <spc> f y
that are missing in VSpaceCode.
Some related to file path:
<spc> f y c
copies file path with line and column numbers, for example: /home/marco/VSpaceCode/CHANGELOG.md:39:15
<spc> f y d
copies the directory path, for example: /home/marco/VSpaceCode/
<spc> f y l
copies file path with line number, for example: /home/marco/VSpaceCode/CHANGELOG.md:39
The above key bindings have a version where instead of the absolute path, you refer to the project root, in my case /home/marco/VSpaceCode/
<spc> f y C
copies file path with line and column, for example: CHANGELOG.md:39:15
<spc> f y D
copies directory path, for example: ./
<spc> f y L
copies file path with line number, for example: CHANGELOG.md:39
plus, you have:
<spc> f y n
copies file name, for example: CHANGELOG.md
<spc> f y N
copies file name without extension, for example: CHANGELOG
Here is an example implementation: https://marketplace.visualstudio.com/items?itemName=ezforo.copy-relative-path-and-line-numbers
Anyway there is no linked repository, so maybe it's not open source. Plus, stevenguh here said that using a lot of external extensions comes with an overhead, so we might want to implement and maintain those little actions in this extension.
These look simple to me, so I will add the good first issue label. Write here if you want to implement one of those actions :)
Hi there,
I am using version 0.7.1 of VSpaceCode. I tried this on Ubuntu 20.04 and OS X 10.15.6
I am unable to make these two commands work properly.
s s doesn't do anything
s S throws an error: TaskQueue: Error running task. Failed to handle key= . command 'fuzzySearch.activeTextEditorWithCurrentSelection' not found.
Thanks,
I tried to add this
{
"key": "h",
"name": "Toggle search highlighting",
"type": "command",
"command": "vim.remap",
"args": {
"commands": [
":nohl"
]
}
}
to the package.json
and built the extension, but when I pressed the key it showed an error. Is there a way to map a keybinding to hide the vim search highlighting?
The commands from the configuration section of the README do not exists.
This is what I have in v0.6.0
As you can see the names are different.
Should I just rename the commands in the readme with the first 3 of the picture?
Issue from stevenguh/spacecode#9
This idea is coming from stevenguh/spacecode#8. It would be great to have a script in the prepublish step to generate a markdown table from the default bindings in the
package.json
to use inREADME.md
. I am thinking this would generate a separate markdown file at the root directory likeKEYBINDINGS.md
then theREADME.md
can refer to all the default key bindings we have.
Is there a keybinding for CMD + P
(on Mac) to launch the fuzzy finder?
I'm finding that if I press <leader> f f
, nothing happens. More concerning, it also stops other bindings like <leader> <leader>
from working correctly until I close that editor and open a new one.
Any idea why this might be happening? I'm not sure if it's a bug here or in VSCodeVim
The description of this project being merged with https://github.com/stevenguh/spacecode may confuse which is actively developed(the info that this is the active project is missing). I had to cycle between both few times to figure this out.
Readme could be modified to reflect this.
This is an issue to track the work up to v0.5.0
๐ - In Progress
vscode-which-code
(@stevenguh)vscode-which-code
y
menu in magit (@stevenguh)<spc> j
and easymotion settings on installThe gif of this project has a behavior which is very similar to original spacemacs SPC f f
.
You should evaluate this project in order to see if it exposes some actions which may be integrated in our setting.json.
Hey there! I am also looking for the Spacemacs experience in VSCode. I saw this plugin: https://marketplace.visualstudio.com/items?itemName=michaelgriscom.leadermode which 'simulates' which-key, so that you don't have to remember every single step. It is however not compatible with the Vim plugin. Think it would be possible to get this which-key feature from Emacs in here using Vim / VSpaceCode :D?
At the moment everything is done via manual updates, which are annoying.
Let's make a config file build-tool, which is able to merge user settings, with VSpaceCode key bindings.
Ideally VSpaceCode key bindings should be splitted in different files, one for each prefix (SPC f
, SPC w
, etc.).
This script (or another one) should generate documentation for VSpaceCode key bindings, too.
In other words people should be able to clone this repository and customize it with their own settings files. With this scripts they shall be able to generate the full settings.json file to be placed in VSCode. This file will contain both their settings and the VSpaceCode mappings.
An initial job has been done here.
This issue is a recap of what has been written in #1.
Maybe with github actions? Or azure itself offers some support for this?
Currently can't find this in the vscode marketplace so wondering how I can use this.
Quoting VSpaceCode/vscode-which-key/issues/5, Spacemacs SPC f t
chord does the following:
- If the sidebar isn't open, open the sidebar and focus the explorer.
- If the sidebar is open but the explorer is not visible, open the explorer and focus it.
- If the sidebar is open and the explorer is visible, close it.
Currently, SPC f t
does 1 and 2, but not 3. I just double-checked to make sure, and Spacemacs definitely does number 3, but VSpaceCode's implementation of it does not. This should be added to VSpaceCode.
This is used to track the work to add <spc> j
and its required easymotion settings to both README and the configuration commands. I am in the process of refactoring the configuration commands, please hold off on that part if you are working this issue.
SPC <tab>
works with the following settings.json
:
{
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"<space>"
],
"commands": [
"vspacecode.space"
]
},
{
"before": ["<leader>", "<tab>"],
"commands": ["workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup"]
},
],
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": [
"<space>"
],
"commands": [
"vspacecode.space"
]
}
],
}
Of course it is an hack and this key bindings will not be listed in which key.
What do you think? In my opinion this key binding is really useful, so maybe this hack may be worth it.
We could specify that this key binding is not showed in which key in the file that we discussed in #47
This issue is related to #52
I spent a bunch of time adding a lot of new menus/commands to my default VSpaceCode setup, which I've put up in a gist here:
https://gist.github.com/macintacos/d63b7057cee0638e7ccfcdd6d1b7f662
Feel free to rip as much as you'd like.
I don't think that I necessarily want to contribute this directly to this repo, since there are a lot of opinionated menus/actions that I added that deviate from "traditional" Spacemacs. One big thing that I did (for example) is that I remove all references to magit; while I really like magit, I've gotten used to my workflow with Sublime Merge over the past year or so, and that's by far the most opinionated thing in there. There are also a lot of references to extension commands that naturally you'd have to have installed in order for them to work.
The biggest thing that made me realize that I could use VSpaceCode for everything was when I saw which-key and the fact that you could map <space>
to invoke VSpaceCode directly (meaning that you could theoretically invoke it from anywhere, not just the editor), so now I can completely move away from Spacemacs to VSCode with really minimal compromises for my needs. Thanks a bunch; I'll probably deprecate Chord Heavy and just point them to this extension.
It would be awesome if the extension gave the option of adding a delay before the quick pick menu appeared (like in spacemacs). I realize this may be hard to implement since the extension currently relies on the quick pick to capture input, but thanks for considering it.
P.S. Many thanks for this extension. I recently switched from spacemacs to VS Code and this extension makes my VS Code experience so much better.
Vscode neovim allow to use vim inside a vscode window. Mapping of vscode action is supported directly in the init.vim file. A port of this configuration should be easy.
As you may noticed this project was merged with spacecode and some key bindings and settings that existed only in this project are not in the master branch anymore.
The old approach of the repository (before the merge) is maintained in the vscode-vim branch.
The features that got lost in the process are the following:
"vim.useSystemClipboard": true
and "vim.easymotion": true
.settings.json
file that got lost during the process and add them in this file which contains all the new key bindings. If two key bindings conflict, the most similar to the spacemacs behaviour should win. Try to add few key bindings (also one is ok) for each pull request.If there is no way to "install" some parts of keybindings.json
or settings.json
with the plugin (i.e. set the key value pair as default when this plugin is installed), a new settings.json
file that contains all these parts should be created and the README should explain that it requires to be manually merged in your own settings.json
.
At the moment it is acceptable that some key bindings that cannot be integrated with the plugin are included only in the new settings.json
file and therefore are not listed in the which-key window.
quickOpenPreviousRecentlyUsedEditorInGroup
Need to update the leader, tab keybinding as follows:
{
"before": [ "<leader>", "<tab>" ],
"after": [],
"commands": [
{
"command": "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
"args": []
}
]
},
See the update https://code.visualstudio.com/updates/v1_42
In spacemacs, the minibuffer with command hints shows up with a delay.
This has the benefit that if you have the command memorized, you don't need a janky ui part momentarily appearing then disappearing.
Example scenario: I don't want the menu to show up every time I'm switching between open panes using SPC w h
and SPC w l
First of all, congratulations on the latest update.
I really like helm swoop
in spacemacs.
So I was pleasantly surprised by your implementation with fuzzy search (search in the current editor with <spc s s>
).
Unfortunately, when I use it, the cursor is not positioned on the searched word but only at the beginning of the line containing the searched word.
Is there an option or other shortcut to access this feature?
key: [ "leader", "p", "l" ]
"command": "workbench.action.files.openFolder",
This command doesn't exist in MacOS.
Currently, we have a vscode notification to guide use to install settings automatically; however, there are some cases that it currently needs to be worked on. For example: vscode remote. Also, there is no api for extension to add to user's keybindings.json
, although there is a hack that could.
Moving forward, a question remains -- what if we cannot automate well on installation, should we switch to a fully manual installation like copy-and-paste?
There are a few options:
settings.json
when user click the button in the notification.Ctl+Shift+P
to install.There's also a lot of moving parts that would change the consideration on this like dropping support of non-vim users, support y
menu in magit (which will need to add bindings to user's keybindings.json
)
My current thinking is that, the continuous checker will likely to be removed because when we add <spc> j
we will requires user to enable easy motion; however, user might not want to enable that. So continuous checker can be an annoyance when the user turned some settings off. This is open to discussion.
The action "workbench.action.togglePanel" is really nice. Do you have any ideas about which key binding to assign?
Hi,
I think it is neat that you guys are bringing Spacemacs keybindings to VSCode. It helps me try out VSCode.
I am running VSpaceCode 0.6 with VCodeVim version 1.15.0 on a fresh VSCode install on Ubuntu 20.04.
I opted for automatic configuration but I am running into the following error for the command "Space f f"
TaskQueue: Error running task. Failed to handle key= . command 'workbench.action.files.openFileFolder' not found.
Thanks!
Not sure if this is an issue with vscode-which-key, VSpaceCode, or just a misplaced character somewhere, but with no validation I'm finding it hard to figure out what's going on.
I've been adding a lot of keybindings to my settings to emulate more and more Spacemancs functionality. I have the following configuration in my settings.json
right now:
"vspacecode.bindingOverrides": [
{
"bindings": [
{
"command": "multiCommand.copyRelativePathAndPrintIt",
"key": "r",
"name": "...relative path of current file (copies it too)",
"type": "command"
},
{
"command": "extension.relativePath",
"key": "R",
"name": "...relative path of other file in project",
"type": "command"
},
{
"command": "multiCommand.copyRelativePathAndSelectedLinesAndPrintIt",
"key": "l",
"name": "...relative path of current file AND selected line numbers (copies it too)",
"type": "command"
}
],
"keys": ["i", "f"],
"name": "Insert file...",
"type": "bindings"
},
{
"bindings": [
{
"command": "copyFilePath",
"key": "y",
"name": "...current file with absolute path",
"type": "command"
},
{
"command": "copy-relative-path-and-line-numbers.path-only",
"key": "r",
"name": "...current file with relative path",
"type": "command"
},
{
"command": "copy-relative-path-and-line-numbers.both",
"key": "R",
"name": "...current file with relative path and current line numbers",
"type": "command"
},
{
"command": "fileutils.copyFileName",
"key": "n",
"name": "...current file name with extension",
"type": "command"
}
],
"keys": ["f", "y"],
"name": "Copy...",
"type": "bindings"
},
{
"command": "git.checkout",
"key": "g.B",
"name": "Branch",
"type": "command"
},
{
"command": "outline.focus",
"key": "f.O",
"name": "Focus file outline view",
"type": "command"
},
{
"command": "workbench.action.closeUnmodifiedEditors",
"keys": "b.D",
"name": "Close unmodified editors",
"type": "command"
},
{
"command": "fileutils.removeFile",
"keys": "f.D",
"name": "Delete current file",
"type": "command"
},
{
"command": "fileutils.renameFile",
"keys": "f.R",
"name": "Rename file",
"type": "command"
},
{
"command": "workbench.action.output.toggleOutput",
"keys": "e.o",
"name": "Toggle output view",
"type": "command"
},
{
"bindings": [
{
"command": "bookmarks.toggle",
"key": "m",
"name": "Toggle bookmark",
"type": "command"
}
],
"keys": "B",
"name": "Bookmark Actions",
"type": "bindings"
},
{
"bindings": [
{
"command": "editor.action.commentLine",
"key": "l",
"name": "Comment/uncomment line(s)",
"type": "command"
},
{
"command": "code-runner.run",
"key": "r",
"name": "Run code in curent file",
"type": "command"
},
{
"command": "multiCommand.copyAndCommentLines",
"key": "y",
"name": "Copy selection and comment line",
"type": "command"
}
],
"keys": "c",
"name": "Comment Actions",
"type": "bindings"
},
{
"bindings": [
{
"command": "workbench.action.openGlobalSettings",
"key": ",",
"name": "Open global settings",
"type": "command"
},
{
"command": "workbench.action.selectIconTheme",
"key": "i",
"name": "Choose icon theme",
"type": "command"
},
{
"command": "workbench.action.openGlobalKeybindings",
"key": "k",
"name": "Open global keybindings",
"type": "command"
},
{
"command": "workbench.action.openGlobalKeybindingsFile",
"key": "K",
"name": "Open global keybindings JSON",
"type": "command"
},
{
"command": "workbench.action.configureLanguageBasedSettings",
"key": "l",
"name": "Open language settings",
"type": "command"
},
{
"command": "workbench.action.openSettings",
"key": "n",
"name": "Open User snippets",
"type": "command"
},
{
"command": "workbench.action.openSettingsJson",
"key": "s",
"name": "Open global settings JSON",
"type": "command"
},
{
"command": "workbench.action.selectTheme",
"key": "t",
"name": "Choose color theme",
"type": "command"
},
{
"command": "extension.updateSettings",
"key": "u",
"name": "Update/upload settings",
"type": "command"
},
{
"command": "workbench.action.openWorkspaceSettings",
"key": "w",
"name": "Open workspace settings",
"type": "command"
},
{
"command": "workbench.action.openWorkspaceSettingsFile",
"key": "W",
"name": "Open workspace settings JSON",
"type": "command"
}
],
"keys": ",",
"name": "Settings/Preferences",
"type": "bindings"
}
],
I'm continuing to add more. The JSON document itself is not throwing any errors, and most of the commands are showing up for me. However, the SPC g B
keybinding that I added does show up (there are other examples, but that's the one where I first noticed that they weren't showing up in the menu). This error is showing up in my console:
console.ts:137 [Extension Host] TypeError: Cannot read property 'length' of undefined
at /Users/juliant/.vscode/extensions/vspacecode.whichkey-0.7.4/dist/extension.js:1:2364
at Array.forEach (<anonymous>)
at Function.overrideItems (/Users/juliant/.vscode/extensions/vspacecode.whichkey-0.7.4/dist/extension.js:1:2261)
at t.default.register (/Users/juliant/.vscode/extensions/vspacecode.whichkey-0.7.4/dist/extension.js:1:5613)
at u (/Users/juliant/.vscode/extensions/vspacecode.whichkey-0.7.4/dist/extension.js:1:3574)
at _executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:631:163)
at _doExecuteCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:630:348)
at _.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:630:254)
at Object.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:911:820)
at /Users/juliant/.vscode/extensions/vspacecode.vspacecode-0.7.3/dist/extension.js:1:6336
at t.activate (/Users/juliant/.vscode/extensions/vspacecode.vspacecode-0.7.3/dist/extension.js:1:6443)
at Function._callActivateOptional (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:837:509)
at Function._callActivate (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:837:160)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:835:703
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Promise.all (index 3)
at async Promise.all (index 0)
It says it's which-key that's hitting the error, but I can't tell if it's VSpaceCode that is interpreting my settings incorrectly (which is thus being passed to which-key). Happy to move this issue over to that repo if this is an issue with which-key itself.
Please let me know if there's anything that I can do to help you get to the bottom of this. I'm going to continue to fiddle around with my settings to see if I can figure it out.
When I type SPC s P
I get the error:
TaskQueue: Error running task. Failed to handle key=P. command 'workbench.action.findInFilesWithSelectedText' not found.
Was the action workbench.action.findInFilesWithSelectedText
removed?
I don't see it when I press SPC h d
.
If the action has been removed we can delete SPC s P
.
The VSpaceCode project is young, and for now it only consists of people sharing their configurations manually.
While being a good starting point, this solution is far from ideal. So the idea is to gather around this project all the people wanting to participate in making VSCode works with Spacemacs' key bindings, and to find together the best solution to achieve this goal.
This issue is for discussing the project direction, to decide in which way the project should be oriented, like just as a shared configuration file or as a VSCode extension.
Solutions imagined so far:
Continue as it is now: A shared configuration that should be manually installed and updated.
โ
Done
Develop VSpaceCode as a settings builder, i.e. people clone this repository and customize it with their own settings files. VSpaceCode then provide a scripts that generated the full settings.json
file that people can put in VSCode, which will contain both their setting and the VSpaceCode mappings.
โ๏ธ In development
Create a VSCode extension to provide the VSpaceCode mappings.
๐ซ Not possible, see #1 (comment)
Build a custom extension upon VSCodeVim providing the Spacemacs-like experience out of the box.
๐ฌ In discussion
We should definitely take a look at this project.
Maybe we could integrate it, migrate to it, merge the two projects..I don't know, I haven't tried it yet :)
I am opening this issue to track the work that could be done to merge Easy Menu Navigation described in README to settings.json
so when user choose to run the automatically configuration on fresh install or when they rerun the configuration commands again.
With grid layouts now available in VS Code, it would be great if the bindings for generating window splits and navigating them were added. The ones I know about and use regularly are:
Should we delete this repo?
I don't think it's used anymore.
Apparently I don't have the permissions to that.
Providing a binding for some replacement to Helm-Swoop/Ivy-Swiper bound to SPCss would be really nice, Using the fuzzy-search extension I've put the following in my settings.json
to emulate it:
{
"before": ["<leader>", "s", "s"],
"commands": ["fuzzySearch.activeTextEditor"]
},
Maybe this is something that could be included out of the box?
Name: fuzzy-search
Id: jacobdufault.fuzzy-search
Description: Fuzzy search
Version: 0.0.2
Publisher: jacobdufault
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=jacobdufault.fuzzy-search
Thanks for your work on this so far, the new version is great.
This plugin seems like a really good emulation of Helm. Maybe it could replace space f f
?
https://github.com/bodil/vscode-file-browser [edit: fixed link]
Split from #80 (comment) and #80 (comment)
This issue is to track the work to activate vspacecode menu when the focus is in the sidebar or panel. This ideally should allows <spc> w h/j/k/l
to move freely around the panels/sidebar with the commands used in Quick Window Nav The shortcut binding like the following will allow vspacecode to execute when the focused on the sidebar and not on an input box such as the search box.
{
"key": "space",
"command": "vspacecode.space",
"when": "sideBarFocus && !inputFocus && !whichkeyActive"
}
There are some issues with that:
<spc>
and <esc>
have meaning to debug console and terminal, so how should we defocus?The comment #80 (comment) offers some workarounds, and a tracking issue on vscode main repo to implement a command to defocus.
Is it possible to mimic the hybrid style of spacemacs?
@MarcoIeni from stevenguh/spacecode#10
example here
Draft:
to test the project: 1. clone and project 2. checkout develop branch 3. open the folder with vscode 4. Press F5 to run a debug vscode with extension in development installed on that instance.
The README says:
After the installation of the extension, a notification will help you to configure both the necessary settings and user bindings.
I had an empty settings.json file and nothing appeared for me and key bindings do not work.
I tried to uninstall and reinstall several times, but the behavior is the same.
<spc> f l
are bound to two commands -- revealInOS
and for changing file language. These commands are unique to VSCode, and need to figure out a way to put them
After finishing a selection with <spc> v
it doesn't automatically goes into visual mode. An additional v
is needed once you escape the menu to toggle to visual mode.
Is it possible to have a keybinding consisting of SPC + 3 keystrokes (eg. SPC x l s
) ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.