أكاديمية المعرفة
linux-logo

كيفية استخدام محرر النصوص في لينكس

منذ 5 أعوام

Using vi, the Unix Visual Editor

Der Editor vi How to Use the vi Editor
كيفية استخدام المحرر vi.

STARTING VI

You may use vi to open an already existing file by typing:
يمكنك استخدام vi لفتح ملف موجود بالفعل عن طريق كتابة:
vi filename
 
where "filename" is the name of the existing file.
 
If the file is not in your current directory, you must use the full path name.

Or you may create a new file by typing:
حيث يكون "اسم الملف" هو اسم الملف الموجود.
إذا لم يكن الملف في الدليل الحالي ، يجب عليك استخدام اسم المسار بالكامل.
أو يمكنك إنشاء ملف جديد عن طريق كتابة:
vi newname

where "newname" is the name you wish to give the new file.
To open a new file called "testvi," enter:

vi testvi

On-screen, you will see blank lines, each with a tilde (~) at the left, and a line at the bottom giving the name and status of the new file:
على الشاشة ، سترى أسطرًا فارغة ، كل منها مع تلدة (~) على اليسار ، وخط في الأسفل يعطي اسم وحالة الملف الجديد:
 ~
"filename" [New file]
 
 
vi Modes

vi has two modes:

command mode
insert mode

In command mode, the letters of the keyboard perform editing functions (like moving the cursor, deleting text, etc.). 

To enter command mode, press the escape <Esc> key.

In insert mode, the letters you type form words and sentences.
في وضع الأوامر ، تؤدي أحرف لوحة المفاتيح وظائف التحرير مثل تحريك المؤشر وحذف النص وما إلى ذلك.        
للدخول إلى وضع الأمر ، اضغط على مفتاح الخروج.
في وضع الإدراج ، تشكل الحروف التي تكتبها كلمات وجمل.
ENTERING TEXT

i            insert text left of cursor
a            append text right of cursor

MOVING THE CURSOR
     h            left one space
     j            down one line
     k           up one line
     ll           right one space

BASIC EDITING
     x         delete character
     nx        delete n characters
     X         delete character before cursor
     dw        delete word
     ndw       delete n words
     dd        delete line
     ndd       delete n lines
     D         delete characters from cursor to end of line
     r         replace character under cursor
     cw        replace a word
     ncw       replace n words
     C         change text from cursor to end of line
     o         insert blank line below cursor
                  (ready for insertion)
     O         insert blank line above cursor
                  (ready for insertion)
     J         join succeeding line to current cursor line
     nJ        join n succeeding lines to current cursor line
     u         undo last change
     U         restore current line

MOVING AROUND IN A FILE
     w            forward word by word
     b            backward word by word
     $            to end of line
     0 (zero)     to beginning of line
     H            to top line of screen
     M            to middle line of screen
     L            to last line of screen
     G            to last line of file
     1G           to first line of file
     <Control>f   scroll forward one screen
     <Control>b   scroll backward one screen
     <Control>d   scroll down one-half screen
     <Control>u   scroll up one-half screen
     n            repeat last search in same direction
     N            repeat last search in opposite direction

CLOSING AND SAVING A FILE
     ZZ            save file and then quit
     :w            save file
     :q!            discard changes and quit file

Moving by Searching
 
 
Type / (slash).
Enter the text to search for.
Press <Return>.
 
كيفية استخدام المحرر vi في لِينُكس.
ما هو المحرر vi؟
المحرر vi هو محرر النصوص الأكثر شعبية وكلاسيكية في عائلة لِينُكس.
فيما يلي بعض الأسباب التي تجعله محررًا مستخدمًا على نطاق واسع :
1) يتوفر في جميع توزيعات لِينُكس تقريبًا.
2) يعمل بنفس الطريقة عبر المنصات والتوزيعات المختلفة.
3) إنه سهل الاستخدام. وبالتالي ، فإن الملايين من مستخدمي لِينُكس يحبونه ويستخدمونه لاحتياجات التحرير الخاصة بهم.
في الوقت الحاضر ، تتوفر إصدارات متقدمة من المحرر vi ، وأكثرها شيوعًا هو VIM وهو Vi Improved.
 البعض الآخر هم Elvis و Nvi و Nano و Vile.
 من الحكمة أن تتعلم vi لأنه غني بالميزات ويوفر إمكانيات لا حصر لها لتحرير ملف.
للعمل على محرر VI ، شاهد الفيديو على قناتنا على اليوتيوب لشرح بسيط وعملي:
 
 
Related media
 
:This tutorial is also available in a quick video format
 
 
 
 
 

Author


 


Alaa Alswedan is Software engineer and Information Technology

SAP Technical Consultant bei Fujitsu

Nordheim, Baden-Württemberg, Germany

 
 
 
 
 
1 3609

التعليقات: