I want to change the option of Brackets Beautify.
"newline_between_rules": true
to
"newline_between_rules": false
How can I change this?
Related
When analyzing the logs you often need to find all lines containing some specific word in the log file. The problem is when you do a regular search in notepad++ it returns the same line multiple times, if it contains this word in different positions. To alleviate that I switch to regex search and use the following expression
(.*\K)(text)
Where .* matches the full line, \K discards the selection and then (text) matches the last occurrence of text on the line.
This method looks ugly and is not very fast. Is there any better way to do it?
To match only the first occurrence you will have to search many characters from beginning of line, discard that search and look for text that you are looking for.
Following regex does the same.
Regex: (^.*?)\Ktrue true is my text here.
Dummy Input
Log date 12/12/2015
Sr No desc amount status
1 true $10000 true
2 true $10000 false
3 true $10000 true
4 true $10000 false
5 true $10000 true
Regex101 Demo
Notepad++ Demo
I Want If The Previous succeeded
PROMPT="%F{46}(^v^)%f %F{67}%n%f%F{61}#%f%F{70}%m%f %F{116}in %f%F{65}%~%f%B%F{39} ->%f%b "
If Not
PROMPT="%F{9}(\`O´)%f %F{67}%n%f%F{61}#%f%F{70}%m%f %F{116}in %f%F{65}%~%f%B%F{39} ->%f%b "
zsh has a conditional escape available to use in prompts. It has the general form
%(x.true.false)
where x is a single character condition to test, and true and false are arbitrary strings that the %(...) construct will expand to when that condition is true or false, respectively. In your case, the condition character will be ?, so you can write
PROMPT="%(?.%F{46}(^v^)%f.%F{9}(\`O´)%f) %F{67}..."
Using R, I have a long list of keywords that I'm searching for in a dataset. One of the keywords needs to have parentheses around it in order to be included.
I've been attempting to replace the parenthesis in the keywords list with \\ then the parentheses, but have not been successful. If there is a way to modify the grepl() function to recognize them, that would also be helpful. Here is an example of what I'm trying to accomplish:
patterns<-c("dog","cat","(fish)")
data<-c("brown dog","black bear","salmon (fish)","red fish")
patterns2<- paste(patterns,collapse="|")
grepl(patterns2,data)
[1] TRUE FALSE TRUE TRUE
I would like salmon (fish) to give TRUE, and red fish to give FALSE.
Thank you!
As noted by #joran in the comments, the pattern should look like so:
patterns<-c("dog","cat","\\(fish\\)")
The \\s will tell R to read the parentheses literally when searching for the pattern.
Easiest way to achieve this if you don't want to make the change manually:
patterns <- gsub("([()])","\\\\\\1", patterns)
Which will result in:
[1] "dog" "cat" "\\(fish\\)"
If you're not very familiar with regular expressions, what happens here is that it looks for any one character within the the square brackets. The round brackets around that tell it to save whatever it finds that matches the contents. Then, the first four slashes in the second argument tell it to replace what it found with two slashes (each two slashes translate into one slash), and the \\1 tells it to add whatever it saved from the first argument - i.e., either ( or ).
Another option is to forget regex and use grepl with fixed = T
rowSums(sapply(patterns, grepl, data, fixed = T)) > 0
# [1] TRUE FALSE TRUE FALSE
I have this in my config.cson:
".java.source":
whitespace:
removeTrailingWhitespace: false
".plain.text":
whitespace:
removeTrailingWhitespace: false
It works for .java files and .txt files. However, I also want it to work for specific file extensions that I don't have a scope name for.
E.g. when I edit a .foobar file, Atom treats it as plain text. However, it still adds a trailing newline. How do I prevent this?
You need to assign a syntax to your custom file type, then your previous configuration will work for them.
Example
"*":
core:
customFileTypes:
"source.js": [
"*.foobar"
]
Everything I found online was about removing the trailing whitespace altogether but I'd like to remove it only for text files, in particular .key files.
I tried to modify the config.cson like this:
".text.plain.key":
whitespace:
removeTrailingWhitespace: true
or small variations of it, but I wasn't able to make it work.
If text.plain.key is a valid scope, the correct entry should look like this:
".text.plain.key":
editor:
removeTrailingWhitespace: true