Vim question
woals9095 opened this issue · 2 comments
Hello, I am a Korean who studies and loves vim.
I would like to ask you a question about vim
I am trying to make a script by writing the command'vim -s file1 file2'.
when writing file1
First change to insert mode
Second text creation
Thirdly, return to normal mode
Save fourth
Changing to normal mode is problematic here I don't know how to write commands to file1.
I don't know how to switch to normal mode
Ex)
/temp
i
Text
:wq
Thank u
I'm not familiar with -s command line option. But I think I know a workaround that might help you.
After you type this:
/temp
iText
You have to insert escape key. For that, press ctrl+v followed by esc key. And then :wq. It should look like this:
/temp
iText^[:wq
where ^[ is the representation of escape key when you press ctrl+v followed by esc key. You shouldn't enter it manually as ^ followed by [
Also, I'd suggest https://www.reddit.com/r/vim/ or https://vi.stackexchange.com/questions to get help with vim. And I would also suggest to use sed or perl command instead of vim for automating such text processing.