Is there any way (Plugin, Script) to add quotation marks (or square brackets or parentheses) at the beginning and the end of selected text via a keyboard shortcut in the Kate editor?
I think of something like selecting a word and then pressing Ctrl-U (this would upcase the selected word). Is there something similar for quotation marks?
The "Configure Shortcuts" menu does not provide this option.
This should be possible to do by using Kate's Javascript plugin system: http://docs.kde.org/stable/en/kde-baseapps/kate/advanced-editing-tools-scripting.html.
By finding the word at the current cursor position and inserting text before and after, you could create a “surround with quotation marks” function.
For an example of a Kate script, see here: http://kucrut.org/move-cursor-to-next-prev-paragraph-in-kate/.
One solution would be the following:
Go to Settings > Configure Kate > Editing
Activate the Auto brackets option
Now you are able to wrap the selected text with brackets.
Though there is one drawback. The Auto brackets option is "always on", meaning that once you type "(" the corresponding ")" also comes up.
Related
I'm newbie in VBA. I would like to find all bold text and insert brackets before and after it.
For example, Before: This is bold text
After: {This is bold text}
I'm using MS Word
You don’t need to use VBA; Word’s UI can do it directly with Find and Replace:
Leave the “Find what” box empty, but press Ctrl-B to specify Format: Font: Bold. (You can also click the More >> button to access the Format drop-down button and select Bold from the Font dialog.)
In the “Replace with” box, type ^& (or you could type the asterisk, use the Special drop-down to choose “Find What Text”, and type the 2nd asterisk).
Click Replace All.
Each instance of bold will be “replaced” by an asterisk, the found content (i.e. the bold letter(s)), and another asterisk.
Edit: The ^& is a special code to represent “Find What Text” as a Replace option in Find and Replace. The “Special” button presents a list of available options by name for both the Find and Replace boxes, and will insert the code when you make the selection.
For example, I have a string wrapped in quotation marks, and I need select it all string wrapped. I usually select one by one each word using "Shift+Ctrl+Right Row" to the end. But it's not cool.
You can select the entire word by using the shortcut Alt+Shift+PERIOD.
if you are in a line with several words you can use this shortcut several times and the selection will move to the next words.
If by any chance you don't like the shortcut you can change it.
In Netbeans just go to menu Tools -> Options and choose Keymap. The shortcut that you will be looking is "Select Next Element".
I have a 20-page word document punctuated with descriptive notes throughout, like this:
3 Input Data Requirements
Some requirement text.
NOTE: This is a descriptive note about the requirement, which is the paragraph that I would like to use find-and-replace or a VBA script to select automatically and change the formatting to italicized. The notes invariably end in a carriage-return: ¶.
If it was just a text document, not MS-Word, I would just use a regex in a code editor like sublime to wrap it with <I>...</I> or something along those lines.
Preferably, is there a way to do this in Word's "advanced" find-and-replace feature? Or if not, what's the best way to do it in VBA?
I've tried using a search string like this in find-and-replace: NOTE: *[a-z0-9,. A-Z)(-]{1,255}^l but the line-break part doesn't seem to work, and the 255 char max isn't enough for many of the paragraphs.
EDIT: Another slightly important detail: The doc is automatically generated from another piece of software as a .RTF, which I promptly converted to .docx.
Attempt #2: Use Notepad++ to find and replace using regex. Remove quotes.
Find: "( NOTE: .*?)\r"
Replace with: " \i \1 \i0 \r "
//OLD
Sure is. No VBA or fancy tricks needed.
CTRL + H to bring up the replace dialog.
Click "More".
Select "Font" in the drop down menu called "Format".
Click italics.
Enter find and replace text as the same thing. Make sure you set this up right so that you don't accidentally replace substrings (e.g. goal to replace all " test " with " nice ", testing -> niceing).
Should work. If you need to alter entire paragraphs, consistently, then you probably should have used the styles on those paragraphs to begin with. That way, you can change all of them at once by updating the style itself.
You can use Advance Find, yes. Find Next and then Replace makes the selection Italic.
Is there a way on IntelliJ to remove surrounding parenthesis, brackets, quotes, etc? For example, if I have:
"string"
Is there any way to remove the matching quotes and get this?
string
Not directly, but the following replace expression (ctrl+R, tick Regex) might help:
Search for: "(.*)"
replace with: $1
Edit: I found an easier way (plugin code with regex left below for nostalgia)
Webstorm has extend selection and shrink selection
on mac they are bound to alt-upArrow and alt-downArrow
You can use extend selection to select the content and the quotes/braces/parens, then record a macro (i called mine unwrap) and perform the following actions:
shrink selection once
copy
extend selection once
paste
then you can save the macro and add a key binding.
Any time you want to unwrap something, you can just extend the selection until it includes the outer braces, then hit your hotkey and it will replace the selection including the braces with their inner contents.
I made a mini-plugin,
which i install/code using live-plugin.
It relies on this Regex:
[\["'({](.+)['"})\]]
The Regex will also often work in the Search/Replace function in webstorm
(with Regex and In Selection checked), but it fails in mysterious cases:
eg. single quotes that are inside parens - even if the outer parens are not in the selection to be considered
IDEA have an action to go to matching brace.
You can create macro with something like: goto next brace - delete one char - goto prev brace - delete one more char.
And then set kb shortcut to this macro.
Splice Sexp, which is Alt+S on Mac.
I was programming in PHP and typing mysql_connect, and by default the single-quotation is automatically closed, so I would have something like this mysql_connect('localhost[cursor is here]'). I still need to type my username and password, it just seems really out of the way to press the right arrow key to escape the single-quotations for writing the other arguments (username/password). Is there a hot key similar to ctrl+enter that can help move my cursor out of the quotations but not to the next line?
I often use Cmd-Right Arrow to move the the end of the line. I also make heavy use of Opt-Right Arrow and Opt-Left Arrow to move words at a time instead of characters.
My solution to this was to record my own macro; it moves the caret to the right, inserts a comma and then a space. I've mapped the macro to command and < (shift and comma). Activating the macro on your code results in:
mysql_connect('localhost', [cursor is here])