Questions tagged [cursor]
Questions about the cursor, its shape its position
124
questions
1
vote
1
answer
42
views
How to skip a line when using visual block mode?
I want to add cursors to all lines except the third, is that achievable?
1
2
3 👈 skip this line
4
5
2
votes
1
answer
66
views
Wrong indentation in brackets
How can I change the automatic indentation inside brackets? Without any configuration, {vim,nvim} does the following:
test = [| # Press enter
test = [
| # Cursor ends up here, at the same ...
1
vote
1
answer
102
views
How do I disable the gui cursor in insert mode?
I am trying to disable the cursor (guicursor) while in insert mode in NeoVim
to emulate a typewriter style environment.
To that effect I set guicursor (default is
vim.opt.guicursor="n-v-c-sm:...
1
vote
2
answers
80
views
How to toggle the cursor position between the beginning and the end of the line?
In normal mode, I'd like to press a key that behaves like ^ (move the cursor to the first non-blank character of the current line), unless the cursor is already there, in which case it should behave ...
0
votes
1
answer
24
views
How do I get the first column of the current buffer after scrolling horizontally?
In the normal case, the first column is 1. But after a command like z10l to scroll rightward now the first column visible is 11 instead of 1. How do I get this 11?
My trying: I found that vim.fn....
0
votes
1
answer
88
views
What do the cursor options do? Like; cursorline, cursorcolumn, cursoropts
Background
I was looking to change the shape of my cursor, the thing that tells you where you are, like the i-beam on this site.
Instead I got these options which highlight text, I don't know the use ...
0
votes
0
answers
39
views
Is there a way to access the text currently being typed in insert mode?
From :help registers I know that the . register contains the last inserted text. However, thanks to the following autocmd, I have verified that it's content is actually updated after exiting insert ...
0
votes
1
answer
54
views
Permanent bottom margin
Is it possible to keep a permanent bottom margin in the editing area, so that the cursor never touches the very bottom of the screen?
So that when the cursor goes all the way down, I can still see a ...
0
votes
0
answers
73
views
Display lint info in vim ruler
I've installed the vim-flake8 plugin and it works correctly to lint Python in vim.
When I am on a particular line, I can use :call flake8#Flake8ShowError() and it will display the error in the vim ...
0
votes
0
answers
117
views
Vim for writing prose: cursor in insert mode with soft wrap
I'm new to this forum and use Vim to write prose. I'm trying to configure a desired behavior when soft-wraping text.
I only have three lines in my .vimrc
set nocompatible
set wrap
set linebreak
This ...
0
votes
1
answer
227
views
in normal mode, How to place the cursor at the end of the line just like how insert mode behaves?
Is there a way to set the cursor in normal mode to the end of the line?
for example, |abcdefg to abcdefg| not abcdef|g
Cursor moves one character backwards on exiting insert mode
https://stackoverflow....
2
votes
0
answers
219
views
How to configure cursor shape in visual, visual block modes?
I configure cursor shape in normal, insert, and replace modes with the following in my vimrc
let &t_SI = "\<Esc>]50;CursorShape=2\x7"
let &t_SR = "\<Esc>]50;...
0
votes
4
answers
58
views
Mapping: Automatic placement of cursor into (<>) when I press <space> twice
For my Latex setup in VIM I want to map different text modules where the cursor is automatic placed in between (<>), when I press twice <space> and when the cursor arrives there the (<&...
0
votes
1
answer
700
views
How can I have multiple cursors while entering insert mode after Visual Block mode?
Let's say I have some text:
ipsum
ipsum dolor
ipsum dolor sit
I want to add the word "Lorem" in front of each line.
Loremipsum
Loremipsum dolor
Loremipsum dolor sit
I can do this by:
...
1
vote
2
answers
493
views
How to use value under cursor in the shell command?
Is it possible to use word under cursor in shell command? Say:
Elvis
^ cursor here
then
:r! echo <word_under_cursor>
and get "Elvis" read in.
1
vote
1
answer
187
views
How to make vim position the cursor with custom mapping for <C-LeftMouse>?
I am using vim 8.2 in terminal with mouse support (mouse=a) and trying to define a custom mapping for <C-LeftMouse>. The mapping itself works but the problem is that vim stops setting cursor ...
0
votes
1
answer
2k
views
How do you set the cursor style in Vim terminal windows?
Vim has the :terminal command, which opens a window with a terminal session inside. According to the documentation (:help terminal-cursor-style),
By default the cursor in the terminal window uses a ...
2
votes
3
answers
93
views
How to remember and recall cursor position?
Imaging I'm editing some code, and I found a few words that I would like to paste at the current cursor position elsewhere in the file. I will go to them, yank them, but then how do I return back to ...
0
votes
1
answer
94
views
vim - why is the cursor different in different terminals
I have vim 8.2 installed on my Debian machine and when I open it in a gnome-terminal it has a solid non-blinking box as a cursor.
But when I open a "pure" terminal with ctrl+alt+F3 and open ...
0
votes
1
answer
247
views
How can I get netrw to not move the cursor when I return to it
When I open a directory in netrw by opening vim like vim ., it will show me a list of files in the current directory. If I find a file then press t it will open that file in a new tab, when I'm done, ...
0
votes
0
answers
513
views
(Code review) Copying file path relative to cwd with the line number appended
I am replicating what PHPStorm and VSCode do by allowing me to copy the file path and line number (plus column) to clipboard. I have written a function in lua to do this, but, I wanted to ask about ...
1
vote
1
answer
548
views
Cursor not changing to beam in insert mode when using Kitty terminal
Well the common problem again.
I could fix my problem for Konsole by adding
" Fix cursor for Konsole
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>...
2
votes
1
answer
6k
views
set cursor to block
I am trying to set the cursor as a block/box that surrounds the current character as opposed to a line cursor:
This is my default that I got pressing :set guicursor=<Tab>
:set guicursor=n-v-c:...
1
vote
0
answers
70
views
Strange character littering the buffer on the cursor line
When I edit a file in vim on my laptop running OL8 (a RedHat variant) inside a gnome terminal, there is a strange character on the left margin of the cursor line. The character is "sticky", ...
1
vote
0
answers
112
views
Wrong column highlight on lines containing references or links
I've recently taken up nvim and came accross a weird issue.
I've turned on cursor position highlighting for both lines and columns (set cursorline and set cursorcolumn), and usually it works as ...
0
votes
1
answer
141
views
How to know current setting for guicursor shape on Gvim?
I know how to change cursor's shape when using Gvim:
set guicursor=**options_here**
The problem is, it seems like guicursor cannot be echoed as far as I know, even though setting it as above works:
...
1
vote
1
answer
310
views
How to change foreground color of character underneath cursor?
I've tried setting the highlight rules below but it does not work. Whatever color I choose, the color of the character stays the same.
I'm using xfce4-terminal on Linux and Terminal.app on Mac OSX.
...
0
votes
1
answer
118
views
How to insert on a newline, pushing everything after the cursor down with it
Say my cursor is []:
(A very intelligent turtle[)]
I'd like to issue something like o that would put me in insert mode here:
(A very intelligent turtle
[)]
I'm using spacemacs.
0
votes
1
answer
258
views
How to replace selected text T with some function(T), using a keyboard shortcut?
I want to annotate words /sentences for a "named entity recognition" purpose; inside a text file, I want to annotating words or sentences with this format [pattern](label):
[a word where the ...
-1
votes
1
answer
87
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 ...
0
votes
2
answers
320
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 ...
5
votes
2
answers
543
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
vote
1
answer
1k
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
1
answer
55
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
2
answers
115
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
1
answer
1k
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
1
answer
29
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)
...
3
votes
2
answers
3k
views
How do I make the cursor blink?
set guicursor=n:blinkwait5-blinkon5-blinkoff5 has no effect.
Why is that?
mp4
2
votes
1
answer
2k
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
1
answer
264
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 ...
1
vote
0
answers
117
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
2
answers
282
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
2
answers
104
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
0
answers
36
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 ...
3
votes
1
answer
6k
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 :)
5
votes
1
answer
2k
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
0
answers
70
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, ...
7
votes
2
answers
6k
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 ...
5
votes
1
answer
1k
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 ...
4
votes
2
answers
482
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 ...