Questions tagged [cursor]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
29 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
46 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
170 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
23 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
344 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
46 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 ...
2
votes
1answer
55 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
124 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
0answers
109 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 ...
1
vote
2answers
97 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
63 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
48 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
132 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
21 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('$') ?...
2
votes
1answer
178 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
48 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
36 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 ...
1
vote
1answer
78 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
98 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
132 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
37 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
73 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
173 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
44 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
807 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
60 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
54 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
82 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
112 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 ...
3
votes
2answers
577 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
31 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
143 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
203 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
41 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
111 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
114 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
58 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
63 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 ...
4
votes
1answer
52 views

track deletion and insertion of lines

The marks in vim knows the deletion and insertion of lines before it and their positions will keep updated. Is there a way to achieve these pragmatically? I am running an async task which is ...
0
votes
1answer
297 views

How to determine character offset of cursor in buffer?

I am trying to use wordcount().cursor_chars to determine the character offset of the cursor in the buffer – but I am getting off-by-one errors. The docs for wordcount() say that cursor_chars is the "...
4
votes
1answer
471 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") ...
2
votes
0answers
334 views

Why gf is not working with variable?

If there is no variable in path, gf can open the file. Added sfname+={,} to .vimrc to support ${VARIABLE}. :!echo ${VAR}/test/file can correctly print full path with ${VAR} expanded. But if run 'gf' ...
3
votes
0answers
854 views

disable cursor blinking in terminal-vim

I thought this would be a 10 second google search, but no. I found a bazillion sources how to disable cursor blinking in GVim. But I would like to disable it in terminal vim. My terminal cursor is set ...
3
votes
1answer
210 views

Reclaim cursor shape in operator pending mode of neovim while using vim-surround

I'm somewhat ashamed to admit, the main reason I chose neovim over vim was it's native feature of changing cursor shape in different modes. For example, it uses vertical-bar in insert mode, block-...
10
votes
1answer
935 views

Is there a prepend insert mode?

I was trying to write a string with all chars from z to a and I thought this would be much easier if I could write backwards. The idea would be like an INSERT mode in which the cursor doesn't step ...
1
vote
1answer
496 views

neovim doesn't change cursor in st terminal

I have recently started using st. But nvim doesn't change cursor shape like that in gnome-terminal or xfce4-terminal in this terminal. What's more confusing is that it works fine in tmux inside st! I ...
1
vote
1answer
532 views

Delayed esc from insert mode caused by cursor-shape terminal sequence

I set a couple terminal options so that Vim changes the cursor shape to a vertical bar when I enter Insert mode, an underbar for Replace mode, and a block when I return to Normal mode: let &t_SI="...
1
vote
0answers
342 views

Normal highlight group changes cursor color in vim in xterm

I set the following highlight: :hi Normal ctermfg=250 ctermbg=235 The text is a nice light gray on dark gray, as intended. But the cursor has become dark blue. I'd love to have it just be the reverse ...