VSCode : disable formatting of a specific file (or extension) [duplicate] - handlebars.js

This question already has answers here:
How to exclude file extensions and languages from "format on save" in VSCode?
(8 answers)
Closed 4 years ago.
Using Visual Studio Code, is it possible to disable the formatting of a specific file (or extension)?
I try to use some Handlebars templates and I don't want VSCode to format them, at all. A simple example would be :
{{test1}}
{{test2}}
When I save this file (I do have - and want - "editor.formatOnSave" set to true), VsCode transforms the content to
{{test1}} {{test2}}
The only way I found for the file to stay untouched, is to name it "template.txt" instead of "template.hbs".
Any idea?

You can add file-specific exclusions like so:
"[handlebars]": { "editor.formatOnSave": false },

Related

In R, how to change working directory more easily? [duplicate]

This question already has answers here:
Escaping backslash (\) in string or paths in R
(4 answers)
Closed 1 year ago.
In how to change working directory more easily?
Currently, if we use 'setwd',we have to add many '\', sometimes it's boring
Is there any easier way for this ? (Just like Python can add 'r' )
setwd('C:\Users\Administrator\Desktop\myfolder') # can't work
setwd('C:\\Users\\Administrator\\Desktop\\myfolder') # can work,but havt to add many '\'
You could use r (for raw string) and add parenthesis:
> r"(C:\Users\Administrator\Desktop\myfolder)"
[1] "C:\\Users\\Administrator\\Desktop\\myfolder"
>
And now:
setwd(r"(C:\Users\Administrator\Desktop\myfolder)")
Or reading from clipboard automatically adds the extra slashes:
setwd(readClipboard())

Problem adding an image to database using SQL [duplicate]

This question already has answers here:
How to use LOAD_FILE to load a file into a MySQL blob?
(6 answers)
Closed 4 years ago.
INSERT INTO items (id,name,image,price) VALUES('1','iphone 5s',LOAD_FILE('C:\xampp\htdocs\project\1.jpg'),300);
this statement cause error
INSERT INTO items (id,name,image,price) VALUES('1','iphone 5s',LOAD_FILE('C:\xampp\htdocs\project\1.jpg'),300)
MySQL said: Documentation
here is the error
#1048 - Column 'image' cannot be null
Please double check the file path of your "1.jpg" or maybe look at the image format whether it is .jpg or .png.
Else, try this format:
LOAD_FILE('../1.jpg')
"Different backslash position"
I do not think you should mention the C:/xampp/htdocs/project because you are already in the project folder when you run your code.
Hopefully it is working.
You must escape backslashes in any string:
... LOAD_FILE('C:\\xampp\\htdocs\\project\\1.jpg') ...
Or, since MySQL will 'correctly' interpret forward-slashes, even on Windows:
... LOAD_FILE('C:/xampp/htdocs/project/1.jpg') ...
(I assume image is declared BLOB or MEDIUMBLOB?)

Add a separator to existing menu in Atom

I added a package to sort lines, but the most used command Sort closely follows the existing command Join Lines. For usability, I'd like to put in a separator to split them. I don't own the sort lines package. I'm just asking to change on my local copy of Atom.
Found it, opened the code for the sort-lines package, went to menus, opened sort-lines.cson, and added { 'type': 'separator' } under submenu.
Closed Atom and reopened, and the separator was there!

How can I replace variable names across files?

I am using atom as editor. I'd like to replace variable names across files. I've replaced jpy_usd by usd_jpy. I want to do that to all occurrences of jpy_usd in my rails project. Could you tell me if you know how to do it?
First you need to find word 'jpy_usd' by using this shortcut
cmd-shift-f
Then you can click replace all after fill the word that you want to replace.
Refer image below
You may refer to here for more details.
I've tried the following way.
type cmd+shift+f, then search all of jpy_usd in my project
move to one file
select one jpy_usd word, then type cmd+d in order to select the others jpy_usd in the same file. Thus edit them simultaneously
contine 2 & 3

Disable underscore "_" shortcut inserting "<-" in Vim R plugin [duplicate]

This question already has answers here:
Vim: underscore(_) automatically converted to (<-)
(4 answers)
Closed 8 years ago.
By default, the Vim-R-plugin inserts <- whenever I type or paste an underscore _. This creates problems when I paste stuff like geom_bar, which becomes geom <- bar. Is there a way to turn this short-cut off?
I tried looking at the manual (scroll down to Edit section) but couldn't figure out how to do it.
I'm using Vim-R-plugin Version 0.9.9.9
for Vim version 7.4.
From the help page of the plugin:
6.3. Assignment operator and Rnoweb completion of code block
...
To completely disable this feature, put in your vimrc:
let vimrplugin_assign = 0
--
EDIT: As of writing this (2019-10-25), add this to your vimrc instead:
6.4. Assignment operator and Rnoweb completion of code block
...
let R_assign = 0

Resources