Exit neon sign on brick wall background

როგორ გავიდეთ VIM-დან და ყველაზე პოპულარული VIM მალსახმობებიდან

If you are reading this article then you are in trouble. You wanted to edit a file using vim editor but got stuck in it. Stop panicking and wait with re-installing the OS and starting all from scratch – in this article I will show you how to exit a vim trap.

google search with request "how to quit vim"
Vim სიგარეტის მოწევის შემდეგ მეორე ყველაზე რთულად დასატოვებელი რამაა

გამოდით VIM რედაქტორიდან კლავიშთა კომბინაციების გამოყენებით

Vim რედაქტორი დამწყებთათვის რთულია, მაგრამ როდესაც ისწავლით კლავიშების სწორ კომბინაციებს VIM-ის გამოყენებით, ადვილი ხდება. აქ არის ყველაზე პოპულარული კლავიშების კომბინაციები vim-ის დატოვების მიზნით.

გამოდით vim შენახვის ცვლილებებიდან

ცვლილებების შენახვით vim-დან გასასვლელად დააჭირეთ ესკ რედაქტირების რეჟიმიდან გასასვლელად, დააჭირეთ ღილაკს ცვლა და დააჭირეთ მსხვილი ნაწლავი key (:). Then enter “wq” and press Enter. Here “w” stands for write and “q” stands for “quit”. On US keyboards the colon : არის იგივე გასაღები, რაც მძიმით ;, located right of the letter “L” key.

:wq

გადით vim ცვლილებების შენახვის გარეშე

To exit vim without saving changes hold down Shift and press the colon key (:). Then enter “q!” and press Enter.

:q!
exit vim without saving changes
exit vim ცვლილებების გარეშე

შეინახეთ ცვლილებები არსებული VIM რედაქტორის გარეშე

To save changes without exiting vim hold down Shift and press the colon key (:). Then enter “w” and press Enter.

:w

ვიმ-ში დახელოვნება

ახლა, როდესაც მე გავაშუქე Vim-იდან გასვლის საფუძვლები და ცვლილებების შენახვა, მოდით გადავიდეთ რამდენიმე დამატებით სასარგებლო Vim მალსახმობებზე და ფუნქციებზე, რათა გაზარდოთ თქვენი ცოდნა.

იწყება VIM ფაილის რედაქტირება

როგორც წესი, დეველოპერები იწყებენ vim-ს ფაილის რედაქტირებისთვის ბრძანების გამოყენებით:

vim filename

თუ ფაილი აკლია, ის შეიქმნება. თქვენ შეგიძლიათ მიუთითოთ მრავალი ფაილი რედაქტირებისთვის:

vim file1 file2 file3

ფაილის კონკრეტულ ხაზზე გასახსნელად შეგიძლიათ დაამატოთ [num] vim ბრძანების შემდეგ. მაგალითად 127-ე სტრიქონზე ფაილის გასახსნელად შეიყვანეთ:

vim filename +127

Once you’ve entered Vim, navigating efficiently is key. Here are some popular shortcuts:

  • კურსორის გადაადგილება:
    • გამოიყენეთ ისრიანი ღილაკები შესაბამისი მიმართულებით გადასაადგილებლად (ზემოთ, ქვევით, მარცხნივ, მარჯვნივ).
    • Alternatively, employ the h, j, k, and l keys for left, down, up, and right movements, respectively.
  • სიტყვების ნავიგაცია:
    • Move the cursor to the beginning of the next word with w.
    • Navigate to the end of the current word using e.
    • Jump to the beginning of the previous word with b.
  • ნავიგაციის ხაზები:
    • Go to the start of the line by pressing 0.
    • Move to the end of the line with $.

ტექსტის რედაქტირება VIM-ში

Once you’ve reached the desired location, these shortcuts will aid in text manipulation:

  • ჩასმის რეჟიმში შესვლა:
    • Press i to enter insert mode before the cursor.
    • Use I to start inserting at the beginning of the line.
    • Employ a to append after the cursor.
    • A საშუალებას იძლევა მიმაგრდეს ხაზის ბოლოს.
  • ტექსტის წაშლა:
    • Delete the character under the cursor with x.
    • Erase the entire line with dd.
    • Cut (delete) the current line and enter insert mode with cc.
  • დააკოპირეთ და ჩასვით:
    • Copy a line with yy.
    • Paste the copied line below the current line using p.
  • გაუქმება და გამეორება:
    • Undo the last action with u.
    • Redo with Ctrl + r.

ვეძებთ VIM-ში

ეფექტური ძებნა გადამწყვეტია. აქ არის ძიებასთან დაკავშირებული რამდენიმე მალსახმობი:

  • ტექსტის ძიება:
    • Initiate a search with /, followed by the desired term.
    • Use n to jump to the next occurrence and N to go to the previous one.
  • ტექსტის ჩანაცვლება:
    • Substitute the current word with a new one using :s/old/new/g.

გასვლა Vim

მე უკვე განვიხილეთ საფუძვლები დასაწყისში, მაგრამ აქ არის კიდევ რამდენიმე ვარიანტი:

  • შეინახეთ და დატოვეთ ყველა:
    • To save all changes and quit multiple files simultaneously, use :wa და :qa.
  • გასვლა შენახვის გარეშე:
    • If you want to exit Vim without saving any changes made in any of the files, :qa! will do the trick.

დასკვნა

გახსოვდეთ, Vim-ის დაუფლებას დრო და პრაქტიკა სჭირდება. რაც უფრო მეტს იყენებთ, მით უფრო კომფორტული და ძლიერი ხდება. ბედნიერი რედაქტირება!