I'm trying to bind ":W" editor command to save the file just like ":w". I make a lot of this typos.
The vim plugin is: https://marketplace.visualstudio.com/items?itemName=vscodevim.vim
This settings.json code doesn't work:
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [":","W"],
"commands": [
"workbench.action.files.save"
]
}
]
Unfortunately this is not possible in vs code vim, but I ended up doing what bsaf suggested here and rebound : to ; so that I wouldn't accidentally be holding shift down while pressing w, which doesn't solve the problem you asked but it does solve the problem you mentioned in your post. You can do this by adding this to your settings.json file:
"vim.normalModeKeyBindings": [
{
"before": [";"],
"after": [":"]
}
]
You can still use : as normal, but now ; will also allow you to run editor commands.
Related
I have a project with a myproject.sublime-project file. If I open the project by opening this file in the Sublime Text UI, Sublime respects the exclusion rules in the file.
However, if I open the file in Sublime from the command line, it does not:
subl myproject.sublime-project
The excluded files and folders appear in the Sublime Text UI. The same is true if I do subl ..
Is there a way I can open this project from the command line, and have it respect the rules in myproject.sublime-project?
Here are the contents of the file, for reference:
{
"folders":
[
{
"path": ".",
"file_exclude_patterns": [
"server/site/*.js"
],
"folder_exclude_patterns": [
".sass-cache",
"node_modules",
]
}
]
}
I already tried using the SublimeAStyle Package, but it didn't work. When I pressed the keys, the command would not fire (I checked in the console). Now I am trying to write my own key-shortcut to run the program on my source code. I have this:
{ "keys": ["ctrl+alt+f"], "command": "exec", "args": { "cmd": ["C:\\Program Files\\AStyle\\bin\\astyle.exe", "${file_name}"]} }
but the ${file_name} is not expanding to pass the file name to the command. Is there anything I am doing wrong?
I want to set a shortcut to open my current file using an external program (in my case, Visual Studio).
I thought I could use the $file variable, available in the build system. So it I write:
{ "keys": ["ctrl+o"], "command": "exec", "args": {"shell_cmd": "\"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\devenv.exe\" $file"} }
I get in the Sublime console prompt:
Running "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe" $file
As you can see, the $file variable isn't expanded to the pull path of the open file. Does anyone know what's the problem here?
Working solution for (but for OS X) was to use it like this:
{ "keys": ["super+shift+option+o"], "command": "exec", "args": {"cmd": ["open", "-a", "ForkLift", ""]}}
I am using the gnuplot package from PackageControl in Sublime Text 3 on Windows. My gnuplot code successfully builds when run from Sublime Text, but if using a terminal that outputs the plot to a graphics window (such as the default wxt), the window appears and closes immediately.
Presumably there is a way to edit the gnuplot.sublime-build file to keep the plot window from closing, but I have been unsuccessful so far.
My Sublime Text build file for gnuplot currently looks like this:
{
"cmd": ["gnuplot", "$file"],
"working_dir": "${project_path:${folder}}",
"selector": "source.gnuplot",
"variants": [
{
"cmd": ["start", "gnuplot", "-persist", "$file"],
"shell": true
}
]
}
Unfortunately, the -persist has no effect.
I had this problem as well... I ended up just adding:
pause -1
To the end of my script.
I would like to run a external python script (or external command/program) when I press a key on Sublime Text 2.
How can I do this?
Here is a solution:
Preferences->Key Bindings - User and put this in the file (overriding the [,] inside):
[
{ "keys": ["<your shortucut>"], "command": "exec", "args": { "cmd": ["<path to your script>"]} }
]
Where <your shortcut> as the name says is the shortcut (examples: F1, ctrl+shift+F1, etc.) and <path to your command> is the location of your command (examples: echo, /home/user/scripts/my_script.py, ls, etc.)