Buy @ Amazon

Search This Blog

September 26, 2019

Essential Vim For CKAD Or CKA Exam


If you are preparing for CKAD or CKA exam and are new to Vim/Vi, this post will help you know everything that is essential to being productive with Vim during your exam.

Vim has 3 modes as  depicted in picture below:
  • In Command Mode, you do things like navigating your cursor from one point to another in your text file, or delete text or replace text or select text or things like that. When you open Vim, you will be in this mode to begin with.
  • In Insert Mode, you insert text and delete text with [backspace] key :)
  • In Execution Mode, you do things like search text in file, set tab length, set line numbers in editor and stuff like that.


Frequently Used Keyboard Shortcuts In Command Mode


w ==> jump by start of words
e ==> jump by end of words
b ==> jump backward by words
0 ==> (zero) is to jump to the start of the line
$ ==> (dollar) jumps to end of line
gg ==> to go to top of page
G ==> to go to bottom of page
dd ==> delete current line
y ==> yank/copy current line
P ==> paste content before cursor
p ==> paster content after cursor
i ==> enter insert mode to input text in current cursor location
a ==> enter insert mode and move cursor to append to the existing line
u ==> undo last action
. ==> (dot) to repeat last command
Ctrl + r ==> redo last action
v ==> to visually select multiple lines


Things Done In Execution Mode


:5 ==> go to 5th line in the file
:N ==> go to Nth line in the file
/search_text ==> search for search_text
n ==> repeat search in same direction
:%s/old_text/new_text/g ==> replace all old_text with new_text throughput file
:%s/old_text/new_text/gc ==> replace all old_text with new_text throughput file asking for confirmation before making each change
:set et ==> set expandtabs to spaces
:set  number ==> show line numbers
:set sw=2 ==> shiftwidth of tab from default 8 to 2 spaces
:set ts=2 ==> set tabstop to 2 spaces
:set sts ==> set softtabstop to 2 spaces


Configuring Vim To Your Preference


There are certain things that you don't want to set every-time you open vim, like showing line numbers and the tab spaces that suits your preference. All you have to do for this is create a ~/.vimrc file with the following content:
:set number
:set et
:set sw=2 ts=2 sts=2


This should improve your productivity big-time during the exam.

If you like this post or if this post helped you in your preparation, do care to share it among your circle. Let's spread goodness :)

If you think I have missed anything, do share your points as comments to this post. Thanks in advance for that..

Happy Vimming and good luck for your exams!

11 comments:

  1. Thanks! As an emacs user I'm lost in this world, so the bare minimum to get by is exactly what I needed.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. Highly appreciable regarding the uniqueness of the content. This perhaps makes the readers feel excited to get stick to the subject. Certainly, the learners would thank the blogger to come up with innovative content which keeps the readers to be up to date to stand by the competition. Once again nice blog keep it up and keep sharing the content as always.

    Cyber Security Course

    ReplyDelete
  4. An extraordinary blog filled with amazing content which no one has touched on this subject before. Thanking the blogger for all the terrific efforts put in to develop such awesome content. Expecting to deliver similar content further too and keep sharing as always.

    Machine Learning Course in Bangalore

    ReplyDelete
  5. The most engaging and compelling admission essay should tell a story and have clear focus. Carefully choose the detail to include when you write your essay, and aim to reveal your interests and passions as well as showing your personality. You can use the following admission essay advice to make your essay look attractive and impress the selection panel. How to Hear the Holy Spirit

    ReplyDelete
  6. Truly mind blowing blog went amazed with the subject they have developed the content. These kind of posts really helpful to gain the knowledge of unknown things which surely triggers to motivate and learn the new innovative contents. Hope you deliver the similar successive contents forthcoming as well.

    Data Science in Bangalore

    ReplyDelete
  7. I am glad to discover this page. I have to thank you for the time I spent on this especially great reading !! I really liked each part and also bookmarked you for new information on your site.
    Data Science Training in Chennai

    ReplyDelete
  8. Thanks for posting the best information and the blog is very important.data science course in Lucknow

    ReplyDelete
  9. What a really awesome post this is. Truly, one of the best posts I've ever witnessed to see in my whole life. Wow, just keep it up.
    digital marketing courses in hyderabad with placement

    ReplyDelete
  10. Sadly, the long standing conventional Bar arrangement courses have not adjusted their educational plans to make up for this change. 1z0-1047-21

    ReplyDelete

Like it or hate it, feel free to share your feedback. Cheers!