tricks

Settings per File Types

| | |

In Vi Improved, you can conveniently have different settings per file type.

for example when you are working with perl files, you need a tabstop at 8 lines and a mapping in <F5> that comments out the current line using a # at the beggining, while in c files, you need comments with /* .. */ and a tabstop at 4 characters.

Mappings

| | |

In Vim you can map keys to do several functions. For example you can:

map <F3> :!lpr %^M

To print the current file
(to enter <F3> simply press the function key, to enter ^M press <ctrl-v><enter> )

Usefull Settings

| | | |

Vi Improved (vim) has some very usefull settings:

For syntax highlighting type:

:syntax on

To see your current position in the file:

:set ruler

For incremental search type

Tab Mix Plus

| | | |

Enhanced tab browsing.

FlashBlock

| | | |

This nice extension, will turn all the flash objects into a button, which you can press to load the animation.

Scrapbook

| |

With the scrapbook extensions you can copy a page (or a part of a page!) in your computer, complete with images and everything. Extremely useful for archiving and searching .

Nuke Anything Enhanced

| | | |

This extensions allows you to remove any block (except embedded objects) from a page. It simply removes it from the layout.

Web Developer

| | | |

Simply the most important tool if you are interested in web developing.
It can do anything, it's simply amazing ..

Vi tips & tricks

| | |
in the ancient unix days the editors with powers were created. nine editors were given to the X-windows .. 7 to the console .. 3 were stream editors .. but there was this ONE editor for stream, console and X , one to rule them all, one to bind them .. VI VI VI .....

Basic vim tips..

(Start writing in vi)

Using h,j,k,l you can move around (left,down,up,right). Pressing i, you enter the "insert" mode where you can start writing under the cursor, while with I you start at the beginning of the line. Likewise with a and A you start after the cursor and at the end of the line. press ESC to get back to normal mode where you can delete with x one letter and with dd a line. To quit vi, type :w to save ( or :w filename to save it under the name filename) and :q to quit. Shorter, you :wq to save and quit or :q! to quit without saving. (By pressing : in normal mode you enter command mode wich is the third vi mode).

lets get started ..

First of all, undo with u and redo with ctrl-r :) With :e file2 you can open a second file and close the first. But vi keeps all the buffers so you can copy-paste (yank-paste actually).. so to yank 3 lines 3yy, move to another file with :e file2 then p. To get all lines you only need a ggyG. To get the paragraph {y}. Paste is p in normal mode and ctrl-r " in insert mode. By the way you can easily move between two files with e#. Everybody (well almost) knows that you can delete a line with dd. The registers 0-9 keep the last 10 deleted things so you can see them with :reg and to paste number 6 type "6p in normal mode (or ctrl-r 6 in insert mode). The latest deleted is also in the register " and that's why ctrl-r " is paste in insert mode. Of course you can use your own registers to yank for example m : "myy (keep in register m the current line) and "mp to paste it. And it gets even better...

You can keep more things in one register if you capitalize the register after the first time: "myy to get the current line, them move two lines down, "Myy to get this one as well, go to the next paragraph, {"My} to get the paragraph etc.. and with "mp (or ctrl-r m in insert mode) you magically paste two lines and a paragraph.

Vi tips & tricks

| | |

Τα βασικά..

Πως γράφουμε το πρώτο μας κείμενο στον vi.

Με h,j,k,l μετακινείσαι στο κείμενο (αριστερά,κάτω,πάνω,δεξια).

Πατώντας i, μπαίνεις σε insert mode και αρχίζεις να γράφεις στο σημείο του κέρσορα ενώ με I αρχίζεις να γράφεις στην αρχή της γραμμής. Αντοίστιχα με a και A γραφεις μετά τον κέρσορα και στο τελος της γραμμής.

Για να επιστρέψεις σε normal mode πατάς ESC και μπορείς αν θέλεις να σβήσεις με x ένα γραμμα, και με dd μια γραμμη.

Tέλος για να βγείς απο τον vi, δίνεις σε normal mode :w για να σώσεις το αρχείο ή :w filename για να το σώσεις με όνομα filename και :q για να κλείσεις τον editor (Δίνοντας : σε normal mode μπαίνεις σε command mode το οποίο είναι και το τρίτο mode του vi).

Syndicate content