Tab is not indenting selected text - linux

I want to select multiple lines of code and indent them with [TAB] but this is not working.
The opposite of it, to shift it to the left side with [Ctrl]+[TAB] works.
The problem occurs in IntelliJ IDEA 14.01 but not in other programs ("Gedit" for example).
It is no problem to indent a single line of code by placing the cursor at the beginning of the line.
I'm working in a CentOS 6.2 VM (VirtualBox) on a Windows 7 machine.

I found out, that the "VIM Emulator" is causing those effects.
Tools --> Vim Elmuator (toggle on/off) OR Ctrl+Alt+V

As #Sailcomp pointed out the IdeaVim plugin is what causes the problem.
However if you take a look at Vim's wiki it explains how to indent/unindent using >> and << respectively. Along with the . command to repeat.

Related

Vim Visual Mode Is Behaving Strangely In cygwin

I have recently started my first job in a windows shop in over a decade, so have set up cygwin so I can continue using tmux + vim, as I have become accustomed to over the years. Everything is working great so far, except that in vim, my visual mode is deleting the character after the selection if I highlight something and then hit d.
For example:
If the line is:
Plug 'tpope/vim-sensible'
I press v to get into visual mode and then select the text between the two single quotes (represented by brackets):
Plug '[tpope/vim-sensible]'
And then I hit d to delete. The expected result is:
Plug ''
But what I get is:
Plug '
If I highlight the beginning single quote as well:
Plug ['tpope/vim-sensible]'
Then when I delete the expected result is:
Plug '
But what I actually get is:
Plug
Does anybody know what might be going on to cause this? My .vimrc is identical to my linux machines, none of which have this problem.
As Matt pointed out above, this can be fixed by changing cursor shape to "block" in the Options->Looks->Cursor section of the cygwin terminal app.

Neovim: How do I set guicursor to make the cursor blink?

The cursor blinking is off by default in Neovim and I want it back. I have tried to apply different arguments to guicursor, but didn't succeed. Since I want it to blink the same way in every mode, I think, I need something with the letter 'a' in it.
Here's what I have tried so far:
:set guicursor=a:blinkwait700-blinkon400-blinkoff250 (I also tried with 'i')
:set guicursor=a:blinkon100 (as the opposite of a:blinkon0 which switches it off)
I've already looked into the help but it didn't help me unfortunately.
Update:
What is peculiar is that :set guicursor=a:blinkon100 enables the blinking in gVim, but not in Neovim.
From neovim 0.2 onwards, setting guicursor does achieve the desired effect:
" Enable blinking together with different cursor shapes for insert/command mode, and cursor highlighting:
set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
\,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
\,sm:block-blinkwait175-blinkoff150-blinkon175
Find more by typing :help 'guicursor' from inside nvim.
For more info, see the official wiki
Finally, if you use st, you can patch it to get this working:
https://st.suckless.org/patches/blinking_cursor/
EDIT: I noticed from the comments of the first answer that OP was talking about nvim-qt, for those interested in that, a fix for it has been merged at the beginning of this year.
If you are using the st terminal by Suckless then that does not support cursor blinking I belive, otherwise if your terminal does support it try setting the option let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1 in your init.vim file. You could also pass that on the command line such as NVIM_TUI_ENABLE_CURSOR_SHAPE=1 nvim.

Vim line completion has stopped working

In Vim, a very useful keyboard shortcut is ctrlxctrll (that's a lowercase L) which will complete the entire line you're typing based on lines in all open buffers. My linewise completion has stopped working.
When I type (in insert mode) ctrlx it correctly shows me ^X Mode (...^L) in my status line, but when I hit ctrll Vim just beeps at me and outputs nothing.
I have 54 plugins and update my .vimrc often. How can I debug this shortcut? Is there a way to see what a double stroke motion is mapped to?
Turns out this was because I was using the software Karabiner which ironically is designed to give you Vi mode in various parts of OSX. The specific setting I had enabled was ctrl-hjkl in any inputs would map to up/down/left/right. I discovered this by running vim -u NONE to run Vim without plugins, and as it still presented the error, I realized the problem lied outside of Vim.

How to disable 'vi compatible' mode for Vim in Cygwin on Windows 8?

I am using Cygwin 1.7.22 (32-bit) on Windows 8 (64-bit). Within Cygwin, I am using Vim 7.3.1152, which is the default version.
Behavior that seem like bugs:
When I press I to enter insert mode, it does not say -- INSERT -- in the bottom left. In fact, it doesn't say anything. It does behave correctly, though.
When I delete letters using Backspace in insert mode, the letters do not disappear but the cursor does move to the left.
When I use the arrow keys in insert mode, it enters the letters A, B, C, and D, rather than moving the cursor. The arrow keys work normally outside of insert mode.
How do I make Vim behave as I expect?
Create a ~/.vimrc file with the following contents to put vim in nocompatible mode (actually the mere presence of the file is sufficient.)
set nocompatible
The behavior you are seeing is how vi used to behave. These are not bugs.
Take a look at :h nocompatible
In vim compatible mode tries to emulate vi as closely as possible.
--insert-- is not part of vi so it not shown in compatible mode.
I believe vi did a lazy redraw of the screen and didn't update until you exited back to normal mode. Also backspace is only usable also only works on stuff that was entered in the current insert mode. Overall its not very user friendly.
The arrow keys are sent to vim as escape sequences (escape followed by a coupled of letters). Let ^[ be escape. ^[OA is up on my computer its probably something similar on yours. vim sees this as an escape (goes back to normal mode), and O (add a line above the current) and A which is the A you see entered onto your screen. This just means that vim in compatible mode does not interpret the escape characters properly. Most likely because vi did not interpret them (nor was it designed to use them).
set nocompatible fixes problems 1 and 3.
I think set backspace=indent,eol,start should fix problem 2.
This was asked months ago, but I am answering for future reference for anyone else who encounters this problem.
I was just bitten by this issue. All advice listed in this post, and in other posts on this forum (not to mention posts on other forums) does not work, at least for some of us. I finally figured out the real issue.
vim on cygwin, for whatever reason (at least this was the case for me) does not use the .vimrc you put in your directory. Let's say you copy the example one to your working directory, or copy some .vimrc from online. Or maybe you create a new one from scratch, and put all the settings the good people here and elsewhere recommend (set backspace = blahblah, set nocompatible, set this, set that). It doesn't work. Why? Because for whatever reason (at least in my case) vim isn't looking at the .vimrc you just created.
The solution is to FORCE vim to use a particular .vimrc, by passing in -u on the command line like so:
vim -u [/INSERT/PATH/TO/.vimrc]
For the love of all that is holy, DO NOT type square brackets or the words "/INSERT/PATH/TO/.vimrc" verbatim. Use your brain please.
Anyway, this solved my problems and I was able to use the default example .vimrc and get proper delete and backspace behavior while in insert mode, not to mention other goodies.
You might want to alias the vim command in your .bashrc like this:
alias vim='vim -u [/INSERT/PATH/TO/.vimrc]'
Regarding A,B,C,D for arrow keys in Vim, adding:
:set term=cons25
to ~/.vimrc worked like a charm.
source: http://vim.wikia.com/wiki/Fix_arrow_keys_that_display_A_B_C_D_on_remote_shell
Following different answers in this topic I found a simple solution.
$ vi --version | head
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 30 2020 21:54:08)
Included patches: 1-486
Modified by <cygwin#cygwin.com>
Compiled by <cygwin#cygwin.com>
$ vi --version | grep 'user vimrc'
user vimrc file: "$HOME/.virc"
2nd user vimrc file: "~/.vim/vimrc"
So I just created ~/.virc (not vimrc) and it works! The content of the file:
set nocompatible
Probably, if you already have this file you will add the above string in it. Or, as people say above, if you have an empty ~/.virc, nocompatible mode must be already in use (I didn't check it).
Apart of the question, line numbers (that I find very useful) may be shown in vi by adding:
set number

Fix hover "ri" in Janus, Vim setup?

I have installed Janus to improve my vim. All works fine, except for the Ri documentation, that opens on hovering a keyword. On my installation it shows the output of "ri --help" instead of the documentation of the keyword.
I have found a way to disable it, but I'd rather just fix it. I am using gvim on Ubuntu 11.10.
What is the name of the plugin or script that offers these tooltips?
Could it have anything to do with RVM being active?
The problem is a bug in the ruby.vim plugin. That triggers ri with a wrong argument.
There is a bug report for this.
Solving is easy: edit file .../ftplugin/ruby.vim and change line 194: the -f argument should not be simple, but either bs or ansi. I had success with bs.
Does any of these shortcuts (from ri's homepage) work, especially the last two?
,r opens the search/autocomplete window, and will use a horizontal split to display matching documentation
,R opens the search/autocomplete window, and will use a vertical split to display matching documentatoin
,K opens the search/autocomplete window and prefills it with the keyword under the cursor
K is automatically remapped to use ri.vim if the current buffer is a *.rb file

Resources