[IntelliJ IDEA][Android Studio] Autocomplete when using semi colon key - android-studio

Resharper has (or had) a feature allowing autocompletion to be triggered when pressing semi colon, so I don't have to press enter to autocomplete and then semi colon.
I can't find how to enable this feature in IntelliJ/Android Studio. Is there any way to do this?

IntelliJ has something similar, but it works for space, dot and semicolon (maybe other characters). Not sure if the behavior can be modified if you want IntelliJ to autocomplete only on semicolon. Here is how you enable it:
Go to Settings/Editor/General/Code Completion
Enable Insert selected variant by typing dot, space, etc.

Related

Vim: behaviour change of search function in visual mode

It used to be part of my Vim vocabulary... change to visual mode, place cursor to a search word, type * and all text between first and next search word would be highlighted. The highlighting can continue as long as you repeat pressing * and there is the next matching search word. Perfect set of commands to copy text, or simply as visual aid.
Coming back to Vim now after some time, this is not working on my configuration. What happens now is that only the letter under the cursor and all other such letters get highlighted.
I wonder if I have some conflict in my mappings or else? I use Vim v7.3. Anyone can help?
Vim does not have a visual mode command for *; this only works in normal mode. However, many people have a customization that supplies the super star visual variant, from Search for visually selected text - or a plugin like my SearchHighlighting plugin; its plugin page has links to many alternative plugins.
I guess you had something like that, too, but forgot about it. I also doubt that is was triggered by Ctrl + *; combinations of Ctrl and non-alphabetical letters mostly aren't available as unique mappings. The usual mapping is just *, overloading the original normal mode command for visual mode.
Vim 7.3 is from 2010 and very outdated. To become reacquainted with Vim (which I commend!), please choose a modern variant. It should be possible to install the latest version 8.1; if you can't find a proper package for your distribution (for Windows, check the binaries from either vim-win32-installer or tuxproject; on Linux, it's also not very difficult to compile it yourself (e.g. from the GitHub sources).

Backspace button removing only one previous character in Android Studio

Is it possible to modify the default functionality of the backspace button from the keybord for Android Studio? I would like the backspace key to always remove only one character (as it was in Eclipse). Currently clicking the backspace sometimes reverts me to the previous line, not removes the one previous character.
If I understood your question correctly here is what you have to do!
Open setting and search for "Smart keys" in the search bar, then replace backspace functionality like in the picture.

What's a common use case of "selection mode" in vim?

It's the first time i noticed about the selection mode in vim when i accidentally triggered it from visual-line mode by <c-g>.
Vim already has visual mode for text selection what's the use case of selection mode, can anyone give me a hint on this?
(note: i've checked the manual page which describes it as
a resemblance of MS Windows text selection
but i still cannot quite understand why do we need any mouse actions in vim)
Select-mode is commonly used in snippet plugins such as vim-snipmate. Mappings can be created that are unique to select-mode so as not to interfere with regular visual mode behaviour.
Here is an excerpt from Practical Vim by Drew Neil:
If you are happy to embrace the modal nature of Vim, then you should
find little use for Select mode, which holds the hand of users who
want to make Vim behave more like other text editors. I can think of
only one place where I consistently use Select mode: when using a
plugin that emulates TextMate's snippet functionality, Select mode
highlights the active placeholder.
As the documentation suggests, select mode is a bit different from visual mode. Here's the commands you can do in it:
Commands in Select mode:
- Printable characters, <NL> and <CR> cause the selection to be deleted, and
Vim enters Insert mode. The typed character is inserted.
- Non-printable movement commands, with the Shift key pressed, extend the
selection. 'keymodel' must include "startsel".
- Non-printable movement commands, with the Shift key NOT pressed, stop Select
mode. 'keymodel' must include "stopsel".
- ESC stops Select mode.
- CTRL-O switches to Visual mode for the duration of one command. *v_CTRL-O*
- CTRL-G switches to Visual mode.
Otherwise, typed characters are handled as in Visual mode.
When using an operator in Select mode, and the selection is linewise, the
selected lines are operated upon, but like in characterwise selection. For
example, when a whole line is deleted, it can later be pasted halfway a line.
You can see the docs here.
What they mean by "resembles MS Windows selection" is probably that you can extend the selection with Shift+Arrows, and also that any printable characters entered will substitute the selected text and enter insert mode.
Also, see this question/answer at the vi.SE.

vim supertab, toward a best way to insert a tab

I really like the supertab plugin. Reaching <C-x><C-p> is a bit too long and mapping it to tab gives me a better workflow. However, sometime I just want to insert a regular tab and for this I need to insert a space first, i.e. foo<Space><Tab>bar.
This pollute my sources with useless spaces before each tab char (this assuming I don't use expandtab).
I am wondering is there is a smarter way to use auto-completion ?
Going back to <C-x><C-p> which is much slower
Using another key mapping like
Using supertab with a wiser feature:
i. Automatically insert a <Tab> if I press a char that doesn't match any of the possible completions.
ii. Inserting a real tab with
???
Any ideas?
You can suppress the Supertab trigger and insert a literal tab by pressing <C-v><Tab>. (On Windows, that frequently is <C-q><Tab>.)
Supertab also provides a mapping for direct input, by default <C-Tab>; see :help supertab-mappingtabliteral. That default key combination probably only works in GVIM, though.
Just another try.
You can have a global substitute after editing work like:
:%s/ \t /\t/g

Resharper move line up down not working

I can't make it working, move line up or down doesn't work. When I reset keyboard for VS and applay scheme for Resharper it ask me for this :
and if I take first selection , then alt + up switch me between methods, if I use second selection then this combination does not effects.
Alt+Up is not a ReSharper shortcut to move a line. It most likely belongs to the Productivity Power Tools extension, that has a feature to move one or more (selected) lines.
Personally, I don't like this feature in PPT, since it will just move the line(s), regardless of their scope, causing compilation errors. I much rather use ReSharper's feature of moving blocks of code up or down, by pressing Ctrl + Shift + Alt + ↑/↓ or ←/→ - when on the beginning of the line, it will move the entire line or block of code, but can also be used to move entire methods, change the order of parameters, etc.
I ended up resetting my Resharper shortcuts. Then when prompted with the dialog, chose Use Visual Studio Commands for the Alt+Up & Alt+Down shortcut.
You could also set this manually in Tools > Options > Environment > Keyboard. Search for "MoveSelectedLines" and then assign Alt+Up/Down to the appropriate command.
On my machine with Resharper 2016.1 it makes a difference on what position the cursor is located:
cursor located from 1st to last character on the line: the shortcuts work as described by Igal Tabachnik
cursor located on white spaces before 1st characters of the line the shortcuts are ignored.
Regards
Bernhard

Resources