For this lab report, I will be detailing the steps to the vim
challenge in Lab 7. As we all know, vim
is a very powerful yet quite controversial programming language, but after learning the basics and using it for the Skill Demonstration 2 practice, it actually proved itself very handy in my ssh
ieng6
login, where I didn’t have access to anything but the command line in Visual Studio Code. A handy tool called vimtutor
showed me the ropes, and it is very helpful at teaching you how to navigate such a daunting interface. Anyways, here is a fun little reminder of the many joys of Vim, although if this is your first time using Vim, please don’t worry :)
Credit: https://www.freecodecamp.org/news/how-i-learned-to-love-vim-ce3e058d57fb/
We will use this repository for the purposes of these tasks: https://github.com/ucsd-cse15l-s23/lab7
ieng6
ssh cs15lsp23__@ieng6.ucsd.edu
into the command line, and if you don’t have an ssh key
on your local system, then just enter your password as well.git clone https://github.com/acjeter/lab7
cd
to lab7/
or wherever you put the cloned lab7.bash test.sh
to test the file, the output should show that ListExamples.java
did not pass one of the JUnit testers.ListExamples.java
to fix the failing test (the error is that index1
is used instead of index2
in the final loop in merge
vim
. Vim
allows us to make command-line edits to a file, and in this case, since there is a bug with ListExamples.java
, we will need to enter vim ListExamples.java
into the command-line.vim
view of ListExamples.java
! How cool! Now, while you might think that vim is able to be navigated by clicking with the curser and making edits just like Visual Studio Code, unfortunately that is not the case.<H>
key to move right, <J>
key to move down, <K>
key to move up, and <L>
key to move left.<i>
to enter insert mode. Alternatively, you can press <R>
to replace one character, by typing the character you want to replace it with after. To exit insert mode
, you simply need to press the <esc>
key to enter normal mode
.:q
. To exit AND save your changes, make sure to type :wq
.<J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><J><L><L><L><L><L><L><L><L><L><L><L> <R><2>
and then I saved and exited vim by typing: :wq
.index2 += 2;
, and ListExamples.java
should be all fixed!bash
history. For me, I was able to re-enter bash test.sh
quickly by typing <up><up><enter>
. The test results of the edits in vim are below:git commit
. This will begin the commit process. After you type this, you will need to input git add <file>
for each of the files that bash is telling you need to be added. It looks like this:Then, it will prompt you into vim to make a change title. To add one press i
and make your changes, and then <esc>
and :wq
to save changes.
Then, use git commit
again and you should see this:
Now, type git push <cloned repository ssh key>
for me it is git push git@github.com:acjeter/lab7.git
. You should see this and it should be complete!
Congratulations! I knew you could do it! I’m looking forward to our next tutorial! :)