Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [cursor]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
31 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 ...
1
vote
2answers
28 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
1answer
52 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
41 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
26 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'...
4
votes
1answer
74 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
256 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 ...
4
votes
4answers
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 ...
0
votes
1answer
19 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 ...
1
vote
1answer
447 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.
3
votes
0answers
650 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 ...
9
votes
1answer
625 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
1answer
218 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 ...
13
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 ...
0
votes
0answers
56 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 ...
5
votes
3answers
1k 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 ...
2
votes
0answers
69 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
98 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
1answer
163 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-...
1
vote
0answers
65 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
44 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
55 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
48 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
145 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 "...
3
votes
1answer
210 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
182 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
516 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 ...
9
votes
1answer
597 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
356 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
291 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
218 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
1k 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
144 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
568 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 ...
5
votes
2answers
2k 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 ...
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 ...
0
votes
1answer
487 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 ...
1
vote
1answer
112 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
1answer
402 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?
0
votes
2answers
223 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 ...
11
votes
1answer
340 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 ...
1
vote
1answer
55 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 ...
6
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 ...
13
votes
2answers
4k 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 ...
1
vote
0answers
169 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. ...
3
votes
1answer
95 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
306 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?