Giter VIP home page Giter VIP logo

vim-tutorials's Introduction

GitHub last commit GitHub repo size

Jump start with VIM

Install and set up plugins

On your terminal run the following commands to install and setup VIM:

chmod +x setup.sh
sudo ./setup.sh

Often more than not, people who tend to hate vim are either reluctant to learn and memorize the commands, largely because that seems too much and in other cases there is no proper documentation about it.

It is highly recommended to go through the help manual from the vim. It has all the essential commands, from beginner to advanced. However, some commands are already described below, which are used most frequently while coding.

Vim most essential commands

  1. :tabnew starts a new tab with specified file or an empty file if not specified.
  2. :tabn switches to a new tab.
  3. :split does a horizontal split of the screen. With the same file or with different file if specified.
  4. :vsplit works same like split except does a horizontal split.
  5. c is a cut specifier which can be later used with w or other commands. Note the command after execution directs user into insert mode.
  6. C deletes a current line and directs you to insert mode.
  7. ^ is used to send cursor to the start of the line.
  8. $ sends the cursor to the end of the line.
  9. A appends like a but at the end of the current line. I goes to the beginning of the line.
  10. m + [letter] bookmarks a line with that letter. ' + [letter] can be used to navigate to that line later. Can be used while working with big code where you want to locate to same function every time you open a file. You can check marks details by using :marks.
  11. << or <j is used to indentation to the left. :[range]< shifts the indent for the range of line numbers.
  12. >> or >j is used to indentation to the right. :[range]> shifts the indentation for the range of line numbers.
  13. == or =j is used to properly indentation. :[range]= indentation the lines properly for that particular range.
  14. ~ is used to change the case of the character under cursor.
  15. /[search] searches for the pattern inserted.
  16. d[modifier] modifies the delete pattern. For example, d4w deletes 4 words following the cursor.
  17. cc changes a whole line. It directs you to insert mode automatically.
  18. . repeat a change. That is, for example, if you find a word like four and say want to change it to five then after doing the first change, navigating to the word and using the mentioned command will do the job. The change gets implemented even for any word.
  19. daw deletes the word regardless of the position of the cursor in that word. More precisely, "daw" can be attributed as "delete a word".
  20. cis similar to daw deletes a whole line in a paragraph. This helps in line in a bunch of lines which might become a headache otherwise.
  21. :set spell does a spell of every word while typing.
  22. ]s or [s takes you to forward or misspelled word and backward of misspelled word.
  23. z= takes you to the suggestions of the word.
  24. zg adds the word to the dictionary.
  25. zug removes the added word to the dictionary.
  26. zw adds a word to the wrong or bad word list.
  27. zuw removes the word from the wrong word list.
  28. Press v to enter into visual mode. Then go over to the file to select text and yank it.

Simple Search Patterns

  1. ^ is used for the beginning of the line. Thus if the pattern is to be searched for the beginning of every line ^[pattern]. For example, ^the searches for the word "the" at the beginning of every line.
  2. $ is used for the end of the line. Thus, if the pattern is to be searched for the end of every line [pattern]$ is used. For example, the$ will search for the word the at the end of every line.
  3. . matches any character. For example, /c.m will search for the 3 letter word which starts with "c" and ends with "m" and can have any character in place of .
  4. [ctrl] + o and [ctrl] + i is used for jumping inside a file. Intuitively to remember, "o" stands for older and "i" is just beside "o".
  5. /\c[pattern] ignores the case of the characters in the pattern. Thus for a pattern "the", it matches "The", as well as "THE" and other combinations.

vim-tutorials's People

Contributors

bhargavamakwana avatar

Stargazers

Manik Bajpai avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.