Questions tagged [cursor]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
24 views

Restoring cursor to position before delete after Undo

This question is asked multiple places but none have an answer that works for me. I've tried: '' `` g; g, ; , Ctrl+o In a file add: 123456789 Move your cursor over 7 in normal mode, type d4h, press u....
-1
votes
1answer
40 views

Problem setting cursor colors in vimrc: suppress the `-ne` that is written to my xterm on exit

Following the vim manual and also some threads on this site, I can set the color of my cursor to orange in insert mode and red otherwise, with the following lines in my .vimrc file. " use an ...
1
vote
1answer
77 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)/ ...
0
votes
2answers
36 views

How to move `n` number char <left> in vim command line?

My init.vim code autocmd FileType cpp nnoremap <F4> :RunWithFile ~/Downloads/ > output.txt && cat output.txt I want my cursor position to be exact 31 times <left> in command ...
1
vote
1answer
799 views

Tweaking the cursor in gVim

I'd like to change the appearance of my cursor to something similar to this picture: How can I have _ in the cursor, and how do I change the color of the cursor?
1
vote
1answer
104 views

How to disable scrollbind and cursorbind after using vimdiff?

I have this issue where I need to both compare files, which I do using vimdiff, but also work on individual files with vertically split screens (vs). However, after I call vimdiff on a file, opening ...
0
votes
0answers
36 views

Cursor disappearing

I'm using pywal and the wal colourscheme and since enabling it my cursor seems to have disappeared, meaning it has the same colour as my background (that's what I guess) and I only see it blinking ...
0
votes
0answers
34 views

Changing the block cursor color

I have been trying to play around with a few color scheme configurations for the cursor, however nothing I type in the command panel seems to change it. Is the hilight syntax supposed to be completely ...
1
vote
2answers
387 views

How do I make the cursor blink?

set guicursor=n:blinkwait5-blinkon5-blinkoff5 has no effect. Why is that? mp4
0
votes
1answer
60 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
1answer
42 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. :...
1
vote
1answer
1k 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 ...
6
votes
4answers
2k views

How can I get the character at the cursor position in a multibyte aware manner?

Consider the following line: € € This file is encoded in UTF-8 and between the two Euro marks is a Tab character (the Stack Exchange software expands this to spaces). The byte value is: e2 82 ac ...
0
votes
2answers
41 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 (...
0
votes
1answer
24 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) ...
4
votes
1answer
295 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
279 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
85 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
53 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
114 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
44 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?
1
vote
2answers
1k views

Gvim cursor jumps all over the place

I have a problem with my cursor in gVim, this happens in both Normal and insert(Whenever I type fast) modes. When I move my cursor it seems that the cursor goes to a random position for a very short ...
0
votes
0answers
33 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
548 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
780 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
31 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, ...
5
votes
1answer
877 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 ...
3
votes
1answer
343 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
140 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 ...
2
votes
2answers
337 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
112 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> ...
3
votes
1answer
835 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 ...
2
votes
1answer
56 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:...
5
votes
1answer
720 views

getpos(".") in visual mode equals getpos("v")

I use neovim 0.3.1 only. I define the following function and map to do a test for getpos in visual mode: function! show_position() echo getpos("'<") getpos("'>") getpos(".") getpos("v") ...
1
vote
1answer
23 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
648 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 ...
2
votes
1answer
46 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
419 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
177 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
365 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
63 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
46 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
156 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 ...
3
votes
2answers
486 views

How to restore cursor position after search and replace in autocmd

I'd like to delete all spaces on empty lines before saving files. I've figured out how to do that. autocmd BufWritePre * silent! %s/\v^\s+$//e But this moves my cursor to the line where the spaces ...
2
votes
1answer
349 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
2answers
75 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: ...
1
vote
0answers
64 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
3k 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
1answer
243 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
2answers
59 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 ...