Quick Vim question

21 views
Skip to first unread message

Susan McElheny

unread,
Apr 13, 2023, 4:15:19 PM4/13/23
to vim...@googlegroups.com
Hi, 

I've used the Vi editor on Unix for over 30 years and had to recently switched my software to Windows so I am now using Vim on my c:drive.  I'm confused about how to change settings.  When I do a search all the items are highlighted but there is no indicator for which word in the search I am currently on. How do make Vim indicate which search word I'm currently on?  

Regards,

Susan McElheny
Senior Analyst, Data Operations
703.536.0923 direct

703.536.0500 main


Travel Intel Logo

Roy Fulbright

unread,
Apr 13, 2023, 5:34:38 PM4/13/23
to vim_use
Your cursor (normally a blinking black square) should be on the current word in the search.

Gary Johnson

unread,
Apr 13, 2023, 6:12:37 PM4/13/23
to vim_use
On 2023-04-13, Roy Fulbright wrote:

>> On Thursday, April 13, 2023 at 4:15:19 PM UTC-4 Susan McElheny wrote:

>> I've used the Vi editor on Unix for over 30 years and had to recently
>> switched my software to Windows so I am now using Vim on my c:drive.  I'm
>> confused about how to change settings.  When I do a search all the items
>> are highlighted but there is no indicator for which word in the search I am
>> currently on. How do make Vim indicate which search word I'm currently on?

> Your cursor (normally a blinking black square) should be on the current word in
> the search.

Also, if your cursor does not stand out enough, you might consider
setting 'hlsearch' and setting the highlight for CurSearch to
something different than Search. By default,

:hi CurSearch
CurSearch xxx links to Search

See

:help 'hlsearch'
:help CurSearch
:help Search
:help 06.3
:help highlight-link
:help highlight-args

Regards,
Gary

Susan McElheny

unread,
Apr 13, 2023, 6:18:40 PM4/13/23
to vim...@googlegroups.com
My cursor is a blinking vertical line that doesn't appear since the search item is colored yellow.  How do I change the cursor to be a blinking black square?  Obviously I'm not as proficient in computer stuff as probably the rest of the Vim users.

Susan McElheny
Senior Analyst, Data Operations
703.536.0923 direct

703.536.0500 main


Travel Intel Logo


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/bfdf2f0a-001e-44eb-8dce-693b6e0eff18n%40googlegroups.com.

Susan McElheny

unread,
Apr 13, 2023, 6:50:58 PM4/13/23
to vim...@googlegroups.com
Sorry I don't understand.  I currently have hlsearch in my _vimrc file so the search words are highlighted but I can't see the cursor and I don't know how to make it a black blinking square.  Also in Unix Vi I was able to type a number and the letter l - lower case L (100l for example) and it would take the cursor to column 100.  Is there a way to do this in Vim for windows?

I really appreciate the help!

Susan McElheny
Senior Analyst, Data Operations
703.536.0923 direct

703.536.0500 main


Travel Intel Logo


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.

Gary Johnson

unread,
Apr 13, 2023, 7:49:52 PM4/13/23
to vim...@googlegroups.com
On 2023-04-13, 'Susan McElheny' via vim_use wrote:
> Sorry I don't understand.  I currently have hlsearch in my _vimrc
> file so the search words are highlighted but I can't see the
> cursor and I don't know how to make it a black blinking square.

When 'hlsearch' is set, the search matches will be highlighted by
the Search highlight group. You can change the color and other
attributes of that highlight group with the :highlight command.
Similarly, the search match under the cursor will be highlighted by
the CurSearch highlight group. The CurSearch group defaults to be
the same as the Search group, so that all matches are highlighted
the same. You can change that by redefining the CurSearch group.

That may help you see your cursor, but that's not really the
problem. The problem is that you can't see the cursor itself.

Unfortunately for you, my Vim cursor has always "just worked", so
I don't know anything about changing it. As I understand it, when
Vim runs as a GUI, it has full control over the cursor, but when it
runs in a terminal, the terminal determines the characteristics of
the cursor and applications have only limited control over it, and
that depends on the terminal.

