Guys, I'm a bit frustrated with vim editor alignment and worrying about it on my . . .

Dinesh babu:
Guys, I’m a bit frustrated with vim editor alignment and worrying about it on my upcoming exam. You can see in this attached (image1) show alignment looks good, but when I try to execute, I’m getting an error and by using the cat command I can see incorrect alignment (image2) for the same. How can I address this issue in the exam? Do I have an access to use notepad++ or vscode IDE for copy-paste activity in CKA exam? how can we make vim editor auto-correct this alignment issue in the future. I have even added the below lines in .vimrc file but no use, allignment still looking wired. >> vi ~/.vimrc
autocmd FileType yaml setlocal et ts=2 ai sw=2 nu sts=0
syntax on
image 2.png
image1.png

Kemal Göklen:
just use set paste

Dinesh babu:
can you explain, how to use it

Kemal Göklen:
in the vim just write :set paste
I am not an vim expert but this is working for me :slightly_smiling_face:

Tahir Jemal:
is it ok if we set paste in the vimrc, so that not to do it every time editing vim file?

Kemal Göklen:
@Tahir Jemal

set pastetoggle=<F3>

this should switch between paste nopaste when you press F3

Dinesh babu:
Along with @Kemal Göklen suggestion, i found adding up :nnoremap <leader>p :set invpaste<CR> helps to avoid swallowing up the <space>p… check this out https://stackoverflow.com/questions/13967356/vimrc-addition-to-toggle-set-paste

this is how my final file looks like :

vi ~/.vimrc

autocmd FileType yaml setlocal et ts=2 ai sw=2 nu sts=0
syntax on

#Invert paste when \p is pressed
set pastetoggle=<F10>
:nnoremap <leader>p :set invpaste<CR>

Sapan Kumar:
from my experience, no additional setting is required to the vimrc in exam, the paste works fabulously out of the box and if it is not aligned for some reason, try to use visual mode to shift the blocks.

Dinesh babu:
visual mode ? what does it mean ?

Tej_Singh_Rana:
You can see from https://opensource.com/article/19/2/getting-started-vim-visual-mode|here, @Dinesh babu You can shift multiple lines at a time.

Tej_Singh_Rana:
> Do I have an access to use notepad++ or vscode IDE for copy-paste activity in CKA exam?
You cannot access any third party tools. They will provide you inbuilt notepad when you join the exam.