Questions tagged [cursor]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
37 views

Why does the cursor end up on the wrong line when <Esc><Esc> is mapped to something?

In vim --clean, I insert these lines: One Two Three Four Five Six Then I do: :set mouse=a :nnoremap <Esc><Esc> <Nop> (From my observations, the mapping could be to anything. :...
0
votes
2answers
33 views

cursor position past EOL

Given the following setup edit a long line short move the cursor to line 1, column 9 (> 6 anyway) move down and up again I see that when moving to the short line, the column becomes at most 6 (...
4
votes
1answer
179 views

How to move cursor to previous line automatically?

On nano&emacs&any other text editor, when the cursor is at the 1st character of a line (not the 1st line), press the left key and it will automatically jump to the last character of previous ...
0
votes
1answer
21 views

how to make the scrollwheel work in the window created by `vert term`?

OS version: uname -a Linux mydebian 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux vim verson: vim --version VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 15 2019 16:41:15) ...
0
votes
1answer
52 views

How do I make the cursor blink?

set guicursor=n:blinkwait5-blinkon5-blinkoff5 has no effect. Why is that? mp4
0
votes
1answer
86 views

Can Vim remember cursor position as well as lines displayed?

I would like Vim to remember both the cursor position and the lines displayed, for example, in the screenshot line 26 to line 46 are shown, and cursor is at line 44. If I exit as it is now, is it ...
1
vote
1answer
73 views

place cursor after bracket }

I am a bit new to Vim. I would like to know how to place my cursor after the bracket } If I use l or$, it places my cursor on the bracket. When I go into insert mode by typing i, I am inserting text ...
0
votes
0answers
43 views

How can I prevent the cursor from blinking in Elvis in Xterm?

