Vim Common commands

Source: Internet
Author: User

Configuration

Modify the. vimrc File

Set number # display row number filetype on # display file type set fileformat = UNIX # Set the file format to unixset Ts = 4 # Set the tab length to 4 set expandtab # Set the tab to use space set autoindent # use auto indent set shiftwidth = 4 # auto indent space set to 4 syntax enable # enable syntax highlighting syntax oncolorscheme Slate # select a color subject, usually at/usr/share/Vim/vim73/colors
Set hulsearch # Set highlighted search
Set ruler # display status information
Set showmode # display the editing status
Set BG = light # Set the Background Brightness

 

Neocomplcache Configuration

" NeoComplCache settings" Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Use camel case completion. let g:neocomplcache_enable_camel_case_completion = 1 " Use underbar completion. let g:neocomplcache_enable_underbar_completion = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3 " Auto selectlet g:neocomplcache_enable_auto_select = 1 " function combinationinoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"inoremap <expr><C-y>  neocomplcache#close_popup() inoremap <expr><C-e>  neocomplcache#cancel_popup()" <Tab> : completioninoremap <expr><TAB>  pumvisible() ? "\<C-y>" : "\<TAB>" " <CR>: close popup and save indent. inoremap <expr><CR>  neocomplcache#smart_close_popup() . "\<CR>"

 

Omni configuration. With NCC, do not use it.

Filetype plugin indent on # file type check autocmd filetype CSS setlocal omnifunc = csscompletecssautocmd filetype HTML, markdown setlocal omnifunc = export filetype JavaScript setlocal omnifunc = export filetype Python setlocal omnifunc = export filetype XML setlocal encoding = export filetype Ruby setlocal omnifunc = export filetype PHP setlocal omnifunc = export completeopt = longest, menu # Do not display function definitions

 

Shortcut Keys

DAW: delete a word

E: Move a word backward.

B: Move a word forward.

I: insert

0: Jump to the beginning of the line

$: Jump to the end of a row

Shift + I: insert at the beginning of the row

Shift + A: insert at the end of a row

GG: Jump to the beginning of the file

Shift + G: jump to the end of the file

V: visual mode

Shift + V: Visual Line Mode

CTRL + V: Visual Block Mode

U: undo

CTRL + R: redo

Y: Copy

YY: Copy row

P, P: paste to the next line and the last line

>>: Increase indentation.

<: Reduce indentation

=: Auto indent

X, X: delete one character backward and forward

J: merge the current row and the next row.

In insert mode, CTRL + T Ctrl + D: forward or backward a tab

Commands

: Row number: Jump to the specified row

: W filename: Save

: R finename: after reading the file content of filename to the cursor

:! Command: temporarily leave Vim to execute Linux commands, such :! Ls

1. Replace the specified row number:

: 10, 20 s/pattern/replacement/g

: 10th, the replacement range is ~ 20 rows

S starts matching

/Pattern/replacement replace pattern with replacement

/G replace all matched items

2. Split: horizontal split window. use Ctrl + W + H, J, K, and l to switch the window.

3. VSP: Vertical Split Window

5. vnew: Create a vertical window

4. Close/Q: Close the window

5. Only: Close other windows

6. File: displays information about the current file.

7. helptags/usr/share/Vim/vim73/DOC: update the doc information. If the doc requires the root permission, run this command with the root permission.

8. E open the file

9. enew the current tag to create a new file

10. Open a new tab in tabnew

11. Disable other labels in Tabo

12. Switch the tag Ctrl + Pageup/Pagedown

Nerdtree shortcut

CTRL + W + H: switch to the tree directory label on the left

CTRL + W + L: switch to the tag on the right

CTRL + W: Rotate tags

O Open and Close files or directories
T open in the tab
T open in the background Tab
! Execute this file
P to the upper directory
P to the root directory
K to the first node
J to the last Node
U open the upper directory
M: displays the file system menu (add, delete, and move operations)
? Help
Q close

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.