Erhalten Sie begonnen, den Herausgeber des Textes zu verwenden Vim

durch Sukrit Dhandhania auf 31. Dezember 2008

Linux Mac Windows

Vim ist eins der leistungsfähigsten und populärsten Befehl Linie Textherausgeber herum. Es war zuerst für das Linux und DIE UNIX-Plattformen nur vorhanden, aber wurde dann zu Windows auch getragen. Die Schnittstelle ist sauber und einfach, und Sie verwenden eine Kombination von Schlüsseln, um Aufgaben wie Kopiepaste, Suche durchzuführen und zu ersetzen, löschen Sie ein Bündel Linien und viel mehr.

Vim kommt pre-installed mit den meisten Verteilungen von Linux und auf Mac OS. Falls Sie es nicht haben oder es auf eine andere Plattform anbringen wünschen, können Sie den Installateur von erhalten?hier. Für Windows Benutzer müssen Sie gehen?hier?und downloaden Sie die neueste Freigabe von Vim. Downloaden Sie die Zip Datei für Ihre Version von Windows und extrahieren Sie sie. Lassen Sie dann den Installateur laufen. Die einzige Sache, die zwischen der Linux/Macversion von Vim und der Windows Version unterschiedlich ist, ist, daß die Windows Version in sein eigenes graphisches Fenster läuft. Lassen Sie uns seinen Verbrauch genau betrachten.

Bevor wir an den tatsächlichen Verbrauch von Vim gelangen, lassen Sie mich kurz Ihnen die zwei Modi erklären, denen Durchläufe Vim in - Befehl und Einsatz Modus. In Befehl Modus erteilen Sie Anweisungen zu Vim, etwas Maßnahmen, wie Löschung zu ergreifen eine Linie oder suchen nach einem Wort. Wenn Sie in sind Einsatz Modus was Sie schreiben, geht innen, wie Text in das Dokument, das Sie redigieren. Wenn Sie Produkteinführung Vim Sie in sind Befehl Modus. Zum Schalter zu Einsatz Modus schlug das `I' Schlüssel auf Ihrer Tastatur. Sie sehen eine Mitteilung am unteren Bildschirmrand nach links Ihr so:

- EINSATZ -

Dies heißt, daß Sie die Akte zu redigieren, jetzt anfangen können. Zum Schalter zurück zu Befehl Modus schlug gerade den Entweichenschlüssel. Sie finden, daß die „- EINSATZ -“ Mitteilung an der Unterseite verschwindet. Sie sind jetzt in Befehl Modus und kann Vim anweisen, um eine Linie zu löschen, oder die Akte zu speichern, oder was auch immer Sie mit dem Dokument tun wünschen können.

Eine vorhandene Akte oder ein a öffnen, um ein Neues mit Vim Gebrauch zu verursachen die folgende Syntax:

# vim helloworld.txt

Wenn Sie eine vorhandene Akte öffneten, sollten Sie seinen Inhalt oder eine Leerseite sehen, wenn Sie ein Neues verursachten. Jetzt, bevor wir mit dem Verwenden Vim fortfahren, lassen Sie uns sehen, wie man Vim herausnimmt. This is important because, unlike your standard graphical text editor, you cannot close the window to shut the application. To exit Vim and return to the command line you need to enter the following key combination:

ESC :q ENTER

In plain English the above command goes something like this, “Escape key, then a colon, followed immediately by a ‘q’, and then the Enter key to finish”. The “q” here stands for “quit”. What Vim does here is that it exits without saving any changes you may have made to the file. To save the file and quit add the ‘w’ or “write” option:

ESC :wq ENTER

You can also use the ‘w’ option without the ‘q’, if you just want to save the file while editing it and not quit Vim.

Now that we know how to get in an out of Vim let’s see how to use it. Let’s create a new document with Vim and begin writing:

# vim newdocument.txt

Now hit ‘i’ on your keyboard to get into the insert mode. Write a few lines of text in the file. Once you are done hit the Escape key to go into the command mode, and then “:wq” to save and exit the file. Now let’s see if the file was written correctly. Windows users can open the document we created using Notepad. If you are using Linux or a Mac run the following command to check out the contents of the file:

# cat newdocument.txt

You should see the contents of the file you just created. Now open the same file using Vim and let’s see what more Vim do do. Let’s delete a few words and lines. While in command mode navigate you cursor to he beginning of a word and hit the key combination “dw” followed by Enter. This should delete the word. Now let’s delete a whole line. Pick a line you want to delete and take the cursor to any location in that line and hit the key combination “dd” followed by Enter. Line deleted.

Sometimes you make a mistake that you want to undo, say you want to bring back the line you just deleted. To undo your last action go to the command mode and hit the key “u”. You can continue hitting “u” to undo more changes.

These commands will get you started with Vim. Practice what you learned here. I will return with more cool stuff such as finding and replacing words, searching a text, and more.

A quick recap of the commands you learned here:

1. Save file - “:w”
2. Quit file without saving - “:q”
3. Save and quit file - “:wq”
4. Go into insert mode - “i”
5. Go into command mode - ESC
6. Delete word - “dw”
7. Delete line - “dd”
8. Undo change - “u”

Related Posts:
  • How to edit iPhoto images using another application
  • How to use your Home folder as your Desktop in Ubuntu
  • Overview: CoolMon 2 - a Windows system monitoring utility
  • How to disable the balloon tips in Windows XP
  • How to edit the right-click context menus in Firefox
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

    You can always opt out of this email subscription at any time.


    Bookmark and Share

    { 1 comment… read it below or add one }

    1 James 12.31.08 at 12:04 pm

    Come on ! Is there someone who still use vi (& its clones) ? There’s hundred of editors out there who can ease much more the work for a writer…!!!

    Yeah, I know you can do more with Vi than any other editor, but believe me you still have to memorize a bunch of keyboard keys…

    Leave a Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>