Vi/vim and the "insert-only-one-char" command.
Vi 2.2, vim 7.1
Hi: If you please, a vim (alghough I esteem the corresponging vi command is the same) command to insert one character only, into the text being edited. That is, I'm in command mode, I issue command INSERT, I type a character, and automatically I'm again in command mode, where INSERT is the command I do not know. I have vimtutor but do not see it explained there. Any hint will be welcome. |
Well,
this will not work, but there is the "r" command in commandmode, this replaces the character which the cursor is under. This means "r" is the same as "x" "i" "character" "ESC". Another possibility to insert one charater without leaving the commandmode would be to yank the new character and paste it with "p". Markus |
Perhaps there is the possibility do build macros in vim. It would be odd if it had not. Thanks for you generous reply.
|
A macro with vim, this is a good idea, but be aware, that this will be a "vim only" solution. As I understood your requirements, you want the solution to work also with vi.
You may record a macro in vim Code:
q a i c ESC q For more information about vim try ":help" in command mode (not ":help!" ;) ) Markus |
Thanks for the info. Yours has been fine help. Regards.
|
I'm not quite sure what you mean here
Quote:
Simlarly with append ( shift-a) etc etc. vi/vim is a modal editor. If you want vim macros, see here; http://vimdoc.sourceforge.net/htmldoc/usr_10.html#10.1 |
Quote:
|
Of course I am. Thanks for your explanation.
|
All times are GMT -5. The time now is 05:28 AM. |