what are the three following commands(using linux) 5)Assume you are editing the
ID: 3733271 • Letter: W
Question
what are the three following commands(using linux)
5)Assume you are editing the main.cpp file. Write a vim command to split every ling longer than 40 characters into multiple lines, each of which is no longer than 40 characters (but may be shorter), and do not split any quoted strings.
6)Assume you are editing the main.cpp file. Write a vim command to change every singular "<" symbol to a double quote ("), but do not convert any double "<" symbols, i.e. leave the "<<" operators alone.
7)Assume you are editing the main.cpp file. Write a vim command to replace all newline characters (' ') with semicolons (;). The result should be a file with a single line containing ";" characters where the newlines used to be.
Explanation / Answer
Please find my answer for Q5 and Q7.
5.) vim main.cpp %opens the file in vim editor
V % select the line for visual purposes
gq % format it
6.) vim main.cpp %opens the file
:%s/</"/g
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.