VIM for the Win!

From DevSummit
Jump to navigation Jump to search

Vim for the Win!

Facilitated by Bill

Vim is a command line text editor that's good for when you don't have a graphical user interface. It's easily downloadable – VIM for Linux & Mac, sigwin for Windows It's based on VI, which is simpler.

It has keybindings! You press “i” to go to Insert Mode After entering text, you press ESC to go to Default Mode You can navigate text using “h,j,k,l” but you can also use the arrow keys You can practice h,j,k,l by playing Vim Avengers You can replace text by pressing “R” from default mode

VIM has syntax highlighting depending on what kind of file you open: .js Javascript files, etc. It'll highlight the expressions in it, etc. You can find additional files for other kinds of files not supported by the base version of VIM

You can open files side-by-side in the default mode by typing “:vsp filename” for Vertical Split CTR-WW to bounce between windows

You can also open a new tab with “:tabnew filename” Navigate between them with “gt” for Go Tab

Exit by typing “qa” for quit all or “wa” for Write [save] All Undo with “u,” Redo with “r”

You can navigate easily In default mode, press “$” to go to the end of the line Type “^” to go to the beginning of the line To insert a new line below your current line, press “o” It will immediately go to insert mode To insert a line above, press “O”

To delete a line, press “dd” This will put it in the buffer – see below To delete 3 lines, press “3dd”

Go to Visual Mode by going to default mode and pressing “v” You can highlight text and then copy it with “y” for Yank You can past it by pressing “p,” for Paste

You can have multiple things in your buffer to paste, etc. You can always press “ ”0p ” to paste what you yanked Otherwise, if you yanked and THEN deleted some text, pressing “p” will paste the last thing you deleted – what you yanked is in another buffer in addition to in 0

You have a configuration file in your home folder, “vim.rc” for Resource “color xx” is your theme “set softtabstop=2” makes the tab button produce two spaces by default You can use plugins, like “fugitive.vim” to add and manipulate files from within VIM