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!

8 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. Quality, on-campus education is slowly going over the expensive side of the border that only families of the middle income range along with the wealthy are able to afford. Students and parents, stretched by mounting education expenses, are progressively challenging the affordability of a college degree as well its definitive worth as an employment credential. This recent phenomena have left a significant gap between institutes and students. english class for Japanese

    ReplyDelete
  3. I have voiced some of the posts on your website now, and I really like your blogging style. I added it to my list of favorite blogging sites and will be back soon ...

    Data Science Training in Bangalore

    ReplyDelete
  4. I'm glad I found this blog! Occasionally, students want to know the keys to writing productive literary essays. Your first-class knowledge of this great job can become a suitable foundation for these people. Good

    Data Science Institutes in Bangalore

    ReplyDelete
  5. I am more curious to take an interest in some of them. I hope you will provide more information on these topics in your next articles.

    Best Data Science Courses in Bangalore

    ReplyDelete
  6. Really, this article is truly one of the best in the article history. I am a collector of old "items" and sometimes read new items if I find them interesting. And this one that I found quite fascinating and should be part of my collection. Very good work!

    Business Analytics Course in Bangalore

    ReplyDelete
  7. For as long as I can remember they have talked about Special Education reform and what it's going to mean to us. Today, it's no different. Only the names have changed, and today's name is full-inclusion. Class 6 Assignment 2021

    ReplyDelete

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