Karabiner: Change double quote to single - karabiner

Is it possible to replace double quote key to single quote with Karabiner (keyboard customizer for OS X)?
https://pqrs.org/osx/karabiner/

Yes, I think so. Look into how the private.xml works, which you can open via the Misc & Uninstall Tab. However, I think for changing the actual key codes you need seil, but you can probably do it with Karabiner alone by remapping SHIFT_L + QUOTE.
You might end up w/ s.th. like this:
<?xml version="1.0"?>
<root>
<item>
<name>Double Quote to Single Quote</name>
<identifier>private.double_quote_to_single_quote</identifier>
<autogen>
__KeyToKey__
KeyCode::QUOTE, ModifierKey::SHIFT_L,
KeyCode::QUOTE
</autogen>
</item>
</root>
This is just a guess though, but hopefully brings you in the right direction.

I have found this when I was searching for a way to swap single quote and double quote. This is how I've managed to do it with this: https://ke-complex-modifications.pqrs.org/#exchange_single_and_double_quote

Related

How to convert embedded CRLF codes to their REAL newlines in Vscode?

I searched everywhere for this, the problem is that the search criteria is very similar to other questions.
The issue I have is that file (script actually) is embedded in another file. So when I open the parent file I can see the script as massive string with several \n and \r\n codes. I need a way to convert these codes to what they should be so that it formats the code correctly then I can read said code and work on it.
Quick snippet:
\n\n\n\n\nlocal scriptingFunctions\n\n\n\n\nlocal measuringCircles = {}\r\nlocal isCurrentlyCheckingCoherency
Should covert to:
local scriptingFunctions
local measuringCircles = {}
local isCurrentlyCheckingCoherency
perform a Regex Find-Replace
Find: (\\r)?\\n
Replace: \n
If you don't need to reconvert from newlines to \n after you're done working on the code, you can accomplish the trick by simply pressing ctrl-f and substituting every occurrence of \n with a new line (you can type enter in the replace box by pressing ctrl-enter or shift-enter).
See an example ctrl-f to do this:
If after you're done working on the code you need to reconvert to \n, you can add an invisible char to the replace string (typing it like ctrl-enter invisibleChar), and after you're done you can re-replace it with \n.
There's plenty of invisible chars, but I'd personally suggest [U+200b] (you can copy it from here); another good one is [U+2800] (⠀), as it renders as a normal whitespace, and thus is noticeable.
A thing to notice is that recent versions of vscode will show a highlight around invisible chars, but you can easily disable it by clicking on Adjust settings and then selecting Exclude from being highlighted.
If you need to reenable highlighting in the future, you'll have to look for "editor.unicodeHighlight.allowedCharacters" in the settings.

how to avoid emacs' replacing quotation marks in French

When you use babel with French (set by, \usepackage[francais]{babel} emacs replaces automatically quotations marks (") by \og and \fg (you need only to restart emacs after adding babel).
It could be quite cool. But I'm using csquotes package which allows to have the good quotation marks by simply writing ".
\usepackage[babel]{csquotes}
\MakeOuterQuote{"}
So this amazing feature of emacs (the automatic replacement of " by \og or \fg) is useless for me and even painful.
How do I remove it?
It seems it is the font-latex-quotes variable which manage this. But options are only French (<< >>) or German (>> <<). I would like to redefine this variable to consider "test" as quote with test in color.
Assuming you are using auctex. you need to customize the value of variable TeX-quote-language to 'override.
This special value makes that language-related styles inhibit to modify its value, so quoting magic is deactivated.
I fixed this issue by modifying the variables LaTeX-csquotes-open-quote and LaTeX-csquotes-close-quote.
I define the first variable as \enquote{ and the second as }.

Replacing a string in Rubymine with a string with newlines

I want to use the Search and Replace dialogue in Rubymine, or something similar to replace something like "Scenario:" with "#Desktop\nScenario"
I'm trying to replace every instance of Scenario: in a large Cucumber test suite with
#desktop
Scenario:
Any best ways to do this?
Update:
Thanks to #ryan2johnson9 comment, I realise there's now an easier option (tested on 2017.3).
By clicking on the "New Line" (or using the shortcut Ctrl+Shift+Enter / Alt+Enter), the input becomes multilines.
Original Answer
In the search and replace box, if you tick the "Regex" option you can do:
Search: "Scenario:"
Replace by: "#desktop\nScenario:"
The only trick is to tick the "Regex" option :)
Rubymine has macros (http://www.jetbrains.com/ruby/webhelp/binding-macros-with-keyboard-shortcuts.html) but I dont think they are powerful enough for this example.
It's possible that you could solve it with some elaborate feature hidden inside Rubymine, but I think it would be a lot easier to do this with a tool like perl/sed from the Terminal. If you are using Windows I assume you could search the net and find a text search/replace tool that fits your need.
In OSX I there are a bunch of Text Substitutions app too.
I would go that route since Rubymines macro tool isnt up to the task.
Here's a cheap and sleazy alternative:
Copy a newline character from between two empty lines in the file being edited. Temporarily add two empty lines if you don't have any.
Set up search/replace and enter the string you want to replace into the search text input box.
Paste the newline you just copied into the replacement text box plus whatever other text you want. You will be able to see the height of the replacement text input box grow vertically by one line due to the newline.
Perform the search/replace.
For this, the use of the Rubymine regex is optional.

Why are values copied from returned grid marked with quotes?

In PgAdmin III, when I copy value from returned grid and paste it into the query text, it appears there in double quotes. But to use it in query, in where clause for example, it has to be marked with apostrophe. So I have to replace quotes with apostrophe. It is rather weird for me that I always have to do so. Why it is designed in such strange way?
This is a kind of stupid theoretical question, I do not expect any practical answers :)
You can customize the quoting character, by following the following steps.
On the PgAdmin-III main window, click on File and then Options
Click on the Query Tool Tab
Change the field called "Result copy quote character" to apostrophe (')
It should work, you may need to close and open PgAdmin-III
EDIT: For Mac OS X the option could be found in pgAdmin3 > Preferences > Query tool > Results grid
For pgAdmin 4 go to File> Preferences> SQL Editor> Results Grid. You can change the Quotation mark to single quote or none.

Remove blank line in Eclipse

How can I remove lines that only contain spaces when using Eclipse Find/Replace prompt. I checked the "Regular Expression" check box, and tried the following, neither of which worked.
^[:space:]*$
and
^\s*$
Find: ^\s*\n
Replace with: (empty)
sry this might be an different answer but you can set the number of blank lines you wish to have after fields, methods and blocks in the formatting dialog of the eclipse preferences. then you can hit ctrl-shift-f to automatically format your code depending on your custom definitions.
have fun!
I was suprised that for XML files edited with Eclipse there is a good solution:
Select the checkbox value named 'Clear all blank lines' in Formatting panel
Window->Preferences->XML->XML Files-> Editor
Save and use the "Ctrl+Shift+F' shortcut
The blank lines will dissappear!
for the find/replace operation, "\n\r\s" regex will work on windows, for unix based system, "\n\s" can be used
as already suggested, you can format your code by Ctl+Shift+F
for manual work, locate a blank line and press Ctl+D (Cmd+D on Mac) <- gives u satisfaction of killing the line with your own bare hands :)
cheer!
This one worked for me for years:
Replace this: [\t ]+$
With nothing
Hope this helps!
Many thanks to lamamac.
In genereal, when you want to do search replace with regular expressions in eclipse the $ sign doesn't work as it should.
Use '\s*\n' instead of '$'
As already suggested, regular expression and replacement is the solution, but such response would have been saving some minutes to me:
click on ctrl+f
use this replacement: