Sublime Forum

Ctrl-S not saving

#1

Okay, this one is weird. For some reason, ctrl-s is not bound to the save command. At first I thought it was because I hadn’t registered, but I just registered the product and the problem persists.
I looked in the key bindings file, and it seems to be set up to bind ctrl-s to the save command, but it’s just not working. When I look at the File menu, there’s no key binding next to the Save command.
Help!
I tried pasting the entire key bindings script in the message, but it’s too big.
Here’s the relevant part at the top of the script:

[
	{ "keys": ["ctrl+shift+n"], "command": "new_window" },
	{ "keys": ["ctrl+shift+w"], "command": "close_window" },
	{ "keys": ["ctrl+o"], "command": "prompt_open_file" },
	{ "keys": ["ctrl+shift+t"], "command": "reopen_last_file", "args": {"source": "window"} },
	{ "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} },
	{ "keys": ["alt+shift+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"], "side_by_side": true} },
	{ "keys": ["ctrl+n"], "command": "new_file" },
	{ "keys": ["ctrl+s"], "command": "save", "args": { "async": true } },
	{ "keys": ["ctrl+shift+s"], "command": "prompt_save_as" },
	{ "keys": ["ctrl+f4"], "command": "close_file" },
	{ "keys": ["ctrl+w"], "command": "close" },
	{ "keys": ["ctrl+w"], "command": "close_transient", "context":
		[
			{ "key": "group_has_transient_sheet", "operator": "equal", "operand": true }
		]
	},
0 Likes

#2

If you open the console (View > Show Console) and enter sublime.log_commands(True); sublime.log_input(True) what gets logged in the console when you press ctrl+s?

0 Likes

#4

When I open the console, before running any commands, I get this:
mportError: No module named ‘SublimeKSP.default_syntax’
reloading python 3.3 plugin SublimeKSP.ksp_plugin
plugins loaded
Package Control: All specified packages up-to-date!

When I press ctrl-s, it logs this:

key evt: ctrl+s
command: sp_run_file
chr evt: (0x13)
command: drag_select {“event”: {“button”: 1, “x”: 481.5, “y”: 848.5}}
command: drag_select {“event”: {“button”: 1, “x”: 15.5, “y”: 757.5}}
key evt: up
command: move {“by”: “lines”, “forward”: false}
key evt: up
command: move {“by”: “lines”, “forward”: false}
command: drag_select {“event”: {“button”: 1, “x”: 13.5, “y”: 715.5}}

It looks like it’s been remapped to some other macro. I did install an extension for sonic pi, but when I search for ctrl-s, I couldn’t find anything except for the save file mapping. Any idea how to find this?

0 Likes

#5

Whatever package is providing sp_run_file has decided that you don’t want or need to save files any longer. All else being equal, the appropriate thing is probably to uninstall that package, turn your body physically into whatever direction you think the author of the package currently is from you right now, and think bad thoughts about them.

Failing that, Preferences > Settings > Key Bindings and adding the binding outlined below inside of the [ ] in the file that opens in the right hand pane will return the ctrl+s command to saving again.

Note also:

This indicates that some plugin or package is trying to do something with SublimeKSP and it’s not working, which is probably also worth resolving.

0 Likes

#6

Hilarious! Yes, clearly that SublimeKSP package is wreaking havoc.
I tried what you said, and pasted that line of code in the right window:

[
{ "keys": ["ctrl+s"], "command": "save", "args": { "async": true } },
]


I closed & reopened sublime, but ctrl-s still does nothing.
Is there another step I’m missing? Does this load automatically upon open, or is there something I need to do?
Thanks!

0 Likes

#7

Also (sorry to pester you with my noob ignorance, but) how do I uninstall a package? I’ve tried package control and package control>settings, but I don’t see any references to SublimeKSP in the settings files.

0 Likes

#8

As soon as you save the file the changes should apply immediately. Just to double check, what is the filename of the file that’s being edited? It should be something that ends in Packages/User/Default (<OSHERE>).sublime-keymap, where the <OSHERE> is something like Linux, Windows or OSX.

The key bindings in the User package are always loaded last and override any other binding that might be set and otherwise used, to give you full control.

Something else would be, does it not save in ALL files, or only in some of them?

It may also be worth noting that as far as I can see, the SublimeKSP package does not define such a command. However, this has been reported before so you’re not the first one to encounter it.

Following instructions there would be one way to resolve the problem; however another option that would shed some light would be to install CommandsBrowser and then select the CommandsBrowser: Browse available plugin/package core commands command that it adds to the command palette.

In the list of commands that opens, find sp_run_file and hit Enter to open the plugin that is providing that command. That will give us extra information on what package is actually doing this, so that you can remove it, or the issue can be reported, etc.

0 Likes

#9

Package Control: Remove Package will show you a list of the packages that it installed that you can uninstall; this is the same list that you will see in the Package Control.sublime-settings file as installed_packages.

If you don’t see that package in either location, that’s probably because it’s not installed.

As noted above, that particular package does not seem to provide this command, so it looks like some other package you have installed is trying to pull some information from it (or it is a really old version, or etc) so that name may be a bit of a red herring.

The steps outlined above in my prior post should tell you exactly what plugin file is defining the command, which will be a clear indication of what the package providing it is.

Another way to see that would be to paste the full error you see in the console, including the traceback that happens before it, which should show what it is that’s trying to do the import that is failing. The two issues may well be related.

0 Likes

#10

Okay, I’m diving deeper down the rabbit hole. I’m trying to revert to a clean install state, but the docs on how to do this don’t match what I’m seeing. I have 2 places with AppData for Sublime Text 3:
C:/Users/Harry/AppData/Local/Sublime Text 3
C:/Users/Harry/AppData/Roaming/Sublime Text 3
Local has the following dirs: Cache, Crash Reports
Roaming has the following dirs: Installed Packages, Lib, Local, Log, Packages, Trash.
In neither directory is there a subdirectory called “Data.” The local one has a directory called “Cache” – is that what I’m supposed to delete?
Thanks again. I had no idea this one would take me so deep in the rabbit hole, but reverting to installed state sounds like the simplest fix, if I can figure out how to do it.

0 Likes

#11

btw, the file name for the script I put in to fix it was “Default (Windows).sublime-keymap” (no extention, as far as I can tell, but the file browser says it’s a “json” file.)

0 Likes

#12

The instructions for reverting are mildly disingenuous because what it refers to as a Data does not exist by that name except in the specific case of a Portable Installation (such as the alternate download you can see on the download page for Windows).

In all other cases, including normal installations on windows, the Data folder is the colloquial name for the location where all of your user config is stored, which includes things like the folders that you mentioned here.

The video below goes over this in more detail, including instructions on how to revert and a demonstration of doing it.

https://www.youtube.com/watch?v=ShzQRN25Byw

0 Likes

#13

Phew! That did the trick. Thanks so much for all your help. I really appreciate it.
I subscribed to your youtube channel, and I’ll work on clambering up the learning curve. It’s obvious Sublime is a very deep tool, and I need to understand it much more than I do.

1 Like