How do I stop Sublime Text converting Sass variables on pressing tab? - css

Does anyone know of a way to prevent Sublime Text 3 converting sass variables on pressing tab?
For example, I might type $variable-name and then press tab, intending to insert the : and space, which would be the normal CSS behaviour. Within doc type sass, I get 1variable-name:; instead.
It's rather annoying to have to correct every time, and I'm sure others get irritated with the same. I have the Sass and Emmet packages installed.
Many thanks. Your help is much appreciated.

Too long for a comment...
So I did a little digging last night, and from what I can tell this behavior is hard-coded into Sublime. The command that's executed when Tab is pressed right after a variable is expand_abbreviation_by_tab. Many times, Sublime commands are implemented in .py files, and can so be edited to suit your needs. Unfortunately, I was unable to find any mention of this command anywhere, leading me to believe that it's hard-coded. I suppose a workaround would be to enter a space before hitting Tab, if your end goal is to have the colons : aligned with each other. Another option would be to use the Alignment plugin, available through Package Control. It's very configurable, and I highly recommend it.

Related

Atom folding HTML like Sublime Text?

Tried to switch from Sublime to Atom like two years ago, but after days of searching couldn't find a reasonable way to make the text fold like in Sublime text (showing the closing tag as well).
Two years later, today, I really want to give it one more try and I still can't find a way to make the folding work with atom settings or any plugins.
If there is a way to give Atom the folding properties of Sublime Text, can anyone give a me link or instruction or whatever how do make it happen ?
P.s: Is it really impossible to do or I just plainly suck at searching online?
https://flight-manual.atom.io/using-atom/sections/folding/
Alt+Cmd+[ and Alt+Cmd+] folds the code. Alternately you can toggle the arrow button just like you can in Sublime.
Replace Cmd with Ctrl if you are on Windows or Linux.

How to highlight lines in Atom Editor?

I'm aware of the different abilities to highlight based on filetype, but what I'm looking for is something similar to how in a typical text editor you can highlight a line (not just change the color text).
Is this possible to do in the Atom editor? If so, how do you do it? Is there a plugin for this?
The reason I want to do this is for organizational purposes, and sometimes the files I am working in our custom files that are not necessarily code but documentation (usually both are together in the same file), and the documentation part is where I want to add these highlights.
The only Atom package I know of that has a somewhat similar functionality is the bookmarks package.
It is an Atom core package, so you most likely have it installed already.
It might not be exactly what you were looking for, since it only allows setting bookmarks on lines of your open files.
As soon as you close a file, the bookmarks are lost.
But while working on several opened files, it can be very useful to quickly navigate through these bookmarks.
The reason why no package like you asked for exists, probably is that it would be really hard or at least impractical to implement.
Imagine you set dozends of highlights on a file which is under version control (git, svn, etc.) and then pull in a newer version of this file where several lines were added, removed, changed, shifted ...
To still be able to show the highlights on the correct lines, the information of such highlights would need to be under the same version control. Essentially you would need to store this highlight on the line itself, which would mean everybody had the same highlights, which is probably not what you want. Because if you wanted that, you could just format your documentation with markdown or similar in the first place ;)

How to disable syntax highlighting in Atom.io

