On Oct 12, 10:33 am, Ven Tadipatri <[email protected]> wrote: > > >> :folddocnormal! '<C-R>a' > > I tried this, and it says "mark unknown". I'm assuming there's a > space between folddoc and normal? > >
Sorry, as I mention, there is a typo. Omit the '' characters. Additionally I meant "type CTRL+R" (two keys) not "type < C - R >" (5 characters). > >> However, may I instead suggest: > > >> 1. Visually select the lines you wish to execute the command on (or > >> use marks as you are doing) > >> 2. :'<,'>normal! '<C-R>a' > > I realize it's possible in visual mode. Perhaps I can try that. What's > neat about folds (assuming I can get folddoc working) is that you can > execute a command in different parts of the file, whereas in visual > mode, it's a continuous selection. > I hadn't thought of that. Sounds like a neat use case. Another trick to pull out when needed! > > Actually, it occurred to me, the BEST way is probably to dispense with > > the <C-R> altogether: > > > :'<,'>normal! @a > > I tried the folddoc with the @a, and it just wiped out the text in my > fold altogether, replacing it with what i wanted to insert. Here's > what I tried > :folddoc normal! @a > That is strange. For me, this does not occur in a simple test. I tried: qaI* :folddoclosed normal! @a<CR> on a buffer with some folded text, and as expected, each line in the closed folds got "* " inserted. What is the command you are trying to run? Some commands don't work as nicely inside folded lines. > Or perhaps I'm just not understanding the point of folddoc - I thought > you could use it to execute commands in normal mode as well, but maybe > visual mode is intended for that? The code you showed did work in > visual mode. > :folddoclosed is a way to specify which lines to execute an :ex command on. Only :ex commands will work, but you can run normal-mode commands with the ":normal" ex command. The '!' at the end of :normal! is to ignore mapped keys, etc. while running the normal-mode command. Visual mode also cannot execute normal-mode commands, but you can use visual-mode to easily specify a range of lines to act on with an :ex command. -- 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
