Share to EffectHub.com

You can earn money or coins from your share:)

Tips: you can use Sparticle for uploading away3D effects.

Tips: you can download Sparticle for uploading effects.

Tips: The ActionScript editor is supporting Away3D, Starling, Dragonbones and Flex frameworks.

Tips: paste the web page URL then click button:)

EffectHub.com: Your Best Source for Gaming
Login    or

Best Vim Tips (1)

Basic use

<Esc> is the escape key or use <ctrl>[  sometimes written as  <C-[>


vimtutor    : starts vim editing a copy of a tutorial file -- very good.

i           : insert mode. Next keys typed are inserted into the file.

<Esc>       : Escape from insert mode so you can navigate and use edit commands (stop selecting)

h j k l     : move cursor ( h: ←  j: ↓  k: ↑  l: → )

A           : Append at end of line

o           : Insert at new line below

u           : undo last command, again and again

x           : delete character under cursor

dw          : delete everything right from the cursor to the start of next word (and put it into the default register)

dd          : delete line (and put it into the default register)

p           : paste the default register


/myname     : search forward for myname


:wq         : write and quit

:x          : write and quit

:w filename : write a copy of the file you are editing as filename

:q!         : quit without saving even if changes were made!

:help       : display help

<Tab>       : use tab completion to scroll through commands that start with what you typed

Still basic

COPY PASTE  (for CUTting lines use dd as described above)

v           : visual mode -- use to select text with cursor movement or mouse

y           : use to yank (copy) what was selected

<Esc>       : esc gets you back to the main mode


^ w e $     : bigger movements: beginning of line, word, end of word, end of line


Modes:

 normal, insert and visual, there are others too

 <Esc>    takes you back to normal


Enter a number before a command to repeat it, examples:

   10w      : skip forward 10 words

   10dd     : delete 10 lines


Commands are case sensitive:

   c        : starts a change command

   C        : change to end of line (same as c$)

   ce       : change to end of word (a complete change command)

Really useful

www.vim.org   : Visit frequently

comp.editors  : Vim dominated newsgroup

* # g* g#     : find word under cursor (forwards/backwards)

%             : match brackets {}[]()

matchit.vim   : % now matches tags <tr><td><script> etc

<C-N> <C-P>   : word completion in insert mode

<C-X><C-L>    : Line complete SUPER USEFUL

/<C-R><C-W>   : Pull <cword> onto search/command line

:set ignorecase : you nearly always want this

:set smartcase  : case-sensitive if search contains an uppercase character

:syntax on    : colour syntax in Perl,HTML,PHP etc

:h slash<C-D> : type control-D and get a list all help topics containing slash

    (plus use TAB for Help completion)

Make it easy to update/reload vimrc

" source $MYVIMRC reloads the saved $MYVIMRC

:nmap <Leader>s :source $MYVIMRC


" opens $MYVIMRC for editing, or use :tabedit $MYVIMRC

:nmap <Leader>v :e $MYVIMRC


" <Leader> is \ by default, so those commands can be invoked by doing \v and \s

Visual mode mappings

:vmap sb "zdi<b><C-R>z</b><Esc> : wrap <b></b> around visually selected text

:vmap st "zdi<?= <C-R>z ?><Esc> : wrap <?= ?> around visually selected text

Exploring

:Ex     : file explorer note capital Ex

\be     : show buffer explorer (requires plugin)

:ls     : list of buffers(eg following)

:cd ..  : move to parent directory

Great

guu     : lowercase line

gUU     : uppercase line

~       : invert case (upper->lower; lower->upper) of current character

gf      : open file name under cursor (SUPER)

ga      : display hex, ascii value of character under cursor

g8      : display hex value of utf-8 character under cursor

ggg?G   : rot13 whole file

xp      : swap next two characters around

CTRL-A,CTRL-X : increment, decrement next number on same line as the cursor

CTRL-R=5*5    : insert 25 into text

=             : (re)indent the text on the current line or on the area selected (SUPER)

=%            : (re)indent the current braces { ... }

G=gg          : auto (re)indent entire document

If you use Ctrl-V for paste, you will probably need to unmap CTRL-A first.


Easter eggs

:help 42

:help holy-grail

:help!

:help map-modes (see comment below the table about :nunmap)

:help UserGettingBored

:help spoon

:help showmatch (read the note)

:Ni!

:help bar


...

You must Sign up as a member of Effecthub to view the content.

1338 views    0 comments

You must Sign up as a member of Effecthub to join the conversation.

Chenzhi Wu

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: helpers/time_helper.php

Line Number: 22

2014-02-18
>>Back to TextEditor group


Latest Posts


Sponsor


They are waiting for your help



Share

Join Effecthub.com


Or Login with Your Email Address:

Or Sign Up with Your Email Address:
This field must contain a valid email
Password should be at least 1 character

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: views/footer.php

Line Number: 6

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: controllers/topic.php

Line Number: 21

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: controllers/topic.php

Line Number: 85