Sublime Text 2 Highlight Gutter - text-editor

By default the line number / gutter area in sublime text 2 is highlighted when the caret is on that line. How can I turn it off?
I see options to hide the gutter but I want the line numbers to be visible. Thanks.

To turn off line highlighting go to preferences>settings - User through the menus and add this line:
"highlight_line": false,
then save. I am using the default Monokai theme in linux, this will change it from:
to:
As you can see the line is no longer highlighted (it doesn't show in the picture but my cursor is still on the line), but the gutter numbers are. I think you also want to get rid of that? So, open the theme file .../sublime-text-2/Packages/Color Scheme - Default/Monokai.tmTheme, and change the <key>lineHighlight</key> colour, so it is the same as the <key>background</key> color, ie. #3E3D32 goes to #272822, like this:
On saving, it should resolve your problem:
Only the 2nd step is really neccessary.

Some additions
"font_size": 9.0,
"caret_style": "smooth",
"highlight_line": true,
"line_padding_bottom": 2,
"line_padding_top": 2,
"fade_fold_buttons": false,

Related

How to auto-break a long word when auto-wrapping text

I know we can use "word_wrap": "auto" in the User settings to make Sublime Text 3 auto wrap text, but how can I make it break a long word when wrapping?
In a sentence like:
a long word aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
I want it to
a long word aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaa
but not:
a long word
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
First, I saw advice to add "auto_wrap_break_long_word" : false, to the setting file, but it made no sense to me.
And then, I get advice from comments by using Sublime Wrap Plus
However, it is not what I want.
The Readme of Sublime Wrap Plus says:
Enhanced “wrap lines” command for Sublime Text 2 or 3. This is for the manual hard line wrap command. It does not affect the automatic soft line wrapping.
But what I want is not “HARD line wrap” because it will add real some line breaks and change the text file. And what I want is to break long word in “SOFT line wrap”(which will not change texts but only change how it looks)
In fact , I've tried to install the Sublime Wrap Plus package and set "WrapPlus.break_long_words":true in Preferences >> Settings — User.
But nothing changed about my SOFT line wrap.
THANKS for all advice anyway!

Sublime Text 3 is automatically converting spaces to tabs on save, regardless of settings. How can I stop this?

I'm having trouble with Sublime Text 3.
Even if I select View > Indentation > Convert tabs to spaces and View > Indentation > Indent using spaces as soon as I save the file it all automatically gets converted to tabs.
How can I stop this behaviour from occurring?
I'm currently using default config settings for this:
// The number of spaces a tab is considered equal to
"tab_size": 4,
// Set to true to insert spaces when tab is pressed
"translate_tabs_to_spaces": false,
// If translate_tabs_to_spaces is true, use_tab_stops will make tab and
// backspace insert/delete up to the next tabstop
"use_tab_stops": true,
// Set to false to disable detection of tabs vs. spaces on load
"detect_indentation": true,
// Calculates indentation automatically when pressing enter
"auto_indent": true,
// Makes auto indent a little smarter, e.g., by indenting the next line
// after an if statement in C. Requires auto_indent to be enabled.
"smart_indent": true,
The problem for me was the EditorConfig plugin, when disabling it in PackageControl the problem went away.
Alternatively you can just edit the problematic .editorconfig file and just comment out (or set to false) the trim_trailing_whitespace option.
Use the indentation option under the tab View.
You can select Tab Width:2
My solution was to give up and switch to VSCode. I wasn't happy about it. I resisted. I cursed. But in the end I had to give in as it is way better. I spend far less time fiddling with editor config and more time coding.
You have two solutions:
To do "View > Indentation > Convert tabs to spaces" before saving
the file.
To replace them as a normal text by pressing Ctrl + H. >>> Find all Tabs >>> Replace with 4 spaces

Sublime 3: Ctrl-c triggers even if no text is selected, drops text in clipboard

I'm using Sublime 3083.
Suppose I cut some text (Ctrl-x) in a file and then attempt to paste it somewhere else, in that same file or another one.
I position the cursor on the line I want to paste the text.
If I hit Ctrl-v the text is pasted with no issues.
But if I accidentally hit Ctrl-c instead, the text that was cut can no longer be pasted. It is dropped from the clipboard and I'm forced to Ctrl-z back to the point before the text was cut.
This happens even if no text is selected when hitting Ctrl-c.
I tested and this behaviour seems to be exclusive from Sublime. Is this a feature? If so, can it be disabled?
There is a setting in Preferences > Settings - Default which can change the behavior:
// If true, the copy and cut commands will operate on the current line
// when the selection is empty, rather than doing nothing.
"copy_with_empty_selection": false,
Changing it to false should make it so that it doesn't copy an empty selection.
Add this to your User settings:
"copy_with_empty_selection": false
Step-by-Step:
Preferences > Settings
A new window will open with 2 files:
In sublime-settings -- User (the one on the right) paste this:
"copy_with_empty_selection": false
Why?
If you do it in Default settings it will be overwritten when sublime updates. Any changes you make to settings should be in User Settings.

SublimeText 3 - Nothing works to force indentation to 4 spaces

Issue:
Can't set/change tab indentation in documents
Have tried:
With document open: >Indentation >Tab width: 4
With document open: >Indentation >Convert Indentation to Spaces
Adding the following to user settings:
"smart_indent": true,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true,
"use_tab_stops": true,
"word_wrap": false
Adding the following to the php-specific preferences:
"tab_size": 4,
"translate_tabs_to_spaces": true
Questions:
Does it seem weird that changing the spaces from the menu doesn't even work? SublimeText states that the tab indentation is 4 spaces - but it's not.
Does anyone know how to force SublimeText to apply a tab indentation to a document or to a project?
Update:
It looks as if ST3 is not recognising some spaces as indentation and thinks they're just spaces - see image
The above image is the result of converting spaces to tabs (the opposite of what I want) to see what ST3 thinks is indentation
Does anyone know how to fix this besides going through every document
and changing spacing on every single line?
The only command from that list that actively changes all indentation in the current file is the > Indentation > Convert Indentation to Spaces. The other settings only take effect from "that point on" (i.e. existing indentation will remain tabs, newly created ones will be spaces). Also, make sure you try running the command after selecting Indentation > Indent using spaces, and Tab Width 4
Could you check that running Convert Indentation to Spaces, and with "draw_white_space": "all", on, that indentation is shown using semi-transparent dots? Navigation with the caret will still "jump" the 4 spaces.
Only other thing I can think of is it's somehow being a read-only file.
Can't comment because I've less than 50 rep.
There is a status bar at the very bottom of the window. If not visible go to View> Show status bar.
At the rightmost end you will see the language of the current file, Here python.
After that, it will show you whether you are using tabs or spaces and how many of them are being used. Click on it and you will get
Taken from https://css-tricks.com/changing-spaces-tabs-sublime-text/

Highlight nbsp character in Sublime Text 2?

Is there a way to highlight special whitespace characters like nbsp in Sublime Text 2? Several times I copied text from word users to my code and it crashed because I couldn't see these "illegal" whitespace characters...
Thanks!
Chris
Here is a plugin for Sublime Text that does the job:
https://github.com/possan/sublime_unicode_nbsp
You can comment out lines 125 and 126 if the highlighting of trailing whitespaces annoys you.
Edit your user settings as below (you may go into "Preferences->Settings Default." or "Preferences->Setting User." depends on whether you've already had some customized settings) :
{
"color_scheme": ...,
"font_size": ...,
"draw_white_space": "$your_selection"
}
The rule to set the setting is:
Set to "none" to turn off drawing white space
Set to a list to draw only the white space within the list
Set to "all" to draw all white space

Resources