global command

14 views
Skip to first unread message

Ni Va

unread,
Apr 9, 2022, 4:27:18 AM4/9/22
to vim_use
Hi,

How to not moving cursor when executing global command ?

g/^EOF/call add(g:ends, line('.'))

Thank you

Stan Brown

unread,
Apr 9, 2022, 5:25:29 AM4/9/22
to vim...@googlegroups.com
On 2022-04-09 01:27, Ni Va wrote:
> How to not moving cursor when executing global command ?
>
> g/^EOF/call add(g:ends, line('.'))

I don't know of any way within the g command. However, what I do after a
global command is move the cursor back to where it was before the
command: either '' or ``

See <:help ''> and <:help restore-position>.

--
Stan Brown
Tehachapi, CA, USA
https://BrownMath.com

Ni Va

unread,
Apr 9, 2022, 7:04:41 AM4/9/22
to vim...@googlegroups.com
Hum. Thank you Stan ! 😃 

--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/-iZXDs5DWCw/unsubscribe.
To unsubscribe from this group and all its topics, 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/8a08f47d-686d-0476-bc08-2bec25f80a76%40fastmail.fm.
Reply all
Reply to author
Forward
0 new messages