The Back Side — Vim Extensions

The Back Side — Vim Extensions

The Back Side — Vim Extensions Extra motions Folding jump to beginning, end of {} block [{ ,]} To make working with a file more convenient, multiple lines same for parentheses [( , ]) may be “folded” together into a single highlighted line. Use Visual Mode same for / (C–style comments) [/ , ]/ this to get long sections out of the way while editing. Probably the most useful extension in Vim is visual mode. previous end of word, space–delimited ge, gE It allows you to highlight a region of text for the applica- create, delete a fold zf, zd tion of an editing or “colon” command. open, (re–)close a fold zo, zc Extra markers remove outermost folds, more folds zr, zm highlight by character v Marks set with capital letters are “global”; jumping to a remove all, re–fold all folds zR, zM highlight by line V global mark may take you to a different file. Several marks disable, (re–)enable, toggle folds zn, zN, zi highlight by column C-V are remembered between editing sessions: save, load view (including folds) :mkview, :lo re–select previous visual area gv position when file was last open ’" position where file was last edited ’. Compiling and source code Windows file and position of last Vim session ’0 There are several commands for facilitating software de- Even on text consoles, Vim allows the editing environment velopment: to be divided into separate windows which may contain the same or different files. Commands that open a new Other searching correct indentation of line == incremental search :set (no)incsearch window take an optional file argument. increase the indent level >> highlight search :set (no)hlsearch decrease the indent level << open new horizontal window :new ignore case in search :set (no)ignorecase split window horizontally :split find word under cursor fwd, back *,# run make and move cursor to first error :make split vertically :vsplit move to next, previous error :cnext, :cprev close current window :close Interface and colors move to first, last error :cfirst, :clast close all but current window :only syntax coloring :syntax on view error or list of errors :cc, :clist cycle to next window C-W w switch to graphical :gui list lines with identifier under cursor [I cycle to previous window C-W p make windows equal height, width C-W = , C-W | show line numbers :set number Using ctags decrease, increase height one C-W - , C-W + show commands in progress :set showcmd You must first run ctags or etags on your file to use these decrease, increase width one C-W < , C-W > show matching bracket :set showmatch features. autoindent :set ai jump to function with tagname :tag tagname Objects smartindent :set si jump to tag under cursor C-] In addition to the usual motions that are supported by file format (dos, unix, mac) :set ff=... previous tag C-t Vi, Vim supports several objects: word, sentence, para- good for editing tables :set virtualedit=all graph, and block. These are used with editing commands edit option set :options Other (delete, change, and yank). The advantage over motions is reformat margins gq that you do not have to be at one end of an object to use Insert mode editing make case upper, lower, toggle gU, gu, g~ it. For example will delete a sentence from anywhere das There are some commands available while in insert mode: add subtract from number under cursor C-A , C-X within it. copy from line above, below C-Y , C-E edit file under cursor gf a word, a sentence, a paragraph aw, as, ap complete from previous match C-P view man page under cursor K same without white space (inner) iw, is, ip insert from (paste) register C-R print highlighted copy :hardcopy blocks delimited by [ ], (), <>, and {} a[, a(, a<, a{ insert digraph C-K di list digraphs :digraphs same without surrounding brackets i[, i(, i<, i{ execute single command C-O command editable command history q:.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us