How to change letter case in RStudio editor? - rstudio

I just read Google's R Style Guide, and decide to be consist with the letter case in function names and variables. How to change letter case in RStudio's editor? To be specific, how to change words
to all lowercase
to all uppercase
to captilized case (capitalize the first letter)?

To Lower case you can use the keyboard shortcut Ctrl + Shift + U,
To Upper case you can use the keyboard shortcut Ctrl + U

According to Rstudio support:
There isn't one [i.e., a hotkey] right now. The functionality is available under the Vim keybindings, though--with the editor in Vim mode, pressing ~ will toggle the case of the character under the cursor (or of the current selection, etc.)
Further information on Vim mode is available at support.

Related

How to use level 3 neo characters "`" and "&" in VSCode on MacOS?

I want to program in VSCode using the Neo keyboard layout in MacOS.
Here are my Karabiner Elements Rules:
Neo2 mod 3 key and layer 4 (Apple keyboards)
Neo2 layer 6
Toggle caps_lock by pressing left_shift + right_shift at the same time
Change Command+Tab to Control+Tab
Change Control+Tab to Command+Tab
With this all level 3 combinations work in VSCode except "`" and "&". In other programs these two characters also appear normally.
How can I get VSCode to write ` and &?
The reason why the two characters do not work is that they are being overridden by VSCode's own keyboard shortcuts:
3rd layer + q (&): this is the shortcut for "Rewrap Comment / Text".
3rd layer + z (`): this is the shortcut for "toggleWordWrap".
The shortcuts prevent the Neo characters from appearing.
To solve the problem simply change the shortcuts for the two commands to not be identical with the 3rd layer characters.
You can find the problematic shortcuts simply by opening the GUI of the Keyboard Shortcuts and clicking on the keyboard and then press your 3rd level combination. Then you can choose new shortcuts or disable the shortcuts.

How to Zoom in /out in emacs -nw (command line only) whithout having a numeric keypad (also without mouse wheel)?

I am having trouble finding the shortcut for Zooming (increasing font size) / unZooming (decreasing font size) in emacs. I must add that I am interested in the command-line emacs (i.e. no window, i.e. "-nw" option) only, I don't use the graphical interface.
The Zoom-in command is supposed to be C-x C-+ and the Zoom-out C-x C--, also since I am using a laptop - often without mouse -, I am not interested by a "mouse-wheel up/down" option.
I tried C-x C-+ in two ways:
"typing Ctrl then 'x' then Ctrl then key '1' which is the key with the '+' symbol above the 1 on my qwertz keyboard"
"typing Ctrl then 'x' then Ctrl - WHILE HOLDING SHIFT" then key '1' which is the key with the '+' symbol above the 1 on my qwertz
keyboard"
neither seem to work, although the second would seem to make more sense, i.e. to hold shift as if to write the '+' sign that i can get with shift-'1'
So I wonder: is the shortcut C-x C-+ only intended for people equipped with a numeric keypad ? or is there another way and in any case what do you suggest ?
And no, this question (How do I bind C-= in emacs?) does not answer mine, in fact I don't even understand what it is about (question is totally unclear and unrelated to mine - as far as i understand)...
I am just asking how to Zoom/unZoom i.e. increase/decrease font size...
Since emacs is running within a terminal, you can't directly control the font as you would running as a GUI app. To zoom in and out, you need to use the method that your terminal application provides for changing the font size. This is often <ctrl>+ and <ctrl>-, but your terminal keybindings may be different.

Is there any way of using normal keyboard text selection with a terminal on MacOS?

