Questions tagged [cursor]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
15 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
38 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
0answers
18 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
52 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
35 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
95 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 ...
1
vote
0answers
36 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
42 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
53 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
46 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
77 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 "...
2
votes
1answer
129 views

getpos(“.”) in visual mode equals getpos(“v”)

I uses 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
137 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' ...
2
votes
0answers
390 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
139 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-...
9
votes
1answer
543 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
299 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
245 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
196 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 ...
1
vote
1answer
765 views

How disable cursor shape modes in neovim?

Hello, so I just posted an issue in neovim's officiall github repo about a problem I am going to tell you about in a couple seconds and after finding a solution they told me the instructions were ...
1
vote
2answers
68 views

How to change f{char} to search left if no char was found searching right?

Regarding this command: f{char} To [count]'th occurrence of {char} to the right. The cursor is placed on {char} |inclusive|. {char} ...
1
vote
2answers
117 views

gvim Linux - GUI scroll without cursor shift

When we write code, we usually jump between different parts of the code (using the scrolling or the search functions). In this situations, on Linux, *vim shifts the cursor to the visible area. For ...
1
vote
1answer
1k views

No_cursor_blinking doesn't work

I have read this article & I added se gcr+=a:blinkon0 in my vimrc to stop blinking cursor in my Vim, also I sourced my vimrc again but the matter is it doesn't work & cursor is still blinking ...
2
votes
2answers
458 views

Move cursor to new line character

When in visual mode you can select the new line character. E.g.: The quick brown fox jumps over the lazy dog.⏎ In visual mode you can select both the period and the (invisible) carriage return, or ...
0
votes
1answer
384 views

Tweaking cursor gvim

I'd like to change the view of my current cursor as this pic: So how to have _ in cursor and how to change color of cursor? Thanks in advanced.
2
votes
1answer
367 views

Possibility to set cursor shape manually in Neovim

New versions of neovim handle cursor shapes perfectly. But for a special use case I need to change cursor shape manually for a while. Is it possible in Neovim > .2?
1
vote
1answer
107 views

Text changes when moving cursor over

I was modifying an email template and I noticed that when moving the cursor over a piece of code it changed. Here is a screenshot from before: and after: Vim version is 7.4 on Ubuntu 16.04. Any ...
2
votes
2answers
1k views

How to disable moving the cursor with the mouse

I've been using Vim for decades (and Vi before it since around 1984.) I use it now on Linux. Somewhere along the line one behavior crept in that I'd like to disable: when I click in a window to move ...
5
votes
3answers
881 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 ...
5
votes
1answer
191 views

Disable bold character under cursor

This might be a newbie question but I can't seem to find an answer anywhere. I've created a custom colorscheme, but I don't know how to stop the character behind the cursor from becoming bold. This ...
1
vote
1answer
53 views

How to correctly interpret the cursor's position?

I'm having trouble understanding the cursor in the context of Vim commands, e.g. insertion, deletion, movement, etc: When the cursor is hovering over a character and I want to delete until the end of ...
3
votes
0answers
561 views

Why does `set t_ve=' hide cursor in terminal

Vim's documentation lists t_vi as "cursor invisible" and t_ve as "cursor visible", but provides no hints on usage. Naively, I would have guessed that Vim would send the t_vi sequence when you somehow ...
0
votes
2answers
211 views

Current line position when switching buffers

When switching buffers with :e# or <ctrl>-^, I commonly see the line with the cursor (the current line) move to the middle of the window (maybe related to the scroll_cursor_halfway function ...
1
vote
0answers
155 views

How to restore cursor shape when exiting/stopping vim?

I have this in my .vimrc let &t_SI = "\<Esc>[5 q" let &t_SR = "\<Esc>[3 q" let &t_EI = "\<Esc>[2 q" The problem is that I keep the block cursor shape when I exit vim. ...
5
votes
1answer
4k views

I can't switch to | cursor in insert mode

I want to change cursors to a | character in insert mode, and then back to a block in normal mode. I am using urxvt as my terminal, and neovim. To switch cursors in my terminal, I run the following ...
3
votes
1answer
91 views

How to center a cursor on the screen, even at the start of the file

I like always knowing where my cursor is. I do this by having it in the center line of the screen. However if I am working at the top of the file the cursor stops centering because there is no more ...
4
votes
3answers
304 views

How can you indent your current file without losing your cursor position?

I was reading that the way to indent in vim is a gg=G sequence. This however loses my cursor position. How can I indent my file without losing my cursor position?
1
vote
4answers
109 views

Motion remap to select function doesn't work with v

I want to add a motion: :onoremap <silent> f( :<C-U>normal! f)vF(b<CR> If I have this line, where the asterisk is my current position: int a = fo*o(4, 5, 99); I want to type vf( ...
12
votes
2answers
3k views

How do I make Vim always display several lines after EOF?

In Vim, I don't like how when you reach end of file it puts the last line at the bottom of the screen. Is there anyway to make the last line be something like 10 lines above the bottom of the screen ...
0
votes
1answer
173 views

How to scroll without forcing the cursor on screen (by letting the cursor off screen)?

I want to be able to do this because I am used from other editors to use the cursor as a visual bookmark, so that after scrolling by letting the cursor off screen I can come back to its place later. I ...
8
votes
1answer
2k views

Vim normal and insert mode cursor not changing in GNU screen

I use vim in a few different contexts; typically, I like to put this in my .vimrc: let &t_ti.="\<Esc>[1 q" let &t_SI.="\<Esc>[5 q" let &t_EI.="\<Esc>[1 q" let &t_te.=...
3
votes
2answers
332 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 the line where the spaces have ...
0
votes
1answer
663 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 ...
9
votes
1answer
581 views

Change the cursor shape in operator pending mode

My cursor in Gvim: My cursor in Gvim after pressing d: Is there any way I can change the cursor in terminal Vim when in operator pending mode? It doesn't have to look exactly like the screenshots. ...
5
votes
2answers
1k views

CursorLine colors

I configured my CursorLine to be lightyellow. I have a couple of issues here: First, lightyellow is marked as an error when it is a valid color. How can I avoid this? Second, when the cursor line is ...
11
votes
1answer
322 views

What is causing my cursor to look so strange? [closed]

Whenever I hit the end or beginning of a line, I get this very odd character where my cursor was. Any idea what may be causing this? I believe I have my fonts and theme correctly installed. I'm using ...
0
votes
1answer
430 views

On Ubuntu and in tmux, vim does not react to Ctrl+Home and Ctrl+End

Outside of tmux they work well. These key combinations should move the cursor to the beginning of the document and, respectively, to the end of the document. How do I make them work? Thank you very ...
3
votes
1answer
112 views

cursor behavior when exiting <insert> mode

I understand that when in insert mode the cursor is described as between characters, and when in normal mode the cursor is supposed to be on a valid character. I have been having a lot of trouble with ...
11
votes
3answers
6k views

Multiple cursors at desired location

I'm using vim-multiple-cursors plugin. I would like to put cursors exactly where I want. For example ([x] are the cursor positions): Lorem ipsum dolor sit amet[1], consectetur adipiscing elit, sed ...
5
votes
1answer
3k views

Change cursor shape in different terminals

At home I use iTerm2 on MacOS X, and at work, I have a laptop with CygWin. I have another PC where I use gnome-terminal or terminator, and sometimes I use tmux. I'm looking to configure the cursor ...