Format CSS with VIM like in Textmate - css

In TextMate there is this awesome option to "Format CSS" and "Format CSS Compressed". This option doesn't seem to exist in vim. Perhaps it's in a plugin I'm not aware of? Or maybe I need to integrate CSS Tidy somehow?

You can integrate CSS Tidy fairly easily. Since you're coming from TextMate I'll assume you're on a Mac. If you don't already have CSS tidy installed, I'd recommend installing it via a package manager, like the excellent Homebrew.
Once it's installed, you can allow Vim to use CSS tidy for the = command, which automatically formats code, by adding the following to your ~/.vimrc:
autocmd filetype css setlocal equalprg=csstidy\ -\ --silent=true
Now whenever you have a CSS file open, it will consult CSS Tidy to format it when you invoke the = command. Try it on an open CSS file with gg=G to format the whole document.
Consult the CSS Tidy usage guide to add any other options you like, and don't forget to escape spaces you add to the above ~/.vimrc command with \.

Related

Change setting in Notepad++ to default R language

I have some R code files with extension .R and use Notepad++ as default application to work on them.
However when I double click an .R file to open in Notepad++, it opens as plain text file as symbol highlighting for R is not applied as default. I therefore have to manually chose language as R from the Language tab.
Is there any way to set default behaviour of Notepad++ such that when it opens a .R file, it will directly apply default style for R?
I have gone through various advices e.g. https://superuser.com/questions/58672/how-to-set-the-default-language-in-notepad and tried to follow advices there, but still could not apply default setting of R to .R file directly. My setting configuration looks like below :
It would be really helpful if someone can point to the right approach set default behaviour of Notepad++ so that it will apply settings for R language directly to .R file.
I am using Windows 10 as OS.
I've gotten this issue.
I resolved it by deleting disabling Rebol language in Notepad++. After I've done that the R language was detected.
It's not the best answer if you use Rebol language but I don't use nor know it.
Settings / Preferences.../ Language / disabled items (or hidden in some translations)
Screenshot of language selection You should be able to select language from the drop down on the top row. Although I recently made the switch to VSCode - would recommend.
Edit:1 You can use VSCode with extension installed R then you can refer official documentations from extension provider

How to open css files in a readable format

I want to open the CSS files in Atom editor but it is formatted in a difficult way thread.
any ideas to open CSS files in a nice CSS format.CSS Files to open and read
To convert any minified(unreadable) file into readable form is called beautify.
The extension, plugin, software or tool which convert minified file into readable file is called Beautifier / Formatter.
There are several methods to use it.
Code Editor Extensions/Plugins
cssbeautify (ATOM)
HTML-CSS-JS Prettify (Sublime Text)
brackets-beautify (Adobe Brackets)
Beautify (VS Code)
Bundlers and Task Runner Tools
Prettier Webpack Plugin (Webpack)
gulp-cssbeautify (Gulp)
Online Tools
atom-beautify (https://atom.io/packages/atom-beautify)
freeformatter (https://www.freeformatter.com/css-beautifier.html)
Minify Code (http://minifycode.com/css-beautifier/)
You can also use it with Developer tools in your favorite browser.

How do I disable all auto-formatting in vscode in OSX?

I've been trying to disable auto-formatting on save for vs code and have had no luck. I have just started using it and use no extensions.
I've tried adding the setting:
"editor.formatOnSave": false
To no avail.
It continues to take my perfectly formatted css and strip all the whitespace and stick it on one line.
Any suggestions would be appreciated. I just want it to save the file as I have written it.
This sounds like your css is being minified when you save the file. As a formatter would not place all the css on one line.
Are you using a build process? eg: gulp, grunt, sass, less, etc..

How to edit a sass file in Ubuntu 16.04

I have a package which uses sass files for Unity DE theme. It's a GTK theme and I want to change the colour of the theme. The owner says I will have to edit a sass file. And also warns not to edit them directly ? Am I correct to understand that first I have to convert it to CSS, edit it and then convert back to sass ? Kindly guide me. Thanks.
Nope. There is no need to convert sass to css and edit it and convert it back.
Sass is a text file, so you can edit it with any text editor like gedit, emacs, nano , sublime text or etc.
I have no idea your framework want to do with that sass file, but i think there is no need to convert it to css manually.
If you have no idea about how sass structure it is you can view this.

*.less syntax highlighting in Geany

Is there any way to add syntax highlighting for *.less files in Geany? I found that using *.css syntax higlighting, sugessted somewhere in the internet is not enough for me, and in fact it making bloody mess from any more complicated *.less stylesheet.
I really like Geany, so changing IDE is not an option.
Thanks in advance!
I would suggest you to write your own highlighting.
In this case you should edit file filetype_extensions.conf, create a file filetype.less (see other filetypes for examples, preferably those similar to .less - like .css) and maybe play around with filetype.conf.
On the other hand, if you never work with .css files, you could just edit corresponding configuration files to set up the highlighting you would enjoy.
If this is still not enough, you may have take another editor (with designed highlighting for .less files), see how the highlighting is organised there and then reproduce it with geany.
This may be overcomplicated solution, though I don't insist it's the only one.
On Geany menu: Tools -> Configurations Files -> filetype_extensions.conf
Change:
CSS=*.css;
With:
CSS=*.css;*.scss;*.less;
And your *.less file will be highlighted enough to start to work

Resources