# Vimhelp -- User Manual -- Chapter 12 -- Clever tricks # Copyright (C) 2006 Bram Moolenaar. # Florian 'eix' Rehnisch , 2008. # msgid "" msgstr "" "Project-Id-Version: vimhelp 7.2.000\n" "POT-Creation-Date: 2010-11-21 20:39+0100\n" "PO-Revision-Date: 2010-11-21 20:41+0100\n" "Last-Translator: Florian 'eix' Rehnisch \n" "Language-Team: German \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf8\n" "Content-Transfer-Encoding: 8bit\n" # type: Plain text #. type: Plain text #: usr_12.txt:2 #, no-wrap msgid "*usr_12.txt*\tFor Vim version 7.3. Last change: 2007 May 11\n" msgstr "*usr_12.txt*\tFür Vim Version 7.3. Letzte Änderung: 2007-Mai-11\n" # type: Plain text #. type: Plain text #: usr_12.txt:4 #, no-wrap msgid "\t\t VIM USER MANUAL - by Bram Moolenaar\n" msgstr "\t\t VIM BENUTZERHANDBUCH - von Bram Moolenaar\n" # type: Plain text #. type: Plain text #: usr_12.txt:6 #, no-wrap msgid "\t\t\t\tClever tricks\n" msgstr "\t\t\t\tKlevere Tricks\n" # type: Plain text #. type: Plain text #: usr_12.txt:11 msgid "" "By combining several commands you can make Vim do nearly everything. In " "this chapter a number of useful combinations will be presented. This uses " "the commands introduced in the previous chapters and a few more." msgstr "" "Durch das Kombinieren mehrerer Befehle können Sie Vim fast alles tun " "lassen. In diesem Kapitel werden ein Paar nützliche Kombinationen " "gezeigt. Diese benutzen die in den vorigen Kapiteln eingeführten Befehle " "und ein paar mehr." # type: Plain text #. type: Plain text #: usr_12.txt:20 msgid "" "|12.1|\tReplace a word |12.2|\tChange \"Last, First\" to \"First Last\" |" "12.3|\tSort a list |12.4|\tReverse line order |12.5|\tCount words |12.6|" "\tFind a man page |12.7|\tTrim blanks |12.8|\tFind where a word is used" msgstr "" "|12.1|\tEin Wort ersetzen\n" "|12.2|\t»Nachname, Vorname« in »Vorname Nachname« ändern\n" "|12.3|\tEine Liste sortieren\n" "|12.4|\tUmgekehrte Zeilenreihenfolge\n" "|12.5|\tWörter zählen\n" "|12.6|\tEine Man-Page finden\n" "|12.7|\tLeerzeichen abschneiden\n" "|12.8|\tHerausfinden, wo ein Wort benutzt wird" # type: Plain text #. type: Plain text #: usr_12.txt:24 #, no-wrap msgid "" " Next chapter: |usr_20.txt| Typing command-line commands quickly\n" " Previous chapter: |usr_11.txt| Recovering from a crash\n" "Table of contents: |usr_toc.txt|\n" msgstr "" "Nächstes Kapitel: |usr_20.txt| Befehle auf der Befehlszeile schnell " "tippen\n" " Voriges Kapitel: |usr_11.txt| Nach einem Absturz retten\n" "Inhaltsübersicht: |usr_toc.txt|\n" # type: Plain text #. type: Plain text #: usr_12.txt:25 usr_12.txt:90 usr_12.txt:131 usr_12.txt:177 usr_12.txt:202 #: usr_12.txt:231 usr_12.txt:281 usr_12.txt:309 usr_12.txt:354 #, no-wrap msgid "" "==============================================================================\n" msgstr "" "==============================================================================\n" # type: Plain text #. type: Plain text #: usr_12.txt:27 #, no-wrap msgid "*12.1*\tReplace a word\n" msgstr "*12.1*\tEin Wort ersetzen\n" # type: Plain text #. type: Plain text #: usr_12.txt:30 msgid "" "The substitute command can be used to replace all occurrences of a word " "with " "another word: >" msgstr "" "Der Ersetzungsbefehl »substitute« kann benutzt werden, um jedes Auftreten " "eines Wortes durch ein anderes Wort zu ersetzen: >" # type: Plain text #. type: Plain text #: usr_12.txt:32 #, no-wrap msgid "\t:%s/four/4/g\n" msgstr "\t:%s/four/4/g\n" # type: Plain text #. type: Plain text #: usr_12.txt:38 #, no-wrap msgid "" "The \"%\" range means to replace in all lines. The \"g\" flag at the end " "causes\n" "all words in a line to be replaced.\n" " This will not do the right thing if your file also contains " "\"thirtyfour\".\n" "It would be replaced with \"thirty4\". To avoid this, use the \"\\<\" item " "to\n" "match the start of a word: >\n" msgstr "" "Der Bereich »%« bedeutet, dass in allen Zeilen ersetzt werden soll. Das " "Flag\n" "»g« am Ende veranlasst, dass jedes Auftreten des Wortes in einer Zeile " "ersetzt\n" "wird.\n" " Dies tut nicht das Richtige, falls Ihre Datei auch »thirtyfour« " "enthält.\n" "Dies würde durch »thirty4« ersetzt. Benutzen Sie das Element »\\<«, " "das den\n" "Anfang eines Wortes sucht, um dies zu vermeiden: >\n" # type: Plain text #. type: Plain text #: usr_12.txt:40 #, no-wrap msgid "\t:%s/\\\" to match the " "end of a word: >" msgstr "" "Dies geht offensichtlich noch bei »fourteen« daneben. Benutzen Sie " "»\\>«, das ein Wortende sucht: >" # type: Plain text #. type: Plain text #: usr_12.txt:45 #, no-wrap msgid "\t:%s/\\/4/g\n" msgstr "\t:%s/\\/4/g\n" # type: Plain text #. type: Plain text #: usr_12.txt:49 msgid "" "If you are programming, you might want to replace \"four\" in comments, but " "not in the code. Since this is difficult to specify, add the \"c\" flag to " "have the substitute command prompt you for each replacement: >" msgstr "" "Falls Sie programmieren, mögen Sie »four« in Kommentaren ersetzen " "wollen, aber nicht im Kode. Da dies schwer zu formulieren ist, fügen Sie " "das Flag »c« hinzu, das den Befehl »substitute« Sie bei jeder Ersetzung " "fragen lässt: >" # type: Plain text #. type: Plain text #: usr_12.txt:52 #, no-wrap msgid "\t:%s/\\/4/gc\n" msgstr "\t:%s/\\/4/gc\n" # type: Plain text #. type: Plain text #: usr_12.txt:55 msgid "REPLACING IN SEVERAL FILES" msgstr "IN MEHREREN DATEIEN ERSETZEN" # type: Plain text #. type: Plain text #: usr_12.txt:61 #, no-wrap msgid "" "Suppose you want to replace a word in more than one file. You could edit " "each\n" "file and type the command manually. It's a lot faster to use record and\n" "playback.\n" " Let's assume you have a directory with C++ files, all ending in " "\".cpp\".\n" "There is a function called \"GetResp\" that you want to rename to " "\"GetAnswer\".\n" msgstr "" "Nehmen wir an, Sie wollen ein Wort in mehr als einer Datei ersetzen. Sie\n" "könnten jede Datei einzeln editieren und den Befehl manuell tippen. Es " "ist\n" "viel schneller die Aufnahme- und Abspiel-Funktion zu benutzen.\n" " Nehmen wir weiter an, Sie haben ein Verzeichnis mit C++-Dateien, die " "alle\n" "auf .cpp enden. Es gibt eine Funktion »GetResp«, die Sie in " "»GetAnswer«\n" "umbenennen wollen.\n" # type: Plain text #. type: Plain text #: usr_12.txt:74 #, no-wrap msgid "" "\tvim *.cpp\t\tStart Vim, defining the argument list to\n" "\t\t\t\tcontain all the C++ files. You are now in the\n" "\t\t\t\tfirst file.\n" "\tqq\t\t\tStart recording into the q register\n" "\t:%s/\\/GetAnswer/g\n" "\t\t\t\tDo the replacements in the first file.\n" "\t:wnext\t\t\tWrite this file and move to the next one.\n" "\tq\t\t\tStop recording.\n" "\t@q\t\t\tExecute the q register. This will replay the\n" "\t\t\t\tsubstitution and \":wnext\". You can verify\n" "\t\t\t\tthat this doesn't produce an error message.\n" "\t999@q\t\t\tExecute the q register on the remaining files.\n" msgstr "" "\tvim *.cpp\t\tStarte Vim und definiere, dass alle C++-\n" "\t\t\t\tDateien in der Argumentenliste sind.\n" "\tqq\t\t\tStarte die Aufnahme in das Register »q«\n" "\t:%s/\\/GetAnswer/g\n" "\t\t\t\tMache die Ersetzungen in der ersten Datei.\n" "\t:wnext\t\t\tSchreibe diese Datei und gehe zur nächsten.\n" "\tq\t\t\tBeende die Aufnahme.\n" "\t@q\t\t\tFühre das Register »q« aus. Dies spielt den\n" "\t\t\t\tSubstitutionsbefehl und das »:wnext« ab. Sie\n" "\t\t\t\tkönnen sicherstellen, dass dies keine\n" "\t\t\t\tFehlermeldung ausgibt.\n" "\t999q\t\t\tFühre das Register »q« für die übrigen Dateien\n" "\t\t\t\taus.\n" # type: Plain text #. type: Plain text #: usr_12.txt:77 msgid "" "At the last file you will get an error message, because \":wnext\" cannot " "move to the next file. This stops the execution, and everything is done." msgstr "" "Bei der letzten Datei bekommen Sie eine Fehlermeldung, weil »:wnext« " "nicht zur nächsten Datei gehen kann. Dies beendet die Ausführung und " "alles ist erledigt." # type: Plain text #. type: Plain text #: usr_12.txt:81 #, no-wrap msgid "" "\tNote:\n" "\tWhen playing back a recorded sequence, an error stops the execution.\n" "\tTherefore, make sure you don't get an error message when recording.\n" msgstr "" "\tAnmerkung:\n" "\tBeim Abspielen einer aufgezeichneten Sequenz beendet ein Fehler die\n" "\tAusführung. Stellen Sie deshalb beim Aufzeichnen sicher, dass Sie\n" "\tkeine Fehlermeldung bekommen.\n" # type: Plain text #. type: Plain text #: usr_12.txt:85 msgid "" "There is one catch: If one of the .cpp files does not contain the word " "\"GetResp\", you will get an error and replacing will stop. To avoid this, " "add the \"e\" flag to the substitute command: >" msgstr "" "Es gibt einen Haken: Falls eine der .cpp-Dateien das Wort »GetResp« nicht " "enthält, erhalten Sie einen Fehler und das Ersetzen hält an. Um dies zu " "vermeiden, fügen Sie dem Befehl »substitute« das Flag »e« hinzu: >" # type: Plain text #. type: Plain text #: usr_12.txt:87 #, no-wrap msgid "\t:%s/\\/GetAnswer/ge\n" msgstr "\t:%s/\\/GetAnswer/ge\n" # type: Plain text #. type: Plain text #: usr_12.txt:89 msgid "" "The \"e\" flag tells \":substitute\" that not finding a match is not an " "error." msgstr "" "Das Flag »e« sagt »:substitute«, dass das Finden keiner " "Übereinstimmung kein Fehler ist." # type: Plain text #. type: Plain text #: usr_12.txt:92 #, no-wrap msgid "*12.2*\tChange \"Last, First\" to \"First Last\"\n" msgstr "*12.2*\t»Nachname, Vorname« in »Vorname Nachname« ändern\n" # type: Plain text #. type: Plain text #: usr_12.txt:94 msgid "You have a list of names in this form:" msgstr "Sie haben eine Namensliste dieser Form:" # type: Plain text #. type: Plain text #: usr_12.txt:97 #, no-wrap msgid "" "\tDoe, John ~\n" "\tSmith, Peter ~\n" msgstr "" "\tDoe, John ~\n" "\tSmith, Peter ~\n" # type: Plain text #. type: Plain text #: usr_12.txt:99 msgid "You want to change that to:" msgstr "Diese wollen Sie wie folgt ändern:" # type: Plain text #. type: Plain text #: usr_12.txt:102 #, no-wrap msgid "" "\tJohn Doe ~\n" "\tPeter Smith ~\n" msgstr "" "\tJohn Doe ~\n" "\tPeter Smith ~\n" # type: Plain text #. type: Plain text #: usr_12.txt:104 msgid "This can be done with just one command: >" msgstr "Dies geht mit nur einem Befehl: >" # type: Plain text #. type: Plain text #: usr_12.txt:106 #, no-wrap msgid "\t:%s/\\([^,]*\\), \\(.*\\)/\\2 \\1/\n" msgstr "\t:%s/\\([^,]*\\), \\(.*\\)/\\2 \\1/\n" # type: Plain text #. type: Plain text #: usr_12.txt:114 #, no-wrap msgid "" "Let's break this down in parts. Obviously it starts with a substitute\n" "command. The \"%\" is the line range, which stands for the whole file. " "Thus\n" "the substitution is done in every line in the file.\n" " The arguments for the substitute command are \"/from/to/\". The " "slashes\n" "separate the \"from\" pattern and the \"to\" string. This is what the " "\"from\"\n" "pattern contains:\n" "\t\t\t\t\t\t\t\\([^,]*\\), \\(.*\\) ~\n" msgstr "" "Lassen Sie uns dies Stück für Stück betrachten. Offensichtlich beginnt " "es mit\n" "dem Befehl »substitute«. »%« ist der Bereich, was für die ganze Datei " "steht.\n" "Also geschieht die Ersetzung in jeder Zeile der Datei.\n" " Die Argumente des Befehls »substitute« sind »/von/nach/«. Die\n" "Schrägstriche trennen das Muster »von« und die Zeichenkette »nach«. " "Dies\n" "enthält das Muster »von«:\n" "\t\t\t\t\t\t\t \\([^,]*\\), \\(.*\\) ~\n" # type: Plain text #. type: Plain text #: usr_12.txt:122 #, no-wrap msgid "" "\tThe first part between \\( \\) matches \"Last\"\t\\( \\)\n" "\t match anything but a comma\t\t\t [^,]\n" "\t any number of times\t\t\t\t *\n" "\tmatches \", \" literally\t\t\t\t\t ,\n" "\tThe second part between \\( \\) matches \"First\"\t\t \\( \\)\n" "\t any character\t\t\t\t\t .\n" "\t any number of times\t\t\t\t\t *\n" msgstr "" "\tDer erste Teil zwischen \\(...\\) trifft »Nachname« \\( \\)\n" "\t treffe alles außer einem Komma\t\t [^,]\n" "\t jegliche Anzahl\t\t\t\t\t *\n" "\ttrifft genau das Zeichen »,«\t\t\t\t ,\n" "\tDer zweite Teil zwischen \\(...\\) trifft »Vorname«\t \\( \\)\n" "\t jegliches Zeichen\t\t\t\t\t\t.\n" "\t jegliche Anzahl\t\t\t\t\t\t *\n" # type: Plain text #. type: Plain text #: usr_12.txt:130 #, no-wrap msgid "" "In the \"to\" part we have \"\\2\" and \"\\1\". These are called " "backreferences.\n" "They refer to the text matched by the \"\\( \\)\" parts in the pattern. " "\"\\2\"\n" "refers to the text matched by the second \"\\( \\)\", which is the " "\"First\" name.\n" "\"\\1\" refers to the first \"\\( \\)\", which is the \"Last\" name.\n" " You can use up to nine backreferences in the \"to\" part of a " "substitute\n" "command. \"\\0\" stands for the whole matched pattern. There are a few " "more\n" "special items in a substitute command, see |sub-replace-special|.\n" msgstr "" "In dem Teil »nach« haben wir »\\2« und »\\1«. Dies sind sogenannte\n" "Rückreferenzen (backreference). Sie referenzieren den Text, der im " "Suchmuster\n" "zwischen den \\(...\\) gefunden wurde. »\\2« referenziert den Text, der " "von dem\n" "zweiten \\(...\\) gefunden wurde, was der Vorname ist. »\\1« " "referenziert das\n" "erste Paar \\(...\\), das dem Nachnamen entspricht.\n" " Sie können bis zu neun Rückreferenzen im »nach«-Teil eines\n" "Ersetzungsbefehls benutzen. »\\0« steht für das ganze getroffene " "Muster. Der\n" "Befehl »substitute« kennt ein Paar besondere Elemente mehr, siehe\n" "|sub-replace-special|.\n" # type: Plain text #. type: Plain text #: usr_12.txt:133 #, no-wrap msgid "*12.3*\tSort a list\n" msgstr "*12.3*\tEine Liste sortieren\n" # type: Plain text #. type: Plain text #: usr_12.txt:135 msgid "In a Makefile you often have a list of files. For example:" msgstr "" "In einem Makefile haben Sie häufig eine Liste von Dateien. Zum Beispiel:" # type: Plain text #. type: Plain text #: usr_12.txt:145 #, no-wrap msgid "" "\tOBJS = \\ ~\n" "\t\tversion.o \\ ~\n" "\t\tpch.o \\ ~\n" "\t\tgetopt.o \\ ~\n" "\t\tutil.o \\ ~\n" "\t\tgetopt1.o \\ ~\n" "\t\tinp.o \\ ~\n" "\t\tpatch.o \\ ~\n" "\t\tbackup.o ~\n" msgstr "" "\tOBJS = \\ ~\n" "\t\tversion.o \\ ~\n" "\t\tpch.o \\ ~\n" "\t\tgetopt.o \\ ~\n" "\t\tutil.o \\ ~\n" "\t\tgetopt1.o \\ ~\n" "\t\tinp.o \\ ~\n" "\t\tpatch.o \\ ~\n" "\t\tbackup.o ~\n" # type: Plain text #. type: Plain text #: usr_12.txt:147 msgid "" "To sort this list, filter the text through the external sort command: >" msgstr "" "Um diese Liste zu sortieren, filtern Sie den Text durch den externen Befehl " "»sort«: >" # type: Plain text #. type: Plain text #: usr_12.txt:151 #, no-wrap msgid "" "\t/^OBJS\n" "\tj\n" "\t:.,/^$/-1!sort\n" msgstr "" "\t/^OBJS\n" "\tj\n" "\t:.,/^$/-1!sort\n" # type: Plain text #. type: Plain text #: usr_12.txt:157 #, no-wrap msgid "" "This goes to the first line, where \"OBJS\" is the first thing in the " "line.\n" "Then it goes one line down and filters the lines until the next empty " "line.\n" "You could also select the lines in Visual mode and then use \"!sort\". " "That's\n" "easier to type, but more work when there are many lines.\n" " The result is this:\n" msgstr "" "Wir gehen hier in die erste Zeile, an deren Anfang »OBJS« steht. Dann " "gehen\n" "wir eine Zeile nach unten und filtern die Zeilen bis zur nächsten leeren " "Zeile.\n" "Wir könnten die Zeilen auch im visuellen Modus auswählen und dann " "»!sort«\n" "benutzen. Das ist einfacher zu tippen, aber mehr Arbeit bei vielen Zeilen\n" " Dies ist das Ergebnis:\n" # type: Plain text #. type: Plain text #: usr_12.txt:167 #, no-wrap msgid "" "\tOBJS = \\ ~\n" "\t\tbackup.o ~\n" "\t\tgetopt.o \\ ~\n" "\t\tgetopt1.o \\ ~\n" "\t\tinp.o \\ ~\n" "\t\tpatch.o \\ ~\n" "\t\tpch.o \\ ~\n" "\t\tutil.o \\ ~\n" "\t\tversion.o \\ ~\n" msgstr "" "\tOBJS = \\ ~\n" "\t\tbackup.o ~\n" "\t\tgetopt.o \\ ~\n" "\t\tgetopt1.o \\ ~\n" "\t\tinp.o \\ ~\n" "\t\tpatch.o \\ ~\n" "\t\tpch.o \\ ~\n" "\t\tutil.o \\ ~\n" "\t\tversion.o \\ ~\n" # type: Plain text #. type: Plain text #: usr_12.txt:176 #, no-wrap msgid "" "Notice that a backslash at the end of each line is used to indicate the " "line\n" "continues. After sorting, this is wrong! The \"backup.o\" line that was " "at\n" "the end didn't have a backslash. Now that it sorts to another place, it\n" "must have a backslash.\n" " The simplest solution is to add the backslash with \"A \\\". You " "can\n" "keep the backslash in the last line, if you make sure an empty line comes\n" "after it. That way you don't have this problem again.\n" msgstr "" "Beachten Sie, dass der Backslash am Ende jeder Zeile angibt, dass die " "Zeile\n" "logisch weitergeht. Nach dem Sortieren ist dies falsch! Die Zeile mit\n" "»backup.o«, die die letzte war, hat keinen Backslash. Nun ist sie an " "anderer\n" "Stelle und muss einen Backslash haben.\n" " Die einfachste Lösung ist, den Backslash mit »A \\« " "hinzuzufügen. Sie\n" "können den Backslash in der letzten Zeile stehenlassen, falls Sie\n" "sicherstellen, dass danach eine leere Zeile kommt. So haben Sie dieses\n" "Problem nicht noch einmal.\n" # type: Plain text #. type: Plain text #: usr_12.txt:179 #, no-wrap msgid "*12.4*\tReverse line order\n" msgstr "*12.4*\tUmgekehrte Zeilenreihenfolge\n" # type: Plain text #. type: Plain text #: usr_12.txt:182 msgid "" "The |:global| command can be combined with the |:move| command to move all " "the lines before the first line, resulting in a reversed file. The command " "is: >" msgstr "" "Der Befehl |:global| kann mit dem Befehl |:move| kombiniert werden, um alle " "Zeilen vor die erste zu verschieben, was eine umgedrehte Datei zum Ergebnis " "hat. Der Befehl ist: >" # type: Plain text #. type: Plain text #: usr_12.txt:184 #, no-wrap msgid "\t:global/^/m 0\n" msgstr "\t:global/^/m 0\n" # type: Plain text #. type: Plain text #: usr_12.txt:186 msgid "Abbreviated: >" msgstr "Abgekürzt: >" # type: Plain text #. type: Plain text #: usr_12.txt:188 #, no-wrap msgid "\t:g/^/m 0\n" msgstr "\t:g/^/m 0\n" # type: Plain text #. type: Plain text #: usr_12.txt:195 msgid "" "The \"^\" regular expression matches the beginning of the line (even if the " "line is blank). The |:move| command moves the matching line to after the " "mythical zeroth line, so the current matching line becomes the first line " "of " "the file. As the |:global| command is not confused by the changing line " "numbering, |:global| proceeds to match all remaining lines of the file and " "puts each as the first." msgstr "" "Der reguläre Ausdruck »^« trifft den Anfang der Zeile (selbst wenn die " "Zeile leer ist). Der Befehl |:move| schiebt die getroffene Zeile hinter " "die mystische nullte Zeile, so dass die aktuell getroffene Zeile die erste " "Zeile der Datei wird. Da der Befehl |:global| nicht durch die sich " "ändernde Zeilenreihenfolge verwirrt wird, macht er damit weiter, jede " "verbleibende Zeile der Datei zu treffen und sie an erster Stelle zu setzen." # type: Plain text #. type: Plain text #: usr_12.txt:199 msgid "" "This also works on a range of lines. First move to above the first line " "and " "mark it with \"mt\". Then move the cursor to the last line in the range " "and " "type: >" msgstr "" "Dies funktioniert auch mit einem Zeilenbereich. Gehen Sie zuerst eine " "über die erste Zeilen und markieren Sie sie mit »mt«. Dann gehen Sie " "zur letzten Zeile in dem Bereich und tippen: >" # type: Plain text #. type: Plain text #: usr_12.txt:201 #, no-wrap msgid "\t:'t+1,.g/^/m 't\n" msgstr "\t:'t+1,.g/^/m 't\n" # type: Plain text #. type: Plain text #: usr_12.txt:204 #, no-wrap msgid "*12.5*\tCount words\n" msgstr "*12.5*\tWörter zählen\n" # type: Plain text #. type: Plain text #: usr_12.txt:209 #, no-wrap msgid "" "Sometimes you have to write a text with a maximum number of words. Vim " "can\n" "count the words for you.\n" " When the whole file is what you want to count the words in, use this\n" "command: >\n" msgstr "" "Manchmal müssen Sie einen Text mit einer Höchstanzahl von Wörtern " "schreiben.\n" "Vim kann die Wörter für Sie zählen.\n" " Wenn Sie alle Wörter in der Datei zählen wollen, benutzen Sie diesen\n" "Befehl: >\n" # type: Plain text #. type: Plain text #: usr_12.txt:211 #, no-wrap msgid "\tg CTRL-G\n" msgstr "\tg CTRL-G\n" # type: Plain text #. type: Plain text #: usr_12.txt:215 #, no-wrap msgid "" "Do not type a space after the g, this is just used here to make the " "command\n" "easy to read.\n" " The output looks like this:\n" msgstr "" "Tippen Sie kein Leerzeichen nach dem g, dies wird hier nur benutzt, damit " "der\n" "Befehl leichter zu lesen ist.\n" " Die Ausgabe sieht ungefähr so aus:\n" # type: Plain text #. type: Plain text #: usr_12.txt:217 #, no-wrap msgid "\tCol 1 of 0; Line 141 of 157; Word 748 of 774; Byte 4489 of 4976 ~\n" msgstr "" "\tSp 1 von 0; Zeile 141 von 157; Wort 748 von 774; Byte 4489 von 4976 ~\n" # type: Plain text #. type: Plain text #: usr_12.txt:220 msgid "" "You can see on which word you are (748), and the total number of words in " "the file (774)." msgstr "" "Sie sehen auf welchem Wort Sie sich befinden (748) und die Gesamtanzahl der " "Wörter in der Datei (774)." # type: Plain text #. type: Plain text #: usr_12.txt:226 msgid "" "When the text is only part of a file, you could move to the start of the " "text, type \"g CTRL-G\", move to the end of the text, type \"g CTRL-G\" " "again, and then use your brain to compute the difference in the word " "position. That's a good exercise, but there is an easier way. With Visual " "mode, select the text you want to count words in. Then type g CTRL-G. The " "result:" msgstr "" "Wenn der Text nur ein Teil einer Datei ist, könnten Sie zum Beginn des " "Textes gegen, »g CTRL-G« tippen, zum Ende des Textes gehen, nochmals »g " "CTRL-G« tippen, und dann Ihr Hirn benutzen, um die Textlänge aus dem " "Unterschied der Positionen zu berechnen. Eine gute Übung, aber es gibt " "einen einfacheren Weg. Wählen Sie den Text, in dem Sie die Wörter " "zählen möchten, im visuellen Modus aus. Dann tippen Sie »g CTRL-G«. " "Das Ergebnis:" # type: Plain text #. type: Plain text #: usr_12.txt:228 #, no-wrap msgid "\tSelected 5 of 293 Lines; 70 of 1884 Words; 359 of 10928 Bytes ~\n" msgstr "\t5 von 293 Zeilen; 70 von 1884 Wörtern; 359 von 10928 Bytes ~\n" # type: Plain text #. type: Plain text #: usr_12.txt:230 msgid "" "For other ways to count words, lines and other items, see |count-items|." msgstr "" "Für andere Möglichkeiten, Wörter, Zeilen und andere Elemente zu zählen, " "siehe |count-items|." # type: Plain text #. type: Plain text #: usr_12.txt:233 #, no-wrap msgid "*12.6*\tFind a man page\t\t\t\t\t*find-manpage*\n" msgstr "*12.6*\tEine Man-Page finden\t\t\t\t*find-manpage*\n" # type: Plain text #. type: Plain text #: usr_12.txt:237 msgid "" "While editing a shell script or C program, you are using a command or " "function that you want to find the man page for (this is on Unix). Let's " "first use a simple way: Move the cursor to the word you want to find help " "on " "and press >" msgstr "" "Während Sie ein Shell-Skript oder C-Programm editieren, benutzen Sie einen " "Befehl oder eine Funktion, für die Sie die Man-Page finden wollen (unter " "Unix). Lassen Sie uns erst den einfachen Weg gehen: Bewegen Sie den Cursor " "auf das Wort, für das Sie Hilfe finden wollen, und drücken Sie >" # type: Plain text #. type: Plain text #: usr_12.txt:239 #, no-wrap msgid "\tK\n" msgstr "\tK\n" # type: Plain text #. type: Plain text #: usr_12.txt:244 msgid "" "Vim will run the external \"man\" program on the word. If the man page is " "found, it is displayed. This uses the normal pager to scroll through the " "text (mostly the \"more\" program). When you get to the end pressing " " will get you back into Vim." msgstr "" "Vim startet das externe Programm »man« mit diesem Wort als Argument. " "Wenn die Man-Page gefunden wird, wird sie angezeigt. Dies benutzt den " "normalen Pager, um durch den Text zu gehen (meistens das Programm »more«. " " Wenn Sie an das Ende kommen, bringt Sie ein Druck auf zurück nach " "Vim." # type: Plain text #. type: Plain text #: usr_12.txt:248 msgid "" "A disadvantage is that you can't see the man page and the text you are " "working on at the same time. There is a trick to make the man page appear " "in a Vim window. First, load the man filetype plugin: >" msgstr "" "Ein Nachteil ist, dass Sie nicht zur gleichen Zeit die Man-Page und den " "Text, an dem Sie arbeiten, sehen können. Es gibt einen Trick, um die " "Man-Page in einem Vim-Fenster erscheinen zu lassen. Laden Sie zunächst " "das Dateityp-Plugin man: >" # type: Plain text #. type: Plain text #: usr_12.txt:250 #, no-wrap msgid "\t:runtime! ftplugin/man.vim\n" msgstr "\t:runtime! ftplugin/man.vim\n" # type: Plain text #. type: Plain text #: usr_12.txt:253 msgid "" "Put this command in your vimrc file if you intend to do this often. Now " "you " "can use the \":Man\" command to open a window on a man page: >" msgstr "" "Setzen Sie diesen Befehl in Ihre vimrc, falls Sie vorhaben, dies häufiger " "zu tun. Nun können Sie den Befehl »:Man« benutzen, um ein Fenster mit " "einer Man-Page zu öffnen: >" # type: Plain text #. type: Plain text #: usr_12.txt:255 #, no-wrap msgid "\t:Man csh\n" msgstr "\t:Man csh\n" # type: Plain text #. type: Plain text #: usr_12.txt:261 #, no-wrap msgid "" "You can scroll around and the text is highlighted. This allows you to " "find\n" "the help you were looking for. Use CTRL-W w to jump to the window with " "the\n" "text you were working on.\n" " To find a man page in a specific section, put the section number first.\n" "For example, to look in section 3 for \"echo\": >\n" msgstr "" "Sie können umherrollen und der Text wird hervorgehoben. Dies erlaubt " "Ihnen,\n" "die Hilfe zu finden, nach der Sie suchen. Benutzen Sie CTRL-W w, um in " "das\n" "Fenster mit dem Text, an dem Sie arbeiten, zu springen.\n" " Um eine Man-Page in einem bestimmten Abschnitt zu finden, stellen Sie " "die\n" "Nummer des Abschnitts voran. Um zum Beispiel in Abschnitt 3 »echo«\n" "nachzuschlagen: >\n" # type: Plain text #. type: Plain text #: usr_12.txt:263 #, no-wrap msgid "\t:Man 3 echo\n" msgstr "\t:Man 3 echo\n" # type: Plain text #. type: Plain text #: usr_12.txt:267 msgid "" "To jump to another man page, which is in the text with the typical form " "\"word(1)\", press CTRL-] on it. Further \":Man\" commands will use the " "same window." msgstr "" "Um auf eine andere Man-Page zu springen, die im Text typischerweise wie " "»word(1)« angegeben ist, drücken Sie darauf CTRL-]. Weitere " "»:Man«-Anweisungen benutzen dasselbe Fenster." # type: Plain text #. type: Plain text #: usr_12.txt:269 msgid "To display a man page for the word under the cursor, use this: >" msgstr "" "Um eine Man-Page für das Wort unter dem Cursor anzuzeigen, benutzen Sie " "dies: >" # type: Plain text #. type: Plain text #: usr_12.txt:271 #, no-wrap msgid "\t\\K\n" msgstr "\t\\K\n" # type: Plain text #. type: Plain text #: usr_12.txt:275 msgid "" "(If you redefined the , use it instead of the backslash). For " "example, you want to know the return value of \"strstr()\" while editing " "this line:" msgstr "" "(Falls Sie umdefiniert haben, benutzen Sie dies statt des " "Backslash. Sie wollen zum Beispiel den Rückgabewert von »strstr()« " "wissen, während Sie diese Zeile editieren:" # type: Plain text #. type: Plain text #: usr_12.txt:277 #, no-wrap msgid "\tif ( strstr (input, \"aap\") == ) ~\n" msgstr "\tif ( strstr (input, \"aap\") == ) ~\n" # type: Plain text #. type: Plain text #: usr_12.txt:280 msgid "" "Move the cursor to somewhere on \"strstr\" and type \"\\K\". A window will " "open to display the man page for strstr()." msgstr "" "Bewegen Sie den Cursor auf »strstr« und tippen Sie »\\K«. Ein Fenster " "öffnet sich, um die Manpage für strstr() anzuzeigen." # type: Plain text #. type: Plain text #: usr_12.txt:283 #, no-wrap msgid "*12.7*\tTrim blanks\n" msgstr "*12.7*\tLeerzeichen abschneiden\n" # type: Plain text #. type: Plain text #: usr_12.txt:287 msgid "" "Some people find spaces and tabs at the end of a line useless, wasteful, " "and " "ugly. To remove whitespace at the end of every line, execute the following " "command: >" msgstr "" "Manche Leute finden Leerzeichen und Tabulatoren am Zeilenende nutzlos, " "verschwenderisch und hässlich. Um den Leerraum am Ende jeder Zeile zu " "entfernen, führen Sie den folgenden Befehl aus: >" # type: Plain text #. type: Plain text #: usr_12.txt:289 #, no-wrap msgid "\t:%s/\\s\\+$//\n" msgstr "\t:%s/\\s\\+$//\n" # type: Plain text #. type: Plain text #: usr_12.txt:296 #, no-wrap msgid "" "The line range \"%\" is used, thus this works on the whole file. The " "pattern\n" "that the \":substitute\" command matches with is \"\\s\\+$\". This finds " "white\n" "space characters (\\s), 1 or more of them (\\+), before the end-of-line " "($).\n" "Later will be explained how you write patterns like this |usr_27.txt|.\n" " The \"to\" part of the substitute command is empty: \"//\". Thus it " "replaces\n" "with nothing, effectively deleting the matched white space.\n" msgstr "" "Als Zeilenbereich wird »%« benutzt, also arbeitet dies auf der ganzen\n" "Datei. Das Muster, das der Befehl »:substitute« sucht, ist »\\s\\+$«. " "Dies\n" "findet Leerraumzeichen (\\s), eines oder mehrere (\\+), direkt vor dem\n" "Zeilenende ($). Später in |usr_27.txt| wird erklärt, wie Sie Muster wie\n" "dieses schreiben.\n" " Der Teil »nach« des Ersetzungsbefehls ist leer: »//«. Also ersetzt " "er mit\n" "nichts, effektive löscht dies den gefundenen Leerraum.\n" # type: Plain text #. type: Plain text #: usr_12.txt:300 msgid "" "Another wasteful use of spaces is placing them before a tab. Often these " "can be deleted without changing the amount of white space. But not always! " "Therefore, you can best do this manually. Use this search command: >" msgstr "" "Ein anderer verschwenderischer Gebrauch von Leerzeichen ist, sie vor einen " "Tabulator zu setzen. Oft können diese gelöscht werden, ohne den Anteil " "von Leerraum zu verändern. Aber nicht immer! Daher machen Sie dies am " "Besten von Hand. Benutzen Sie diesen Suchbefehl: >" # type: Plain text #. type: Plain text #: usr_12.txt:302 #, no-wrap msgid "\t/ \t\n" msgstr "\t/ \t\n" # type: Plain text #. type: Plain text #: usr_12.txt:308 #, no-wrap msgid "" "You cannot see it, but there is a space before a tab in this command. " "Thus\n" "it's \"/\". Now use \"x\" to delete the space and check that " "the\n" "amount of white space doesn't change. You might have to insert a tab if " "it\n" "does change. Type \"n\" to find the next match. Repeat this until no " "more\n" "matches can be found.\n" msgstr "" "Sie können es nicht sehen, aber in diesem Befehl ist ein Leerzeichen vor " "einem\n" "Tabulator. Also »/«. Nun benutzen Sie »x«, um " "das\n" "Leerzeichen zu löschen, und überprüfen, dass sich der Anteil an Leerraum " "nicht\n" "ändert. Sie mögen einen Tabulator einfügen müssen, falls er sich " "ändert.\n" "Tippen Sie »n«, um den nächsten Treffer zu finden. Wiederholen Sie " "dies, bis\n" "keine Treffer mehr gefunden werden können.\n" # type: Plain text #. type: Plain text #: usr_12.txt:311 #, no-wrap msgid "*12.8*\tFind where a word is used\n" msgstr "*12.8*\tHerausfinden, wo ein Wort benutzt wird\n" # type: Plain text #. type: Plain text #: usr_12.txt:318 #, no-wrap msgid "" "If you are a UNIX user, you can use a combination of Vim and the grep " "command\n" "to edit all the files that contain a given word. This is extremely useful " "if\n" "you are working on a program and want to view or edit all the files that\n" "contain a specific variable.\n" " For example, suppose you want to edit all the C program files that " "contain\n" "the word \"frame_counter\". To do this you use the command: >\n" msgstr "" "Falls Sie ein Unix-Benutzer sind, können Sie eine Kombination von Vim und " "dem\n" "Befehl »grep« benutzen, um alle Dateien zu editieren, die ein gegebenes " "Wort\n" "enthalten. Dies ist extrem nützlich, falls Sie an einem Programm arbeiten " "und\n" "alle Dateien betrachten oder editieren wollen, die eine bestimmte Variable\n" "enthalten.\n" " Nehmen Sie zum Beispiel an, Sie wollen alle Dateien eines C-Programms\n" "editieren, die das Wort »frame_counter« enthalten. Um das zu tun, " "benutzen\n" "Sie diesen Befehl: >\n" # type: Plain text #. type: Plain text #: usr_12.txt:320 #, no-wrap msgid "\tvim `grep -l frame_counter *.c`\n" msgstr "\tvim `grep -l frame_counter *.c`\n" # type: Plain text #. type: Plain text #: usr_12.txt:333 #, no-wrap msgid "" "Let's look at this command in detail. The grep command searches through a " "set\n" "of files for a given word. Because the -l argument is specified, the " "command\n" "will only list the files containing the word and not print the matching " "lines.\n" "The word it is searching for is \"frame_counter\". Actually, this can be " "any\n" "regular expression. (Note: What grep uses for regular expressions is not\n" "exactly the same as what Vim uses.)\n" " The entire command is enclosed in backticks (`). This tells the UNIX " "shell\n" "to run this command and pretend that the results were typed on the command\n" "line. So what happens is that the grep command is run and produces a list " "of\n" "files, these files are put on the Vim command line. This results in Vim\n" "editing the file list that is the output of grep. You can then use " "commands\n" "like \":next\" and \":first\" to browse through the files.\n" msgstr "" "Schauen wir uns diesen Befehl im Detail an. Der Befehl »grep« sucht in " "einer\n" "Menge von Dateien nach einem gegebenen Wort. Weil das Argument »-l« " "angegeben\n" "ist, listet der Befehl nur die Dateien, die das Wort enthalten und gibt " "nicht\n" "die gefundenen Zeilen aus. Das gesuchte Wort ist »frame_counter«. Dies " "kann\n" "in Wirklichkeit jeder reguläre Ausdruck sein. (Anmerkung: die " "regulären\n" "Ausdrücke, die grep benutzt, sind nicht genau dieselben wie in Vim.)\n" " Der gesamte Befehl ist in sogenannte Backticks (`) eingeschlossen. " "Dies\n" "sagt der Unix-Shell, dass sie diesen Befehl ausführen und so tun soll, " "als\n" "wäre die Ausgabe in die Befehlszeile getippt. Dies führt dazu, dass Vim " "die\n" "Liste der Dateien editiert, die »grep« ausgeben hat. Dann können Sie " "Befehle\n" "wie »:next« und »:first« benutzen, um durch die Dateien zu gehen.\n" # type: Plain text #. type: Plain text #: usr_12.txt:336 msgid "FINDING EACH LINE" msgstr "JEDE ZEILE FINDEN" # type: Plain text #. type: Plain text #: usr_12.txt:342 #, no-wrap msgid "" "The above command only finds the files in which the word is found. You " "still\n" "have to find the word within the files.\n" " Vim has a built-in command that you can use to search a set of files for " "a\n" "given string. If you want to find all occurrences of \"error_string\" in " "all C\n" "program files, for example, enter the following command: >\n" msgstr "" "Der obige Befehl findet nur die Dateien, in denen das Wort gefunden wird. " "Sie\n" "müssen immer noch das Wort in den Dateien finden.\n" " Vim hat einen eingebauten Befehl, den Sie benutzen können, um eine " "Menge\n" "von Dateien nach einer gegebenen Zeichenkette zu durchsuchen. Falls Sie " "zum\n" "Beispiel alle Vorkommen von »error_string« in allen Dateien eines " "C-Programms\n" "finden wollen, geben Sie den folgenden Befehl ein: >\n" # type: Plain text #. type: Plain text #: usr_12.txt:344 #, no-wrap msgid "\t:grep error_string *.c\n" msgstr "\t:grep error_string *.c\n" # type: Plain text #. type: Plain text #: usr_12.txt:353 #, no-wrap msgid "" "This causes Vim to search for the string \"error_string\" in all the " "specified\n" "files (*.c). The editor will now open the first file where a match is " "found\n" "and position the cursor on the first matching line. To go to the next\n" "matching line (no matter in what file it is), use the \":cnext\" command. " "To go\n" "to the previous match, use the \":cprev\" command. Use \":clist\" to see " "all the\n" "matches and where they are.\n" " The \":grep\" command uses the external commands grep (on Unix) or " "findstr\n" "(on Windows). You can change this by setting the option 'grepprg'.\n" msgstr "" "Dies lässt Vim die Zeichenkette »error_string« in allen angegebenen " "Dateien\n" "(*.c) suchen. Der Editor öffnet nun die erste Datei, in der eine\n" "Übereinstimmung gefunden wird, und positioniert den Cursor auf der ersten\n" "passenden Zeile. Um zu der nächsten passenden Zeile zu gehen (egal in " "welcher\n" "Datei), benutzen Sie den Befehl »:cnext«. Um zur vorigen " "Übereinstimmung zu\n" "gehen, benutzen Sie den Befehl »:cprev«. Benutzen Sie »:clist«, um " "alle\n" "Übereinstimmungen zu sehen, und wo sie sind.\n" " Der Befehl »:grep« benutzt die externen Befehle »grep« (unter Unix) " "oder\n" "»findstr« (unter Windows). Sie können dies ändern, indem Sie die " "Option\n" "'grepprg' setzen.\n" # type: Plain text #. type: Plain text #: usr_12.txt:357 msgid "Next chapter: |usr_20.txt| Typing command-line commands quickly" msgstr "" "Nächstes Kapitel: |usr_20.txt| Befehle auf der Befehlszeile schnell tippen" # type: Plain text #. type: Plain text #: usr_12.txt:358 msgid "Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl:" msgstr "Copyrigt: siehe |manual-copyright| vim:tw=78:ts=8:ft=help:norl:"