<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                在 Linux 中,就像任何類 Unix 操作系統,一切都只是文件。而 Unix 哲學指出,配置文件必須是人類可讀和可編輯的。在幾乎所有的情況下,它們只是純文本。所以,首先,你必須學習如何編輯文本文件。 為此,我強烈建議你學習 vim 的基礎知識,這是在 Linux 中處理文本的最強大的工具之一。Vim 是由 Bill Joy 于 1976 年編寫的,\[vi\](http://en.wikipedia.org/wiki/Vi) 的重新實現。vi 實現了一個非常成功的概念,甚至 Microsoft Visual Studio 2012 有一個\[插件\](http://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329/),它提供了一個模式,與這個編輯器兼容。你可以在這里玩轉它(\[這是在瀏覽器中運行的真正的 Linux\](https://bellard.org/jslinux/vm.html?url=https://bellard.org/jslinux/buildroot-x86.cfg))。 或者你也通過這個鏈接了解更多 \[nano\](http://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/)來代替。但至少要試試。 現在,登入`vm1`,之后鍵入: ``` vim hello.txt ``` 你應該看到: ``` Hello, brave adventurer! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "hello.txt" \[New File\] ? ? ?0,0-1 ? ? ? ? All ``` 有一個笑話這樣說道,vim有兩種模式 - “反復嗶嗶”和“破壞一切”。那么,如果你不知道如何使用 vim,這是非常真實的,因為 vim 是模態的文本編輯器。這兩種模式是: + 普通模式:移動光標并執行刪除,復制和粘貼等文本操作。 + 插入模式:輸入文本。 這可能會令新手感到頭疼,因為他們試圖盡可能地避免普通模式。然而這是錯誤的,現在我將給你正確的方法來使用 vim : ``` start vim while editing is not finished, repeat ? ? navigate to desired position in NORMAL mode ? ? enter INSERT mode by pressing i ? ? ? ? type text ? ? exit INSERT mode by pressing when editing is finished, type :wq ``` 我們平常使用時,幾乎任何時候都呆在普通模式,短時間內進入插入模式,然后立即退出。以這種方式,vim 只有一種模式,而這種模式是普通模式。 現在讓我們試試吧。記住,按`i`進入插入模式,以及`` 返回到普通模式。鍵入以下內容(在每行末尾按``): ``` iRoses are red Linux is scary ``` 這是你應該看到的: ``` Roses are red Linux is scary ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4,17 ? ? ? ? ?All ``` 現在給出一些常用的命令,在普通模式下移動光標: + `h` - 向左移動 + `j` - 向下移動 + `k` - 向上移動 + `l` - 右移 + `i` - 進入插入模式 + `o` - 在光標下插入一行并進入插入模式 + `` - 退出插入模式 + `x` - 刪除光標下的符號 + `dd` - 刪除一行 + `:wq` - 將更改寫入文件并退出。是的,沒錯,這是一個冒號,后面跟著`wq`和``。 + `:q!` - 不要對文件進行更改并退出。 那就夠了。現在,將光標放在第一行并輸入: ``` oViolets are blue ``` 之后,將光標放在`Linux is scary`那一行,并輸入: ``` oBut I'm scary too ``` 你應該看到: ``` Roses are red Violets are blue Linux is scary But I'm scary too ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4,17 ? ? ? ? ?All ``` 現在鍵入`:wq`保存文件,并退出。你應該看到: ``` Violets are blue Linux is scary But I'm scary too ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "hello.txt" 4L, 64C written user1@vm1:~$ ``` 好的。你做到了。你剛剛在 vim 中編輯了文本文件,很好很強大! \## 附加題 + 通過鍵入鍵入`vim hello.txt`再次啟動 vim,并嘗試我給你的一些命令。 + 玩這個游戲,它會讓你更熟悉 vim:
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看