The cursor of vi (elvis) keep blinking under on a Raspberry Pi with the Rasbian distribution. It occurs with Xterm, not the xfce-terminal. On the computer or via ssh session. With the same setup (....
1
vote
2answers
106 views

Jump to (or get position of) any kind of parent brace

I am within a vimscript, and I want jump (or get the position of) the beginning of the current parent brace, how can I make this happen? Imagine the following example (the cursor is represented by |): ...
0
votes
2answers
38 views

How can I make a mapping to toggle cursorbind?

I know that adding a ! to the end of an option works for some commands, but it doesn't work for cursorbind. How can I toggle between cursorbind and nocursorbind with a keybinding?
0
votes
0answers
30 views

after compilation in Vim : cursor in gg

I'm french... sorry for my english I try to compile files (.tex, .md ... using vim). I open terminal and make the compilation ; just before the compilation i save the file and put a marker in the ...
2
votes
1answer
171 views

How do I change vim cursor color

I use vim version 8.0.707. My cursor blinks but make the character disappear half the time. I'd like it to behave as usual: display the negative color. How can I do that please? Thanks in advance :)
2
votes
1answer
476 views

How come the Vim cursor leaves one character at the end of the line?

It sounds like a bit of a silly question, but I couldn't find any answers. I've noticed that in the command mode, the Vim cursor doesn't go until the complete end of the line and stops at the last ...
1
vote
0answers
27 views

How can I keep my cursor normal after exiting a terminal buffer?

Right now, whenever I open a terminal with :term, my cursor changes from a half-height/orange cursor to a full-height/gray cursor (depending on the emulator). When I navigate back to another window, ...
4
votes
1answer
516 views

how can we put the cursor at mouse pointer

I can use the mouse to highlight, copy and paste text in VIM. So clearly VIM is aware of the mouse. As such it must be possible to get it to put the cursor where the mouse pointer is. Does anybody ...
0
votes
0answers
126 views

Change cursor shape in Vim PowerShell

I have looked through the web but I have found no answer to this. https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes The above website mentions ways to do it in terminals but not when ...
3
votes
1answer
167 views

How to keep cursor vertically aligned to center even at the end of buffer?

I would like to keep my cursor centered vertically as I type away in insert mode even when I reach the end of the buffer I am editing (at which point I would like the virtual lines starting with ~ to ...
2
votes
1answer
135 views

How can I make zz not center cursor when approaching end of file?

When I press zz at the end of file, the line is displayed at the center of screen by having many empty lines having empty lines beyond end of file is great, but this is too much. Is there a way to ...
1
vote
1answer
419 views

changing cursor to block in insert mode on Neovim

I am a new neovim user. I am currently on MacOS, and using iTerm as my terminal emulator. I am using Neovim 0.4.3. I would like to configure my neovim in such a way that the cursor in insert mode is ...
2
votes
2answers
222 views

How to use the same set of cursor shapes for bash vi mode and vim?

I want to use block cursor for normal mode, bar cursor for insert mode in both vim and bash vi mode, a minimal setting can look like this: vimrc -------- let &t_SI = "\e[5 q" let &t_EI = "\e[...
2
votes
2answers
76 views

Keep cursor from moving when using operators

I'm trying to implement a custom operator following :h :map-operator. The operator works just fine but has the side effect of moving the cursor position! For example the code defining the <F4> ...
2
votes
1answer
51 views

Put cursor at arbitrary line and column

Normal, insert, and visual modes restrict cursor movements to locations occupied by some characters. They don't allow moving to the right from the end of line and down beyond end of file. For example:...
3
votes
1answer
432 views

How to change vim cursor shape in text console?

I can change cursor shape in text console (TERM=linux or linux-16color) by this escape sequence, : echo -e '\e[?6;c' But I can't do it inside vim, below code should change cursor shape in insert ...
1
vote
1answer
22 views

How to test whether the cursor is at the end of a line in a mapping?

I would like to test in an operator-pending mapping whether the cursor is on the last position of the line. I currently have this, but it does not work: onoremap <expr> i$ col('.') == col('$') ?...
3
votes
1answer
379 views

Neovim does not restore terminal cursor on exit

The cursor of my gnome-terminal is an underline _. I am using Neovim and I want the cursor in Command Mode to be: block | set guicursor=n:block-Cursor When I exit from Neovim I want the cursor back ...
1
vote
1answer
55 views

Is there any way to position the cursor in a :substitute replace pattern?

I have the following line: return err And would like to replace that to: return fmt.Errorf(": %w", \1) Which is done easily with something like: :s/return \v(\k+)/return fmt.Errorf(": %w", \1)/ ...
2
votes
1answer
43 views

Why does iabbrev end at second character, even after using 0 at the end of command chain?

This behaviour seems a bit strange (^ is the cursor): inoreabbrev @@t <esc>0 what@@t what ^ But: inoreabbrev @@t <esc>0h what@@t what ^ Why using 0 is not enough to put the cursor ...
2
votes
1answer
281 views

How can I highlight the current cursor position (not just the line)?

When I search a text file for a word from within vim, it will highlight all matches for the word by changing their background color -- to olive green on my terminal; your color may vary. I am looking ...
1
vote
2answers
127 views

Locate cursor on the screen

I have a big monitor and sometimes it can be difficult to locate the small blinking underscore that is the cursor. Is there a way to temporarily make the cursor more prominent and visible? Note, I ...
2
votes
1answer
275 views

Change cursor position in another window

Is there a function like setpos that lets change the cursor position in a different window (split), given the window number? Or, even better, is there a command to execute a command in specific ...
0
votes
1answer
50 views

VimScript - Save specific positions consistently even after buffer changes

I want to save multiple positions in vimscript, and make sure that they stay at the right place, even after the buffer changes Here are the solutions I found so far, and why I want something else: ...
2
votes
1answer
45 views

What is the purpose of the short cursor in command mode?

If I'm in command mode with default vim and I press the right angle key, the cursor switches from the normal block to a short version. What is the function of this? (Sometimes it seems related to ...
0
votes
0answers
125 views

Positioning the terminal emulator cursor in Neovim

When in Normal mode in a Terminal buffer (as in :terminal) there's the Neovim's cursor and the shell's cursor. Going into Terminal-mode forgets your Neovim cursor and you're then using the shell's ...
2
votes
1answer
264 views

Yank then Paste without moving cursor

I want to be able to: :42y then something like: :13p having it to paste the yanked line in a new line after 13, without taking my cursor away. So far, all solutions I have found involves going to ...
1
vote
0answers
55 views

cursor position jumps to first non-blank character of line unpredictably [closed]

I'm using SpaceVim with Neovim, and often times I'd experience this cursor jumping issue (as if ^ has been pressed in normal mode) while using it. I doubt the bug is on the Neovim end, otherwise a lot ...
1
vote
2answers
2k views

Enable cursor blink in all modes for terminal Vim

I am relatively new to vim and tried to understand this article and also read :help guicursor and inserted this line in my .vimrc set guicursor+=a:-blinkwait175-blinkoff150-blinkon175 But it didn't do ...
1
vote
2answers
65 views

Move cursor and screen together

I am implementing a smooth scrolling function for <C-u> and <C-d>, which just sleeps for a few milliseconds and then moves the screen up (<C-y>) or down (<C-e>) one line: ...
2
votes
2answers
57 views

Fix indentation in a file while keeping cursor on the same line

I'd like to use vim's builtin indent fix feature on an entire file. I have looked up answers, but all I found were suggestions to type gg=G, the only problem being that it brings your cursor to the ...
0
votes
1answer
111 views

How can I keep the cursor position when piping the buffer through an external command?

I sometimes make shortcuts for myself, which run some external command on the current buffer, such as nnoremap <C-f> :%!clang-format -style=file<C-m> which formats the buffer with clang'...
5
votes
1answer
156 views

Cursor Column in Visual Selection

What is the correct way get the column of the cursor after a visual selection was made? As a simple example, consider the following command. It takes a range and I am trying to obtain the column to ...
4
votes
2answers
822 views

Regex pattern matching cursor-position

Considering the following regex pattern: /\s*<<.\{-}>>/ I want to match those patterns only when the cursor is somewhere on this pattern. So, if have the line (the character enclosed in ...
0
votes
1answer
58 views

How to have the cursor at the right indentation when editing PHP/HTML

When I'm working with HTML in a PHP file and I press enter while in INSERT mode, my cursor goes to the start of the next line instead of going at the right positive therefore I have to press tab to ...
0
votes
0answers
64 views

My cursor is changed after “df” [duplicate]

I have the following to change my cursor from a block into an underline: set guicursor=a:hor20-Cursor Whenever I run df to delete a range, my cursor is changed back to a block. I have to source my ...
1
vote
1answer
196 views

VimEnter autocmd to change cursor shape sometimes outputs escape sequences

Inspired by this answer, I have the following in my vimrc: augroup cursor au! autocmd VimEnter * silent !echo -ne "\e[1 q" augroup end However, this sometimes prints the following on startup:...
2
votes
0answers
254 views

How do I make vim's terminal use my emulator's cursor shape?

I am using ibeam a.k.a vertical bar cursor right now. When I switch to terminal mode in vim, it changes the cursor shape to block - but doesn't restore it after I quit the terminal. I tried changing ...
0
votes
1answer
44 views

Fast moving with long lines when using set wrap

Suppose I have a wrapped line like this with the cursor positioned just before the AND (&). Is there an option to move the cursor just before the OR (|) pressing the <Down> key ? This ...
2
votes
2answers
115 views

creating a “:KeepCursor” command

I'd like to make a command that works like this: :KeepCursor {cmd} will the given execute ex command string, then restore the cursor's position. A primary example is: :KeepCursor normal! * which ...
3
votes
0answers
143 views

Cursor position after pasting

I believe the default behaviour in vi(m) for pasting (p) or (P) was to leave the cursor at the current position as before pasting, and in order to paste a register and have the cursor be at the end of ...
0
votes
2answers
82 views

Determine if the cursor is on the first/last character of word

How to determine if the cursor is placed on the last character of the word under the cursor? I can get information about the word under cursor like determining if the length of the word under the ...
0
votes
1answer
70 views

Cursor jumps 1 or 2 columns to the right after line up / down ( j / k )

Somehow my cursor jumps to the right in some filetypes (html, vue, json, maybe others...) when I switch lines with j or k My .vimrc is kinda messy atm...but I've seen worse... :) " Basics {{{ syntax ...