Vim
Part One
- The task I chose to do was changing the name of the
startparameter and all its uses tobase. - The entire sequence was
/star<Enter>cebase<Esc>vbynvepvbynvey:w<Enter>. It’s 30 characters, right at the max limit 😬😬😳
-
First, I used
/star<Enter>to find the first instance ofstart. I skipped writing the ‘t’ to save myself a character 😼
-
Then, I used
ceto delete the word.
-
Then, i typed
basewherestartused to be and did<Esc>vbto select all ofbase. I saved it to the clipboard by pressingy.
-
Then, I pressed
nto get to the next instance ofstart.
-
Then, I used
veto select the word.
-
Then, I used
pto paste inbase, effectively replacingstartwith base. I also didvbyto selectbaseand save it to the clipboard again. It’s slightly annoying that usingpto replace the highlighted selection seems to copy what you highlighted…
-
I then did a similar procedure with the last instance of
startthat needed to be replaced. I pressednto go to the word,veto select it, andyto paste inbaseto replace it.
-
Finally, I did
:w<Enter>to save the changes.
And we are done!
Part Two
- When I edited the file on VSCode, used
scpto copy it over, and rantest.sh, it took me 10.4 seconds. The hardest thing about this method is being patient withscp! -
When I started with an
sshsession, edited the file in vim and ran it usingtest.sh, it took me 9.3 seconds. The hardest thing about this method is being comfotable with vim! - If I was running something remotely, I would probably use VSCode or any IDE and
scpit over, since having an IDE environment can be so useful. There’s so many things I wouldn’t catch if I didn’t have an IDE to underline it for me. - If it was a smaller task/a quick fix, I would probably use vim. It’s pretty simple to quickly get stuff done on vim if you are comfortable with it, and you won’t have to worry about waiting on
scp.
The choice of method depends a lot on the task at hand!