Thursday, October 8, 2020

Command mode move to matching paren/brace/bracket/angles... like '%'

Please help me find a way to move to the matching char pair from within a :source'd script...
Something like the Command mode move to matching paren/brace/bracket/angles... using the '%' key... but from the :source'd script...

Tim Chase mentions in another article (reference below) using % to move to the matching in normal mode.  The CTRL-O in insert mode was interesting as well... 

I'm trying to use a "move to matching" inside a :source'd script.  Is there a way to still move to matching brace after finding the start brace inside the :source'd script?

more info....

I tried a line with a single percent '%' and it moves the cursor to the end of the file. So I always got from the starting point to the end of the file and not the matching brace.

After reading Tim's response, I also tried something like this after finding the starting brace.  Here I am typing out the characters representing the characters i, CTRL-o, %,  escape key, where CTRL-o and escape were entered using the escaping key mech of CTRL-V (linux): 
i^O%^[

thanks for looking and thanks in advance for the help... newbie...  
Jim



=================================
From: https://groups.google.com/g/vim_use/c/PK4JmlsmoI8/m/hlerEqNqF8oJ
Subject: How to move cursor in insert mode?
Credit: Tim Chase

Some gross movements (such as by word or screen) can be done in 
insert-mode as well (control+left/right, home/end, pgup/dn) 
though some may be limited to gvim. For some of the other 
vim-specific movements, you can also use control+o ("oh", not 
"zero") to temporarily enter normal mode to issue one normal-mode 
command such as "%" to move to the matching paren/brace/bracket 
or ")" to move to the next sentence. All your typical motions 
should work here.

:help i_CTRL-O
:help motion.txt

-tim

--
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ef3b8e01-72fe-494f-b1ef-b1a9494f880bn%40googlegroups.com.

No comments:

Post a Comment