For the last ~10 years I've been used to manipulating text with the alt/⇧/⌘ keys. For instance, alt+← to jump back a word instead, alt+⇧+← to select that word, ⌘+→ to jump to the end of line, etc.
I understand that terminals have different conventions and historically came first, but I'm used to these shortcuts, they work great and work everywhere else. Is there any way of getting the same controls for selecting and manipulating text in the terminal?
I have seen the following questions:
How to move the cursor word by word in the OS X Terminal
How do I clear/delete the current line in terminal?
But they only address moving the cursor, and not selection.
Depending on the macOS version - your default shell may be zsh.
Shortcuts options are ctrl + a/e to move to beginning/end of line and esc + W/B to move one word backward/forward
Other popular alternatives are -
a. bash - with the shortcuts listed in the answer by #Hossein Amiri
b. iterm2 - From - https://coderwall.com/p/a8uxma/zsh-iterm2-osx-shortcuts
Put this in your .zshrc
bindkey "[D" backward-word
bindkey "[C" forward-word
bindkey "^[a" beginning-of-line
bindkey "^[e" end-of-line
And set iterm preferences.
Moving the cursor:
Ctrl+A Go to the beginning of the line (Home)
Ctrl+E Go to the End of the line (End)
Hold the Option key option and click on the current line = Jump Backwards
Ctrl+P Previous command (Up arrow)
Ctrl+N Next command (Down arrow)
Hold the Option key option and click on a previous line = Jump upwards
Ctrl+F Forward one character
Ctrl+B Backward one character
Alt+B Back (left) one word or use Option+→
Alt+F Forward (right) one word or use Option+←
Ctrl+xx Toggle between the start of line and current cursor position
More information : https://ss64.com/osx/syntax-bashkeyboard.html
You can't, I've beed looking for long time. This is why people use iTerm they have more flexibility with keyboard only.
https://iterm2.com/features.html
Copy Mode
Use the keyboard to make and modify selections.

Shortcut to Uppercase Selected Text in Oracle SQL Developer

I would like to highlight some text in a SQL Developer worksheet and convert it to uppercase with some keyboard shortcut.
Is there any such shortcut in Oracle SQL Developer?
I am using version 4.1.2.
Under Tools->Preferences->Shortcut Keys you can find and/or define the shortcut key combination for the Convert Selection to Uppercase and Convert Selection to Lowercase commands. I have mine mapped to CTRL+U and CTRL+L respectively. There unfortunately does not appear to be a specific command for converting text to Initcap, so the To Upper/Lower/Initcap command is the way to go for that. However, be aware that the To Upper/Lower/Initcap command actually cycles between five format modes:
UPPERCASE
lowercase
Initcap
Lower Keywords, Upper Identifiers
Upper Keywords, Lower Identifiers
Some of these modes will change the behavior of the code formatter (default key sequence CTRL+F7), and the Tools->Preferences->Code Editor->Completion Insight->Change case as you type setting if you have it enabled.
in 4.2.0.17 highlight the word(s) then Alt + '
This is perhaps and old question, but I noticed that while on Mac, the keyboard shortcut for cycle is unbound.
I followed the above suggestions in
tools->preferences->shortcuts
and bound it myself to ctrl + ' but note that in 4.2 on Mac by default this is unbound.
This cycles through Upper/Lower/Initcap in my SQL Developer version 18.2.0.183 Build 183.1748.
ALT + '
Ctrl + ' changes case by default. You can find all shortcuts in:
tools->preferences->shortcuts
Found it! You can select text in your worksheet, then use Ctrl+Shift+" to switch between cases (in version 4.1.2).
It will cycle between the following cases:
Upper Case:
SELECT * FROM MYSCHEMA.EXAMPLE;
Lower Case:
select * from myschema.example;
Upper Keywords:
SELECT * FROM myschema.example;
Lower Keywords, Upper Identifiers:
select * from MYSCHEMA.EXAMPLE;
Upper Keywords, Lower Identifiers:
SELECT * FROM myschema.example;
Initial Cap:
Select * From Myschema.Example;
As mentioned by #PiotrSiekierski, you can change the keyboard shortcuts in Tools -> Preferences -> Shortcut Keys. In version 4.1.2, the Ctrl+' shortcut is mapped to 'Navigate Down' by default.
As mentioned by #Sentinel, if you are not interested in cycling through the different case options, you can assign a shortcut to 'Convert Selection to Uppercase' or 'Convert Selection to Lowercase' by going to Tools -> Preferences -> Shorcut Keys and searching for the desired functionality. You can then assign a shortcut to those commands, such as Ctrl+U or Ctrl+L. In version 4.1.2, the 'Convert Selection to Uppercase' and 'Convert Selection to Lowercase' commands have no shortcut mapping by default.
This cycles through Upper/Lower/Initcap.
CTRL + '
Use
Control + '
Everytime you press it, it toggles between camel case, lower case, and upper case. I hope this helped you.
My SQL dev is 18.4. It worked for me
In newest versions you can highlight the text and then go to: Tools >> PL/SQL Beautifier and this will format your query and uppercase the text!
Hope it helps.
In sql server selected text Convert in to upper case and lower case use this shortcut key
Upper Case : ctr + shift + U
Lower Case : ctr + shift + L

