how to get CLion IdeaVIM ^O binding back to return from 'gd' goto def? - intellij-idea

I'm on a new installation of CLion with the IdeaVIM plugin working in Rust.
I successfully used the 'gd' goto definition motion and the ^O to return once.
I was then immediately prompted with something like "vim key usage detected - I selected "IDE keys ( or something IDE...)", incorrectly guessing what it wanted. And now 'gd' works but I can't return via ^O.
What sticky settings have I put in place to break 'gd' ^O?

you can update this key in vim settings. For that click the vim icon in the status bar -> Settings...

Related

Change Integrated Terminal title in vscode

We can open command prompt in vscode by using the Integrated Terminal feature in View menu.
We can even open multiple terminals as shown below:
Is there any way I can change the title of the terminal ?
1: cmd.exe will be build terminal
2: cmd.exe will be watch terminal
I have gone through the integrated terminal documentation but I didn't find a way to do that.
Press in windows Ctrl + Shift + P and after type: Terminal: Rename, there you can change the terminal name/title
In v1.61 there is the ability to set the terminal names using variables. See terminal custom titles in release notes.
Terminal names are traditonally the name of the process they're
associated with. Thus, it can be difficult to distinguish between
them.
We now support configuring both title and description to help with
this using variables described in terminal.integrated.tabs.title and
terminal.integrated.tabs.description settings.
The current default values are:
{
"terminal.integrated.tabs.title": "${process}",
"terminal.integrated.tabs.description": "${task}${separator}${local}${separator}${cwdFolder}"
}
Variables available are:
${cwd} - The terminal's current working directory
${cwdFolder} - The terminal's current working directory.
${workspaceFolder} - The workspace in which the terminal was launched.
${local} - Indicates a local terminal in a remote workspace.
${process} - The name of the terminal process.
${separator} - A conditional separator (" - ") that only shows when surrounded by variables with values or static text.
${sequence} - The name provided to xterm.js by the process.
${task} - Indicates this terminal is associated with a task.
It looks like the ${task} variable is what you are looking for.
Sometimes, plugins will remove default keyboard shortcut bindings.
Look for "terminal.rename" in keyboard shortcuts then edit the keyboard shortcut to your preferred shortcut.
To apply your shortcut, make sure your cursor is focus in edit part of the window before you key in. Not at the terminal part.
In v1.41 there is a new command which can be used like so:
{
"key": "ctrl+t",
"command": "workbench.action.terminal.renameWithArg",
"args": {
"name": "remote"
}
}
if you have some frequently used name, like "remote" or "build" that you use often.
With VSCode 1.63 (Nov. 2021), entering "<blank>" (ie., empty string) as name will restore the default name for that terminal.
See issue 134020
For instance:
If my setting is ${cwd}${separator}${process} and I name a terminal "foo".
How do I reset "foo" back to the value of ${cwd}${separator}${process}?
My suggestion was that if you attempted to submit a blank name that would automatically reset to the value of your setting.

Issue with Overriding Default Keybinding in Atom Text Editor

I'm attempting to modify my keybindings in Atom.
So far I've been successful in adding a custom new keybindings via the keymap.cson file. However, I've encountered a problem when attempting to override a default one.
I'm trying to replace the default Ctrl + Shift + S, which is bound to Save as by default, to perform the Save all command instead. Of course, merely adding didn't work, so after a while I figured out I should unset! the key combination first. Now it looked way more promissing in the Key Binding Resolver.
This keymap produced following output in the Key Binding Resolver:
'body':
'unset!': 'core:save-as'
'ctrl-shift-S': 'core:save-all' # Key Binding Resolver claims this works fine
# but it doesn't do anything
'ctrl-shift-E': 'editor-stats:toggle' # works fine
'atom-text-editor':
'ctrl-shift-A': 'bracket-matcher:select-inside-brackets' # works fine
Despite that, however, the key binding Ctrl + Shift + S doesn't save anything at all. Accessing the command from the context menu works fine. I've searched the web, the core:save-all command seems to exist, it even has a default keybinding on Mac.
I am using the latest version of Atom on Windows 10, made sure no package conflicts with the keybind.
I'm really confused about this.
You can find commands by using the command palette.
Mac: CmdShiftP
Windows/Linux: CtrlShiftP
Looking for "save all" there, the only match for me is
Window: Save All
Ignore whatever key binding it may show next to it. What is important is the command name, "Window: Save All". You can convert that to a command selector with these steps:
Lowercase everything
Remove the space after :
Replace other spaces with -
This yields your selector: window:save-all.
So your key binding should be:
'ctrl-shift-s': 'window:save-all'
As the command's name suggests, this will save all tabs in all panes in the current window. It should not affect anything in other Atom windows.

