Hi Codeforces,
I use sublime-text3 editor to write codes, and CMD to run them. But sublime text does not have a feature to replace all endl's with '\n' , I tried recording a macro, but that only records characters printed on the screen, so that failed.
I don't use #define because that looks bad in the code and has resulted in frustrations before(forgetting that endl is not flushing the buffer and hence getting no output on incorrectly terminating programs).
Can someone write a script or snippet or anything that can do the above operation in 2-3 keystrokes ? Alternatively, point me to resources that can help me learn how to do that ?
Can't you just search for and replace "endl" with "\n" ?
CTRL+H (Replace) | Find: endl | TAB -> Replace: '\n' | Replace all | Or you could press ALT+ENTER after Find: endl and replace every occurence with '\n' manually, which is faster imo
I don't know how to bind some external commands on specified hotkeys in sublime, but I know it's possible to make a build system which does this. The script is
sed 's/endl/"\\n"/g' -i $file