Are you running the GUI version of Vim or the console version in
a Windows Console or other terminal?

If you're running the GUI version in Windows, you might take a look
at

:help 'guicursor'

> Also in Unix Vi I was able to type a number and the letter
> l - lower case L (100l for example) and it would take the cursor
> to column 100.  Is there a way to do this in Vim for windows?

This should work the same in all versions of vim, or of vi for that
matter. Actually, 100l will move the cursor 100 character positions
to the right. To move to column 100, use 100|.

But back to the problem. If a number followed by l does not move
the cursor that number of characters to the right, what happens
instead? The more details we know, the better we will be able to
figure out the problem and a solution.

> I really appreciate the help!

You're welcome. We should be able figure this all out.

Regards,
Gary

meine

unread,
Apr 14, 2023, 3:08:02 AM4/14/23
to 'Susan McElheny' via vim_use
On Thu, Apr 13, 2023 at 03:48:35PM -0400, 'Susan McElheny' via vim_use wrote:
> I've used the Vi editor on Unix for over 30 years and had to recently
> switched my software to Windows so I am now using Vim on my c:drive. I'm
> confused about how to change settings. When I do a search all the items
> are highlighted but there is no indicator for which word in the search I am
> currently on. How do make Vim indicate which search word I'm currently on?

This looks like the colour of your cursor is the same as the
selection/marking of the word that you search.

Changing the colour of the cursor isn't that hard:

* Find out what colorscheme you use. This might be in your .vimrc, but
* can also be found with the `:color` command;

* Open that color-file in ~/.vim/colors/ or alike;

* J to the lines that define the colour of your cursor and change the
* one for selections to a different value. You can use a colour value
* that is used in another setting. Just try something that is completely
* different, e.g. yellow instead of blue;

* Preferrably save the changed color file under a different name. I
* changed `nighted.vim` to `nighted_16b` for that reason. Set that new
* colorscheme as your default. The new name prevents the customized file
* to be overwritten at an update or so in future. (my '16b' has something
* to do with the use of 16 colours in TTY).

Hope this helps you!

KR,

//meine

rwmit...@gmail.com

unread,
Apr 14, 2023, 7:20:01 AM4/14/23
to vim_use
This is from my file where I configure the cursor for MacVim, probably works under windows too.  You can either add it to your vimrc file or put it in a separate file and source it from there.  or this will give ideas on where in help to look.

```
" Customize Cursor Settings
"
" Set cursor to be just an underline"
" set guicursor=n-c:hor20,v:hor25,ve:ver35,o:hor50,i-ci:ver25,\r-cr:hor35-ErrorMsg,sm:block

  set guicursor =n-c:hor25            " normal and cmdline mode
  set guicursor+=v:hor30              " visual mode
  set guicursor+=ve:ver35             " visual with selection
  set guicursor+=o:hor50              " operator pending
  set guicursor+=i-ci:ver35           " insert mode
  set guicursor+=r-cr:hor30-ErrorMsg  " replace and cmdline replace
  set guicursor+=sm:block             " showmatch in insert mode
  set guicursor+=a:blinkwait300-blinkon300-blinkoff300  " all modes

" suggested by John Little
" set guicursor=a:blinkwait200-blinkon200-blinkoff200

  highlight    Cursor guibg=#0F8F0F
  highlight   lCursor guibg=#A000A0   " where is this used?
```

Steve Martin

unread,
Apr 14, 2023, 6:49:29 PM4/14/23
to vim_use
In all likelihood this is an issue with the Terminal software you are using. If you are using gvim.exe then as installed by the Windows binaries from vim.org, the default cursor should be a block cursor. If you are using another Terminal you need to look at the settings for that Terminal.

In Windows 11, the new WindowsTerminalPreview.exe or "wt.exe" will let you change the cursor in the settings. Use "Ctrl-," (that's control-comma) to open the settings. Then go to "Profiles->Default->Cursor Shape" and select the "filled box" cursor. Save your changes and see if that helps.

Reply all
Reply to author
Forward
0 new messages