Vim command learning Summary

Source: Internet
Author: User

: So % re-load. vimrc

= Vim

/Search
: Nohlsearch Remove selected words

: % S // replace all ig
: S // + & replace specified rows

> Indent
<Reverse indent
4> indent four lines

J. merge two rows
CTRL + F.
CTRL + B full screen
CTRL + D.
CTRL + u upper screen.
CTRL + e move the entire file content up in the editing window.
In the CTRL + y edit window, the entire file content is moved down one line.
CTRL-o jump to the earlier position (older)
CTRL-I jump back to the position where the cursor is stopped and updated later (I is on the left of O keyboard) (same effect as Tab)
B. Move one word left to the beginning of the word.
W move the cursor one word to the beginning of the word
E move the cursor one word to the end of the word
GE cursor move one word left to the end

: Set Ft = Perl: Set the file format
: Set fenc = set file encoding

CTRL + w gf open selected

= Exercise
You are in normal mode as default

1. move cursor down one line
J
2. return to normal mode from insert mode
ESC
3. Exit the editor, discarding any changes
: Q!
4. append text at the end of the current line
A
5. Go forward a screen
Gg
6. Go to end of Text
G
7. Go to line 75
: 75 or 75g
8. Undo last command
U
9. Redo last undo
CTRL + R
10. move cursor to next occurrence of character 'C''
FC
11. delete a line
C/CC => I or D/dd
12. Open a new line above the cursor's line and enter insert mode
O
13. Yank (copy) the selected text
Y
Yank the selected text into buffer
"A + Y
14. Put (paste) Copied text after the cursor
P
Put (paste) Copied text in buffer A after the cursor
"A + P
15. Get help on command ''cmd''
Help cmd
16. Forward find word under cursor to find a word
* (# Over cursor)
17. Match of next brace, bracket matching brackets
%
18. Scroll current line to center of window
M
19. Turn off line numbers
Set Nonu
20. Move backward to previous unclosed {
[{
21. Open ''file' in a new tab
: Tabnew File
22. Move to previous Tab
F5
23. Move to the 3rd Tab
: Tabn 3 or TABP 3
24. Count Number of matches of a pattern
% S/pattern // n
25. Word completion in insert Mode Automatic completion
CTRL + P
26. What's the location of user's vimrc File
System Vim configuration file

Plus (maybe not metioned in the Section ):

1. Open File in new Vertical Split Window
: Vsplit
2. jump to the next window right, left, up, or dow
CTRL + W hjkl
3. Stop highlighting the word that was searched
: Nohlsearch
4. How to set in vimrc to replace tab with 4 spaces.
Set tabstop = 4 tab 4
Set softtabstop = 4 unge Delete 4
Are there other settings about tabs and indent, research and explain the options you want to use.
Set cindent use C style indent set smartindent smart indent
5. Share a key mapping that you think is useful
CTRL + Pageup/Pagedown scrolling in Shell
6. Any other tips you want to share
CTRL + S ~~~ All of them are stuck ~~~~~~~~~~~~~~~~~~~ CTRL + q restore

Configuration
Set nocompatible
Set history = 400
Set ruler
Set showcmd
Set number
Set hlsearch
Set incsearch
Set expandtab
Set noerrorbells
Set novisualbell
Set t_vb = "close visual bell
Set tabstop = 4
Set shiftwidth = 4
Set nobackup
Set nowritebackup
Set smarttab
Set smartindent
Set autoindent
Set cindent
Set wrap
Set wildmenu
Set autoread
Set Partition Height = 3
Set showtabline = 2
Set tabpagemax = 20
Set laststatus = 2
Set noswapfile
Set cursorline
Set statusline = \ [file] \ % F % m % R % H \ % w \ % H \ % = [Line] \ % L, % C \ % = \ % P
Set whichwrap = B, S, <,>, [,], H, l "allow move the cursor left/right to move to the previous/next line
Set term = xterm
Set listchars = tab:>-, trail :_
Set list
"====================
"Mappings
"====================

: Map <F5>: TABP <CR>
: Map <F6>: tabn <CR>
: Imap <F5> <ESC>: TABP <CR> I
: Imap <F6> <ESC>: tabn <CR> I
Function! Currectdir ()
Let curdir = substitute (getcwd (), "", "", "G ")
Return curdir
Endfunction
: Map PP: Call addperlheader () <CR>
Func addperlheader ()
Call append (0 ,"\#! /Usr/bin/Perl ")
Call append (1, "use strict ;")
Call append (2, "Use warnings ;")
Endfunc

Syntax match trail "+ $"
Highlight def link trail todo

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.