IntelliJ Producs go to last opening bracket when pressing Alt + Gr + 8 ([)

I have IntelliJ Idea 15 IU-143.381 and Webstorm WS-143.381
Given you have the following code:
int[] i = new int[3];
at some point (fixed after restart but coming again quite quickly....) I cannot do this simple thing, because I am on a German layout keyboard. For inserting a [ does not work any more.
I need to press Alt Gr + 8 to type a [.
This results into jumping to the last opening }
for example. I have typed this:
public void foo(){
int
On pressing the [ the cursor moves from after int in the second row to the position after foo(){. This is continued till you are up in the class's opening brackets [in Java]. I have tried it in Webstorm with JS and there it is the same. Anyone has an idea how to fix this?
I am on Windows 10 64-bit, German UI and keyboard layout.
Reset IntelliJ/Webstorm/another Jetbrains product's settings by deleting the user preferences folder (for exemple C:\Users\[user]\.IdeaC-[version] in Windows), then when you are told about "smart keyboard shortcuts", then just ignore it and it will never reappear again.
Just remember that this will reset your other preferences too.
I had the same issue with Android Studio 2.0, which is based on IntelliJ. I'm using a Swiss German keyboard layout, on which in have to press Alt GrĂ¼ to write a bracket [, and Alt Gr! for a ] respectively.
For some reason this matches the keyboard shortcut for "Move Caret to Code Block Start", which was registered as Ctrl[. Same for "Move Caret to Code Block End" with Ctrl]. Looks like IntelliJ cannot handle this correctly.
To fix the issue, I simply removed those shortcuts in File > Settings > Keymap.

How to auto-indent code in the Atom editor?

How do you auto-indent your code in the Atom editor? In other editors you can usually select some code and auto-indent it.
Is there a keyboard shortcut as well?
I found the option in the menu, under Edit > Lines > Auto Indent. It doesn't seem to have a default keymap bound.
You could try to add a key mapping (Atom > Open Your Keymap [on Windows: File > Settings > Keybindings > "your keymap file"]) like this one:
'atom-text-editor':
'cmd-alt-l': 'editor:auto-indent'
It worked for me :)
For Windows:
'atom-text-editor':
'ctrl-alt-l': 'editor:auto-indent'
The accepted answer works, but you have to do a "Select All" first -- every time -- and I'm way too lazy for that.
And it turns out, it's not super trivial -- I figured I'd post this here in an attempt to save like-minded individuals the 30 minutes it takes to track all this down. -- Also note: this approach restores the original selection when it's done (and it happens so fast, you don't even notice the selection was ever changed).
1.) First, add a custom command to your init script (File->Open Your Init Script, then paste this at the bottom):
atom.commands.add 'atom-text-editor', 'custom:reformat', ->
editor = atom.workspace.getActiveTextEditor();
oldRanges = editor.getSelectedBufferRanges();
editor.selectAll();
atom.commands.dispatch(atom.views.getView(editor), 'editor:auto-indent')
editor.setSelectedBufferRanges(oldRanges);
2.) Bind "custom:reformat" to a key (File->Open Your Keymap, then paste this at the bottom):
'atom-text-editor':
'ctrl-alt-d': 'custom:reformat'
3.) Restart Atom (the init.coffee script only runs when atom is first launched).
Package auto-indent exists to apply auto-indent to entire file with this shortcuts :
ctrl+shift+i
or
cmd+shift+i
Package url : https://atom.io/packages/auto-indent
I prefer using atom-beautify, CTRL+ALT+B (in linux, may be in windows also) handles better al kind of formats and it is also customizable per file format.
more details here: https://atom.io/packages/atom-beautify
You can just quickly open up the command palette and do it there
Cmd + Shift + p and search for Editor: Auto Indent:
This works for me:
'atom-workspace atom-text-editor':
'ctrl-alt-a': 'editor:auto-indent'
You have to select all with ctrl-a first.
This is the best help that I found:
https://atom.io/packages/atom-beautify
This package can be installed in Atom and then CTRL+ALT+B solve the problem.
On Linux
(tested in Ununtu KDE)
There is the option in the menu, under Edit > Lines > Auto Indent or press Cmd + Shift + p, search for Editor: Auto Indent by entering just "ai"
Note: In KDE ctrl-alt-l is already globally set for "lock screen" so better use ctrl-alt-i instead.
You can add a key mapping in Atom:
Cmd + Shift + p, search for "Settings View: Show Keybindings"
click on "your keymap file"
Add a section there like this one:
'atom-text-editor':
'ctrl-alt-i': 'editor:auto-indent'
If the indention is not working, it can be a reason, that the file-ending is not recognized by Atom. Add the support for your language then, for example for "Lua" install the package "language-lua".
If a File is not recognized for your language:
open the ~/.atom/config.cson file (by CTRL+SHIFT+p: type ``open config'')
add/edit a customFileTypes section under core for example like the following:
core:
customFileTypes:
"source.lua": [
"conf"
]
"text.html.php": [
"thtml"
]
(You find the languages scope names ("source.lua", "text.html.php"...) in the language package settings see here)
If you have troubles with hotkeys, try to open Key Binding Resolver Window with Cmd + .. It will show you keys you're pressing in the realtime.
For example, Cmd + Shift + ' is actually Cmd + "
You could also try to add a key mapping witch auto select all the code in file and indent it:
'atom-text-editor':
'ctrl-alt-l': 'auto-indent:apply'
I was working on some groovy code, which doesn't auto-format on save. What I did was right-click on the code pane, then chose ESLint Fix. That fixed my indents.
If you are used to the Eclipse IDE or the Netbeans, you can use the package eclipse-keybindings (https://atom.io/packages/eclipse-keybindings):
This Atom package provides Eclipse IDE key mappings for Atom. Currently, the Eclipse shortcuts are directly mapped to existing Atom commands.
To format all lines from a file, just use: Ctrl+Shift+F.
Ctrl+Shift+i worked for me in PHP under Windows ... but some files did not react. Not being the brightest it took me a while to work out that it was the include files that were the problem. If you are using echo(' ... PHP ...') then the PHP does not get re-formatted. To get over this, create a temporary PHP file, say t.php, copy the PHP part into that, reindent it (Ctrl+Shift+i ... did I mention that?) and then copy the newly reformatted PHP back into the original file. Whilst this is a pain, it does give you correctly formatted PHP.

How do I get Vim's project plugin to load the in.vim on external buffer change?

I'm using the project plugin in Vim. For each project I'm working on, I have set up an own in.vim/out.vim where the project-specific stuff gets set.
For example, I set a shiftwidth of 2 in the in.vim, whereas in my .vimrc, I set it to 4. When I'm opening a file from the project tree, everything is fine: the sw is 2. Now, I compile the sources (Visual Studio) and get some compiler errors/warnings. Switch to Visual Studio, fix the errors, back to Vim then.
My editor did realize that I changed the file outside the editor and asks me to reload the file. After confirming the reload, the sw is set to 4.
Obviously, this is because the .vimrc is getting read on buffer reload and overwrites my setting of the shiftwidth stored in the in.vim configuration file.
My question is: is there any way to bring the project plugin (or vim itself) to load the in.vim upon buffer refresh?
Solution
The answer of ZyX pointed me to a handling that works for me:
In the in.vim, set a global variable to the path of in.vim:
let g:invimpath = "D:/project/vimstuff/in.vim"
In the .vimrc, try to load this specified file when FileChangedShellPost occurs:
autocmd FileChangedShellPost * if exists("g:invimpath") | exe 'source ' . g:invimpath | endif
Credits go to ZyX to point me to this path.
Yes, it is, with FileChangedShellPost autocommand, but I suggest you first add the following just before the beginning of your vimrc (but after scriptencoding statement, if it is present):
if exists("s:vimrc_loaded")
finish
endif
let s:vimrc_loaded=1