For some reason when I try to comment in Sublime Ctrl+/ it will sometimes (not always) highlight the area like this. I'm just wondering if anyone knows what this is and if there's a way to stop sublime from doing it.
What you're seeing here is a diff hunk from the incremental diff functionality of Sublime Text, which tracks changes made to files and allows you to see what those changes are (and to revert them individually). It's controlled by the following setting (with the default value):
// Indicate modified lines in the gutter
// - true: Enables modified line indicators on all files
// - "auto": Enables modified line indicators on tracked files within Git
// - false: Disables modified line indicators
"mini_diff": true,
For files tracked by git
, the following setting controls what the diff is calculated against (for files not tracked by git
, the diff is against the file as it was when it was originally opened, so saving the file does not clear the indicators).
// This setting determines whether tracked Git files should be diffed
// against the index or HEAD.
// Valid values are "index" or "head"
"git_diff_target": "index",
This functionality encompasses tracking the changes, showing you indicators in the gutter, navigating between changes and showing you an inline diff that shows you how the change modified the document.
In your case, what you're seeing here is a line that you added being highlighted in a diff hunk, which can accidentally happen because the default key binding sequence for toggling the diff hunk is Ctrl+kCtrl+/ which includes Ctrl+/ -- the key used to toggle the state of the diff hunk.
You can use that key binding or the items in the context menu to re-toggle the state of the hunk off.
Information on the feature in general as well as the default key bindings, can be found in the official documentation, which is available at: https://www.sublimetext.com/docs/incremental_diff.html