Is there a way to disable syntax highlighting in Atom.io?
I have searched a bit and ended up creating my own syntax package (https://atom.io/themes/no-syntax-highlighting-syntax), but maybe there is a better way.
NB: I just want to disable syntax highlighting (ideally keeping only comments and code in a different color), but I still want the other language-related features of Atom.io working. Like language completions, language snippets, language closure/bloc detections, auto-indent, etc.
(Some people argues against syntax highlighting, stating it might be actually harmful to developer productivity. I wanted to try that. Ie. http://www.linusakesson.net/programming/syntaxhighlighting/ and https://www.robertmelton.com/2016/03/21/syntax-highlighting-off/)
You can use Ctrl+Shift+L (or press button bottom right) to select proper language. In your case it would be Plain Text.
Second option is install package https://atom.io/packages/file-types and add in config.cson:
'file-types':
'YOURS EXTENSION': 'text.plain'
Haven't found a better solution yet.
If you are trying to do the same thing as I was - disabling syntax highlighting in Atom.io while keeping comments differentiated, language completions, language snippets, language closure/bloc detections and auto-indent - I would just recommend to install the theme I've created: https://atom.io/themes/no-syntax-highlighting-syntax
Set the file syntax to plain text. You can do this with control alt L or something like that.

css content: X symbol

i was just looking though some css code on todomvc and i wanted to know how they did their destroy button. I found an X symbol.
i'm relative new to programming and i'm curious what is that? how do you make something like that?
and here is a screenshot:
click to enlarge
Hit Windows Key + R, type charmap and hit Run.
You can now happily explore all of the characters in all of the fonts on your system, choose one, then copy-paste it to your code.
However, I would advise against just blindly copying. I'm a single-byte-character-set-nerd, so I would prefer to use \2716 instead of directly pasting ✖ into my CSS file. You can find the code by clicking the desired character and looking for the U+#### in the status bar.
This is simply a Unicode character that you can type (or paste) into text just like any other. As long as the browser knows how to interpret the CSS file encoding (which it does) and the character is acceptable as part of the input (which it is for CSS) then it is no different to use than any plain English letter.
We can't tell which one exactly from the screenshot, but you can see some likely options in Wikipedia.
They did it using generated content in CSS, which means that when CSS is disabled, the symbol does not appear there at all. In the CSS rule for generated content, the symbol has been inserted as such, which looks odd, since it should be in quotes, but you are actually showing us just a look at the document via developer tools in some browser, and such tools are known to simplify and modify things. It is not possible to deduce from the given data how they entered the character.
Independently of the way in which the symbol has been entered, it will not display at all in many browsing situations, since font support to HEAVY MULTIPLICATION X (which is what the symbol seems to be) is limited. It would be much safer to use an image.

CSS Highlighting in Vim Breaks if I Open a Second Tab

I've been re-writing my resume from scratch (good way to start the new year, I think,) and I'm doing it as a webpage. Naturally I want all the HTML, CSS & Javascript in one file, so it'll be portable.
While working on it in Vim, I have the CSS, HTML, & Javascript sections of the document open in separate tabs. But as soon as I open a second tab, the syntax highlighting for the CSS turns off. The HTML and Javascript continue to be highlighted properly.
I'm not a Vim expert by any means, so I apologize if this is too basic a question, but I couldn't find any documentation (or existing posts on Stackoverflow) that address this issue.
Thanks in advance for any insight.
Because vim doesn't start looking for highlighting at the "top" of the file, but rather a few hundred lines up from the current on-screen view, you can sometimes get the highlighting to work by scrolling around a little.
If this works, you can tweak the syntax highlighting controls so that you don't have to waste your time scrolling around; for full details, see :help syn-sync. There's several options:
Forcing vim to start recognizing syntax from the very start of the file every time. This might lead to significant performance problems on huge files but that might also be an indication that your source could be better split apart.
:syntax sync fromstart
Increase the number of lines that are parsed. This reduces the chances of bad syntax recognition without necessarily incurring the expense of reparsing the entire file from the start each time.
:syntax sync minlines=200
Pick a number that is large enough to work almost all the time without significant performance penalties. This is probably the best approach to take, even 500 lines ought to be alright on most computers from the last decade.
If you're editing C-style code, vim can easily resynchronize using C-style comments. (Note, not the // newfangled variety but /* the original style */.) Probably not the best choice for HTML, CSS, JavaScript, but perhaps your code makes it more feasible:
:syntax sync ccomment
The fourth method uses "sync patterns", similar to the C-style comments, but more applicable to other environments. It has enough extra complications that I don't think describing it here is worth the effort -- :help syn-sync-fourth has all the details for the curious.
Any of these configuration options can be added to your ~/.vimrc file:
syntax sync fromstart
You can change the behavior based on what kind of files you're editing. Just leave off the leading : when adding lines to the file. Use autocmd to define it for types like this:
autocmd BufNewFile,BufRead *.html syntax sync fromstart
These may become relevant to provide an answer
what version of vim are you using? I'm assuming you're using Vim 7.3 (if not, you should - most linux distors have it, and there's an exe for Windows and MacVim for osx). It could be that your installation is old or broken.
Any plugins? A simple check will be to temporarily remove all your plugins, restart vim and see if this still happens.
Anything special in your .vimrc? If you customized it yourself then there are probably not too many surprises, but if you borrowed from someone else, you can do the same thing you did with the plugins folder (empty or bare-minimum file).
Hope this helps - good luck!

Resources