OS X Terminal: Meta key + alt functionality at the same time

Is there a way to use an alt / option key as a meta key but still be able to use it to make some characters which need it?
For example, in my local keyboard layout:
# is alt + 2
\ is alt + shift + 7
| is alt + 7
etc.
So, if I set alt as a meta key, I can't make those characters anymore. On the other hand, using "press esc, release esc, press a key" to make meta key sequences makes my hands hurt.
Any Emacs users with international keyboards who have solved this, please give any tips you might have! :)
Edit:
It appears that I can set alt as a meta key and then add these kind of settings in inputrc: "\e2": "#" This works in the bash shell but it still won't work with Emacs though, so no good.
I use a Swedish keyboard in Mac OS X and use the following setup for Emacs.app:
First I have KeyRemap4MacBook installed and I have it setup to change the left Option key to Command.
I then have the following in my .emacs:
(setq mac-option-modifier 'none)
(setq mac-command-modifier 'meta)
This makes Emacs treat command as Meta and ignore Option. Since the left Alt/Option key is remapped to command, this makes it work lite meta while the right Alt/Option key still works for entering special characters like # [] and {}.
App specific Mac shortcuts like Cmd+C and Cmd+V no longer work, but global shortcuts like Cmd+space for Spotlight and Cmd+Tab for app switching do.
Update:
If you use iTerm2 as a Terminal, that has support for mapping only the left Alt/Option key to meta, which means you can still use the right AltGr/Option key for entering special characters. This also means you can use meta as normal inside Emacs running in the iTerm2 terminal.
I have a Swedish keyboard on my Mac and I'm using Aquamacs. Adding the two lines (attribution goes to Joakim Hårsman)
(setq mac-option-modifier 'none)
(setq mac-command-modifier 'meta)
in .emacs (and restarting Aquamacs) did the trick for me.
with iTerm2 you can map the left option key to ESC/meta and leave the mapping of the right option key to "normal". This way you can use the right option key to type accents etc.
Think about using a full featured Emacs for Mac OS X. I use Carbon Emacs but I believe others (say Aqua Emacs or X11 Emacs) would do the trick.
If you insist on using Emacs in a terminal you can use the C-x 8 prefix as a compose key. Try C-x 8 C-h to get a list of possibilities.
See http://www.emacswiki.org/emacs/EmacsForMacOS
Two work-arounds I use:
I use xterm running under X11.app. X11.app uses the command key as meta.
When running emacs in Terminal.app, I just use the rfc1345 input-method, which allows me to enter all kinds of crazy non-ascii characters without needing an option key.
Check out cmd-key-happy. This little app has worked wonders for me. It allows you to use command as meta, with exceptions that you can configure.
Author's info follows:
This program allows you to swap the command and alt (or option) keys
in any application, but in particular Terminal.app.
http://github.com/aim-stuff/cmd-key-happy
This is an old post but adding an alternatives for Robots to find.
I borrowed a couple of files from Aquamacs(emulate-mac-keyboard-mode.el, aquamacs-tools.el) that fixes the problem (I have a Italian-Pro keyboard) :
(defun aq-binding (any)
nil)
(load "~/.emacs.d/emulate-mac-keyboard-mode.el") ;; 'noerror
this provides:
few minor modes (emulate-mac-italian-keyboard-mode,
emulate-mac-french-keyboard-mode,
mulate-mac-swiss-german-keyboard-mode, etc)
a menu to play with all the options provided by Aquamacs
Tested with Emacs-23.3-universal-10.6.6 and seems to work ok for me.
Thanks Aquamacs for this, what about pushing this upstream if not already done.
It's worth thinking about the assumption behind the question. I mean to say that the real problem is making the characters that currently seem to need the option key. This problem can be solved without achieving simultaneous 'meta key + alt functionality'.
Let me explain: I have a similar problem. On my UK keyboard, shift-3 is mapped to the pound sign, £, which means that I generally need to hit option-3 to get the very useful # - a real problem in Terminal, where I use option as meta. However, I find most of the above solutions to be a little over-the-top. I don't want to change to another version of Emacs (eg. Aquamacs), to switch to a different Terminal application (eg. iTerm or xterm), or to install a key-remapping application (eg. KeyRemap4MacBook) all for the sake of one symbol! Perhaps that would suit some people, but I thought it was worth pointing out that if the problem is just one character, it can be solved with a nine-character text file.
With regard to my personal version of this problem, I find the simplest solution is to create a file called .inputrc in my home directory, consisting of the following single line:
"§": "#"
This re-maps the (to me, quite useless) § that can be found to the left of the 1 on the current Mac keyboard to the (almost indispensable) #. That suits me even better than the default setup, because I can now get # with a single keypress. If there were any other characters I needed to remap, it would just be a matter of adding an extra line for each one.
Anyway, that deals with how to get the missing character in the shell, but if you also want it in Emacs (which you didn't say but is probably the case) then you can add something like this to your .emacs file (where 35 is the ASCII for the character I happen to want, ie. #):
(global-set-key (kbd "§") 'insert-hash)
(defun insert-hash ()
(interactive)
(insert 35))
It might not be such a neat solution if there were dozens of characters that I routinely wanted to access via the option key, but there aren't.
I hope this helps somebody. As a mere weekend hacker, I ordinarily wouldn't dare post an answer to a question on Stack Overflow...
Special keyboard layout with option deadkey
My solution to this problem is a special keyboard layout I have written, U.S. custom. It provides an option deadkey that produces option combos without having to use the physical ⌥ Option modifier key. For instance, the character ⟨ç⟩ is produced as follows on a normal U.S. keyboard layout:
Hit ⌥ Option+c.
The U.S. custom keyboard layout adds a second way of producing ⟨ç⟩:
Hit ⇧ Shift+§ (the option deadkey), then release it, then hit c.
This works even in Terminal.app when Use option as meta key has been checked.
Note that the U.S. custom keyboard layout does two additional things:
It converts plain § into a ⎄ Compose key (so you could also produce ⟨ç⟩ by hitting §, then ,, then c).
It replaces the CapsLock mapping by a (significantly extended) U.S. Extended keyboard layout.
Remap option deadkey to right option modifier key
If you have a physical ANSI keyboard, then you lack the § key. In that case, I recommend assigning the § key to some other key, for instance to the right ⌥ Option modifier key. Install KeyRemap4MacBook, open ~/Library/Application\ Support/KeyRemap4MacBook/private.xml and paste the following code:
<?xml version="1.0"?>
<root>
<item>
<name>Send ISO Section for right Option</name>
<identifier>private.send_iso_section_for_right_option</identifier>
<autogen>--KeyToKey-- KeyCode::OPTION_R, KeyCode::UK_SECTION</autogen>
</item>
<item>
<name>Send Shift+ISO Section for Shift+right Option (keep normal right Option without Shift)</name>
<identifier>private.send_shift_iso_section_for_shift_right_option</identifier>
<autogen>--KeyToKey-- KeyCode::OPTION_R, ModifierFlag::SHIFT_R, KeyCode::UK_SECTION, ModifierFlag::SHIFT_L</autogen>
<autogen>--KeyToKey-- KeyCode::OPTION_R, ModifierFlag::SHIFT_L, KeyCode::UK_SECTION, ModifierFlag::SHIFT_L</autogen>
</item>
</root>
Then, open the KeyRemap4MacBook preference pane, hit ReloadXML and then select “Send ISO Section for right option”. Now, your ⌥ Right Option key is remapped to §, so while the U.S. custom keyboard layout is active, hitting ⇧ Shift+⌥ Right Option will give you the option deadkey state (hitting ⌥ Right Option without additional modifiers will give you a deadkey state equivalent to the option modifier.
If want to keep ⌥ Right Option when ⇧ Shift is not pressed (instead of the ⎄ Compose key), then select “Send Shift+ISO Section for Shift+right Option (keep normal right Option without Shift)” in the KeyRemap4MacBook preference pane (instead of “Send ISO Section for right Option”). Like that, only ⇧ Shift+⌥ Right Option will produce the option deadkey, while plain ⌥ Right Option will continue to work as an option modifier. You can even continue using ⌥ Right Option+⇧ Shift modifier combos (for instance ⌥ Right Option+⇧ Shift+c→⟨Ç⟩) as long as you don’t hit ⇧ Shift first.
The above answers mention ways to enter non-ascii input, but that's not really the problem here. The C-x 8 method lets you enter a bunch of non-ascii, but the problem is that you need the option key on mac just to enter the (ascii) character `|' (vertical bar)!
So how do you then enter stuff like M-| (region to shell command) when running emacs in ssh under Terminal.app? No way for it but to use the escape key, since | is option-7 and Terminal.app for some stupid reason won't let you use Cmc as meta :-(
(If anyone knows of a hack (SIMBL perhaps?) that actually does let Terminal.app use Cmd as meta, I'd be very grateful...)
The following solution works, is UNOBTRUSIVE and you don't need iTerm2 or Aquamacs or whatever.
Step 1
Keep "Use option as meta key" turned ON in the Terminal.app Settings.
Step 2
Edit ~/.inputrc (make it if it doesn't exist already), add the following line:
"\e3": '#'
This will remap ⌥ alt + 3 so that you produce a # character as expected in the terminal, instead of it annoyingly coming back with the prompt (arg: 3).
Step 3
Edit ~/.emacs, add the following line:
(global-set-key (kbd "M-3") "#")
This will remap ⌥ alt + 3 so that you produce a # character as expected inside emacs, instead of it annoyingly doing nothing.
Caveat 1, This is just 1 re-map. So ⌥ alt + ? (other keys) won't be remapped, e.g. you may wish to remap ⌥ alt + n to produce the tilde key ~. Simply follow the same steps outlined above obviously switching 3 with whichever key you need going forward.
Caveat 2, When you ssh into another box, you will face the same difficulties, but all you have to do there is edit the ~/.inputrc and ~/.emacs files on that box.
Caveat 3, I'm British, on a British MacBook. So I can't vouch for foreign MacBooks.
Aquamacs supports that, at least for my (french) keyboard. Once Aquamacs is installed (via drag'n'drop), you can go to Options -> Option, Command, Meta keys and choose an appropriate setting for your keyboard (in my case, ...Meta & French). I am not proficient with Emacs, but all the useful combinations I have tried seem to work ([, {, |, and so forth).
Supported keyboards, according to the menu items as of version 2.1, are :
British
US
Swiss-french
Swiss-german
Finnish
Italian-Pro
Italian
Spanish
French
German
I would guess the Aquamacs team would be grateful for any contribution, though, should your keyboard not appear in the list.
I bit the grass and started hitting the escape key instead. You get use to it...
I would like to mod this question up or something because i also use a Swedish keyboard where i must press alt+7 or alt+shift+7 to make | and \ respectively.
I also use Irssi in Terminal.app and these don't mix well.
I'm a long time vim user though so emacs is not an issue to me.
Isn't there some way to remap CMD to be Meta in Terminal.app?
So far i've been surviving by simply typing /wg N in Irssi because having those characters in my Terminal is much more important than IRC.
A solution would be worth gold to me though! :)
This is years late, but for people coming across this page whilst searching for a solution, as I did, I have decided to build one myself, one that doesn't require abandoning Terminal.app in favour of iTerm 2.
It is a simple status bar app that runs in the background and rewrites all left-Alt + $KEY key events to two key events in rapid succession, Esc, then $KEY; however, it only does this if Terminal.app is the focused application.
You can find it here at https://github.com/habibalamin/Metalt.
I assigned escape to the caps lock key and it works quite good. You can configure it easily in the mac system preferences > keyboard > modifier keys.
https://apple.stackexchange.com/a/282092/236382

Resources