I'm trying to change my sublime theme/colour scheme and i get
'unexpected trailing characters'
When I try to save the /User/Preferences.sublime-settings with this config
{
"theme": "Afterglow-green.sublime-theme",
"color_scheme": "Packages/Theme - Afterglow/Afterglow.tmTheme"
}
{
"tabs_small": true
}
I can't work out why I would be getting that message?
Your settings files in Sublime (all of them) need to be valid JSON. Yours should be as follows:
{
"theme": "Afterglow-green.sublime-theme",
"color_scheme": "Packages/Theme - Afterglow/Afterglow.tmTheme",
"tabs_small": true
}
Note that everything is enclosed in one (and only one) outer dictionary, denoted by curly braces {}. There should also be a comma , at the end of every key: value pair, except for the last line. If there is only one line, don't use a comma.
Just out of interest, what is the "tabs_small" setting for? It's not one of Sublime's default settings.
The selected answer is correct, however this prompt can also occur during application startup.
If this error occurs when you're starting Sublime, navigate to C:/Users/{Your User}/AppData/Roaming/Sublime Text 3/Packages/User and open Plain text.sublime-settings.
The issue with JSON can be resolved here.
Related
I would like to know how to delete :
all of the contents inside a php tag using vim
<?php i want to delete this ?>
If your opening & closing PHP tags (<?php ... ?>) are in the same line, you can do it this way.
Put your cursor at the first character after PHP opening tag.
Type v/ ?[enter]d in normal mode.
The 2nd point means to enters visual mode ('v') from the first character, searches ('/') for the [space]? (' ?') pattern (exactly before the PHP closing tag), and then delete it ('d').
Use di< or di> to delete all the characters inside <>. The cursor should be inside of the <>.
Use ci< or ci> to delete and be in insert mode.
Helpful but Optional Explanation:
It is better to start with text-objects. Excerpt from :h text-objects, given below, suggest two forms i and a
This is a series of commands that can only be used while in Visual mode or
after an operator. The commands that start with "a" select "a"n object
including white space, the commands starting with "i" select an "inner" object
without white space, or just the white space. Thus the "inner" commands always select less text than the "a" commands.
text-objects are useful to other character pair like (), {}, etc. For example, it is useful while changing
if ( i == true ) {
}
to
if (_) {
}
by using ci( or ci).
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
(English is not my native language so there might be mistakes here:)
I was trying to change the visual style of Sublime Text 3, I installed the "https://github.com/kkga/spacegray" but were stopped by an error. This was not the first time and have got this message before:
Error trying to parse settings: Unexpected character, expected a comma or closing bracket in Packages\User\Preferences.sublime-settings:19:1
As you can see it highlights the colon but can't fix it either way, every setting above the style are not in use now because it only accepts (and activates the style) if I cut out everything else like this:
I tried changing characters and finding answers for this problem but have been unsuccessful until now. My settings
The problem is that you are missing a comma there in line 18, it should be:
"word wrap": false,
That's why you get the parsing error, after each option there must be either a comma, indicating that there are more config parameters remaining, or a closing bracket }.
When adding new settings, make sure that all of them are separated by commas.
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/
TextMate 1 had a preference called "Auto-pair characters (quotes etc.)" that would allow you to enable or disable the auto pairing functionality.
Is it possible to disable this feature in TextMate 2?
You can disable it for a given bundle as explained in this issue on GitHub.
Basically you have to edit an option file of the bundle and add smartTypingPairs = ( ); near the end of the file.
I don't know if this can be generalized using the .tm_properties files but you are welcome to try (and report your results).
There is also a user defaults key for this:
defaults write com.macromates.TextMate disableTypingPairs -bool YES
Automatic "Typing Pairs" is a TextMate 2 Hidden Setting
When you type an opening brace, parenthesis, quote character, or similar, TextMate will insert the closing character.
Disable via Terminal:
defaults write com.macromates.TextMate disableTypingPairs YES
A follow-up for Ruby coders. After disabling auto-pairing, you'll still find that typing # inside a double-quoted ("...") string expands to #{}. If you want to disable this:
"Bundles" menu -> "Edit Bundles..."
Select "Ruby" in the left column
Select "Other Actions" in the next column
Select "Embedded Code - #{...}" in the third column
Turn off the "Enable this item" checkbox in the drawer
Type Cmd+S to save the updated bundle
Now you can type "# without any auto-expansion/pairing. If you like typing # and having the first { appear but don't want the closing } added, then instead of disabling the item, just edit in the bottom pane to remove the trailing }:
#{${1:$TM_SELECTED_TEXT}
If you like selecting text within strings and typing # to have it enclosed in #{...} though, the above changed will make it quite awkward, so beware.