love-your-vim ; check your understanding #1 Vim configs are avail in ✔a - .vimrc b - .vimcnf c - vim.reg d - .vimc #2 Vim don't support working with multiple files because a - to avoid over-locking on physical file that currently edited b - to prevent accidental overwritten to hidden file edited ✔c - working with multiple files is possible and no lock occur d - a & b both correct while c is false #3 Vim is a popular text editor which means it's good at terminal and a - it doesn't support GUI tools - ex: mouse ✔b - it does support mouse , but may need extra config c - it works only on remote Gnu/Linux servers not local windows d - a & c are true while b is false #4 Modes and operations a - NORMAL - normal read & write mode; no permission required INSERT - to insert additional/external resource into the file COMMAND - to execute current file & along with system commands (ls) REPLACE - to replace the file content completely with other's VISUAL/V-BlOCK/V-LINE - file loaded with visually; shows non-printable chars (newline,tab,space) ✔b - NORMAL - normal mode for read but not for write ; no permission required INSERT - to insert/update/append/change/delete text resource/file COMMAND - to execute vim commands like :new, :set nu, / REPLACE - substitute file patterns with new content VISUAL/V-BlOCK/V-LINE - text selection mode; full/column/line mode c - NORMAL - normal execution mode; no read & no write ; INSERT - to insert/update/append/change/delete text on the file COMMAND - to execute only system commands without leaving vi editor REPLACE - to replace the file content completely with other's VISUAL/V-BlOCK/V-LINE - show stats of file/block/line chosen d - b is wrong , c has 3 right , a has 4 wrong a & b all right , c has 2 wrong , 3 correct b has all right, c has only 1 right,a has 3 wrong b has all right, c & a fully wrong #5 To encrypt/decrypt a file content with vim a - execute `:enc secret` in command mode from vim ✔b - start vim -x from terminal c - execute `:encrypt token=secret` in command mode from vim d - start vim -x token=secret from terminal #6 Which keys used to move/navigate (Left/Right/Up/Down) in a Vim editor? a - l,r,u & d b - CTRL-L, CTRL-R,CTRL-U & CTRL-D ✔c - h,l, k & j d - <, > , [ & ] #7 Session will help preserve & the restore the file, layout & windows of working space. And what is the command to make a session in home? ✔a - :mks or :mksession b - :makesess or :makesession c - :newsess or :newsession d - :sess or :session #8 When working on multiple buffers and edited 2 or more files. How to save all the changes across multiple files if possible and exit vim? 1 - :wqall 2 - :wq & :wa 3 - :wqa 4 - :wall & :quit ✔a - 1,3 b - 1,2,4 c - 3,1,4 d - 4,2 #9 Command to set the line number in the editor: a - :set line b - :set ln ✔c - :set number d - :set linu #10 What will happen if you command :new in vim? a - create new instance of vim using private profile b - create new instance of vim using same parent profile ✔c - create new empty buffer in horizontal split d - create new empty buffer in full window mode #11 Command to convert all buffers into tabpages is ✔a - :tab ball b - :tp all c - :buf2tp all d - :b2t all #12 To execute the macro recorded in char k on every line of the file : a - :exec! @k ✔b - :%norm! @k c - :%exec %k d - :normal &k #13 Choose the best; To navigate the content in NORMAL mode: a - bw - backward one word & fw - forward one word b - bw - backward one word & fw - forward one word ✔c - b - backward one word & w - forward one word d - b - backward one word & f - forward one word #14 To supress all warnings & execute the commands by forcefully: a - start vim with -f flag (ex: vim -f sample.txt) b - add /f after the command in COMMAND mode (ex: :q /f - quit by force) ✔c - add ! after the command in COMMAND mode (ex: :q! - quit by force) d - add ! before the command in COMMAND mode (ex: :!q - quit by force) #15 Two window loaded with different versions of same file. orig.txt and orig.bkup.txt ; Is that possible to compare them? ✔a - :windo diffthis b - :windo compthis c - :windo diff d - :windo comp #16 List the (book)marks ✔a - :marks b - :bookmarks c - :bms d - :bm #17 To revert to old change 5d a - :earlier 5days ✔b - :earlier 5d c - :ea 5days d - :ea=5d #18 Referring to plugin manager `junegunn/plug.vim`, what's the command to add new plugin from vim editor? a - :PlugAdd ✔b - :PlugInstall a - :PlugLoad a - :PlugUp #19 What is register and how can it accessed? a - register is vim's internal config & accessed at $HOME/.vimrc ✔b - register is vim's internal storage & listed using :reg c - register is vim's internal memory & accessing it make vim unstable d - register is vim's internal source & accessing will modify vim tool #20 % denotes ____ in vim ✔a - current complete buffer from line #1 to EOF b - current line beginning from column #1 to EOL c - current username working on vim aka $USER d - current $HOME dir owned by the vim user #21 User want to navigate the cursor to 4 left 3 up 5 right 1 left 3 down position 1 - hhhhkkklllllhjjj in NORMAL mode 2 - hhhhkkklllllhjjj in SELECT mode 3 - kkkkhhhlllllkjjj in NAVIGATE mode 4 - kkkkjjjlllllkhhh in SELECT mode 5 - jjjjkkkllllljhhh in VISUAL mode 6 - 4h3k5lh3j in NORMAL mode 7 - 4h3k5lh3j in SELECT mode ✔a - 1 & 6 b - 2 & 7 c - 3 & 4 d - 5 only #22 To explore the dir structure , vim has the following options: 1 - :Ex & :Explore - explore the current dir structure 2 - :ex & :explore - explore the current dir structure 3 - :Sex & :Sexplore - split & explore the current dir structure 4 - :Dex & :Dexplore - dir explore the current location 5 - :Vex & :Vexplore - vertical split explore 6 - :Lex & :Lexplore - left side explorer - loads current dir a - 1,2,3,4 ✔b - 1,3,5,6 c - 1,2 d - all the above #23 `:source ` is used to a - compile the from vim ; eg: source %, source ~/header.c ✔b - reload/refresh vim using ; eg:source %, source ~/Session.vim c - execute the system commands from ; eg: source daily_job.sh d - open the source into active buffer; eg: source #, source % #24 To record/stop a new macro : a - R