Vertical Vim Cursor in Command Mode

Vertical vim cursor in command mode

I think you're looking for set virtualedit=onemore.

From :help 'virtualedit':

A comma separated list of these words:
block Allow virtual editing in Visual block mode.
insert Allow virtual editing in Insert mode.
all Allow virtual editing in all modes.
onemore Allow the cursor to move just past the end of the line

[...]

"onemore" is not the same, it will only allow moving the cursor just
after the last character of the line. This makes some commands more
consistent. Previously the cursor was always past the end of the line
if the line was empty. But it is far from Vi compatible. It may also
break some plugins or Vim scripts. For example because l can move
the cursor after the last character. Use with care!

I've never noticed any problems myself, so it seems reasonably safe in spite of the warning.

Vim - change cursor in command line

In Vim 8.2.0258 or newer, the echoraw() function can be used

autocmd CmdlineEnter * call echoraw(&t_SI)
autocmd CmdlineLeave * call echoraw(&t_EI)

Setting the cursor to a vertical thin line in vim

This did the trick:

set guicursor=i:ver25-iCursor

I had to reduce the 100 to 25

How to change the cursor between Normal and Insert modes in Vim?

A popular approach to indicate switching to and from Insert mode is
toggling the cursorline option, which is responsible for whether
the current screen line is highlighted (see :help cursorline):

:autocmd InsertEnter,InsertLeave * set cul!

or, alternatively:

:autocmd InsertEnter * set cul
:autocmd InsertLeave * set nocul

Modify the CursorLine highlighting group to change the styling
of the cursor line to your liking (see :help :highlight and
:help highlight-groups).

Vim: How to open new vertical split for file under cursor

From normal mode, you could type C-w f C-w L or C-w v gf, and from the command-line you could execute :wincmd f | wincmd L or :vert wincmd f.

They are not strictly equivalent, though.

With C-w f C-w L and :wincmd f | wincmd L, the height of your vertical viewport will be maximized no matter the current layout. So, for example, if you have a horizontal viewport below, its width should be decreased:

        +-----------------+     +--------+-------+
| path/to/fileC | | | |
| | → | | |
| fileA | | fileA | fileC |
+-----------------+ +--------+ |
| | | | |
| fileB | | fileB | |
+-----------------+ +--------+-------+

With C-w v gf and :vert wincmd f, the height of your vertical viewport should be the same as the current one, and thus it shouldn't affect the horizontal viewport below:

        +-----------------+     +--------+-------+
| path/to/fileC | | | |
| | → | | |
| fileA | | fileA | fileC |
+-----------------+ +--------+-------+
| | | |
| fileB | | fileB |
+-----------------+ +----------------+

How to set my Nvim cursor as a vertical line in insert mode?

It can be modified through guicursor. The default value(n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20) should be fine.

How to paste before the cursor after selecting a vertical block?

I assume you mean using I in visual block mode to insert the same text on multiple lines, where hitting p simply pastes on the current line rather than all the selected lines.

In insert mode, you can hit C-r followed by a register to insert the contents of that register, so if you wanted to paste the unnamed buffer, you'd enter

C-r"

Similarly, to paste from the clipboard

C-r* 

By entering insert as you normally would, then using C-r, you'll get the text on all of the selected lines.

Take a look at :h registers to see what registers are available to you.

Is it possible to automatically make Vim vertically center the line when typing?

You can keep the cursor's line centered by setting the 'scrolloff' option to a large value:

set scrolloff=999

Description of 'scrolloff' from the help page:

Minimal number of screen lines to keep above and below the cursor.
This will make some context visible around where you are working. If
you set it to a very large value (999) the cursor line will always be
in the middle of the window (except at the start or end of the file or
when long lines wrap).

Vim: insert the same characters across multiple lines

  1. Move the cursor to the n in name.
  2. Enter visual block mode (Ctrlv).
  3. Press j three times (or 3j) to jump down by 3 lines; G (capital g) to jump to the last line
  4. Press I (capital i).
  5. Type in vendor_. Note: It will only update the screen in the first line - until Esc is pressed (6.), at which point all lines will be updated.
  6. Press Esc.

mini-screencast demonstrating the method

An uppercase I must be used rather than a lowercase i, because the lowercase i is interpreted as the start of a text object, which is rather useful on its own, e.g. for selecting inside a tag block (it):

mini-screencast showing the usefulness of the 'it' text object



Related Topics



Leave a reply



Submit