2013年9月6日星期五

VI / VIM advanced skills in collecting , welcome to exchange , declined irrigation !

 This post last edited by the mymtom on 2010-12-13 09:24:50
came across this post in 2003 . Turned out re-posted ! Prepare a good tidy !
http://topic.csdn.net/t/20030429/18/1723102_2.html

: r! command

output of the command into the current location .
------ Solution ---------------------------------------- ----
my favorite is gg = G, Oh , sorting code format
------ Solution -------------------- ------------------------
set foldmethod = indent
zR
zM
------ Solution ----------------------------------- ---------
Haotie preempt a seat


------ Solution - -------------------------------------------
upstairs folding I also often use
set foldmethod = indent " folding settings
map zO

In addition, I do not like the mouse blinks
set gcr = a: block-blinkon0 "" Cancel the mouse blinks

There are also two files simultaneously watching : vsp
------ Solution ------------------------ --------------------
sp hello.c
------ Solution -------- ------------------------------------
Find it
set hls
then * in the character you want to find
------ Solution ---------------------------- ----------------
copy n lines
nyy

Delete n lines
ndd

find the corresponding {}
cursor on a { } , press the '%' , find the corresponding one {} ,

find words
cursor word by pressing '*' can use this document at the cursor word highlighted, press N, n find out.

gg ---> first line

G ---> footer rows




------ Solution ------------------------------------ --------
lot of grief ~
45G skip line 45
G Jump to the last row
$ end of line

...... do not know what to say , senior No, I am cooking
seems to have the vim 101 hacks good
------ Solution --------------------------- -----------------
ctrl + b screen after turning a
ctrl + u screen after turning half a page
ctrl + f flip a screen in front of
ctrl + d folk foreground turning half a page
------ Solution ---------------------- ----------------------
n cursor down n lines
: e! reload file
: w [filename] Save a file named filename
------ Solution --------------------- -----------------------
press V select some line, and then press the '=' This code is automatically aligned .
------ Solution ---------------------------------------- ----
: g / a / s / / b / g
put a replacement for the b
------ Solution ------------------------------- -------------
vim-d file1 file2 compare two files opened directly
CU discuss this post is already 10 up !
http://bbs.chinaunix.net/viewthread.php?tid=15797
------ Solution ------------------- -------------------------
vsp ye use ah ?
------ Solution ---------------------------------------- ----
: copen
: make
Double-click an error to jump to the wrong place
------ Solution ---------------------------- appear ----------------
finishing this is still difficult. Various techniques too much, if you do not often use soon forgotten. Which is nice to see , we must strengthen the multi-use only remember a few times .
I do not know how to count senior , just a little paste it:

w or W: cursor one word prefix
b or B: cursor left one word prefix
e or E: cursor one word to the suffix
): Move the cursor to the end of a sentence
(: ​​move the cursor to the first sentence
}: Move the cursor to the beginning of paragraphs
{: move the cursor to the end of the paragraph
nG: move the cursor to the first line n
n +: cursor down n lines
n-: cursor up n lines
n $: Move the cursor to the end of the first n lines
H: move the cursor to the top line of the screen
M: move the cursor to the middle row
L: move the cursor to the last line of the screen
0: ( note the number zero ) the cursor to beginning of current line
$: Move the cursor to the end of the current line

screen tumbling class command
Ctrl + u: turn to the file first half screen
Ctrl + d: a half turn to the end of the file screen
Ctrl + f: turn to the end of the file one screen
Ctrl + b; first turn to the file one screen

------ Solution ------------------------------------ --------
paste it. There are a lot of never used . Just try a few , really fun , but still can not remember

alphabetical order vi Quick Reference
# ( where # represents a number ) execute the next command n times ...
: enter ex mode
) under a
( on a
} next paragraph
{ previous paragraph
]] next section
[[ on a
0 at the beginning of the line
$ end of line
^ line of the first non-blank character
+ at the beginning of the next line
- on the beginning of a line
( space ) next character
( carriage return ) next line
/ forward search
? backward search
% Find the current small ( medium, large ) brackets matching characters
, reverse repeat the last f, F, t or T Operation
; Repeat last f, F, t or T Operation
. Repeat the last action
` Go to the mark
' to mark the beginning of the line
`` look back on a former place mark
' look back on a mark before the beginning of the line where the
~ toggle character case
" Save to register
!! repeat the last SHELL command
! put behind the text given command , replacing the output ( for example ,!} fmt the current paragraph
gave fmt command processing, and then replaced with something fmt return output . )
>> current paragraph a right shift width (shiftwidth)
<< left the current paragraph one shift width (shiftwidth)
>% from the current to match the small ( medium, large ) text between brackets right
<% from the current to match the small ( medium, large ) text between brackets left
( seems to have missed a symbol |, move to a column ---- Annotation )
a added after the current position
A added to the end of the current line
^ a is not used
b on the beginning of a word
B on the beginning of a word , ignoring punctuation
^ b Move one screen
c coverage ...
C to cover the end of the line
^ c terminate insert mode, command mode without using
d Delete ...
D Delete to end of line
^ d down half a screen , if the insert mode then move to the previous one shift width (ShiftTab) at
e end of the word
E end of the word , ignoring punctuation
^ e screen scroll down one line
f Find ...
F search backwards ...
^ f Move down one screen
g Unused
G ... Skip to [ the default is to the end of the file ]
^ g display the status bar
h left
H first line on the screen
^ h in Insert mode is backspace, command mode is left
i inserted before the current position
I in our first non-blank character inserted before
^ i Insert mode is the tab key , the command mode is not used
j Down
J , the next line into the Bank
^ j command mode is down, insert mode is to build a new line
k Move
K unused
^ k unused
l right
L last line of the screen
^ l redraw the screen
m the current position mark to register
M screen in the middle of the line
^ m Return
n Repeat last search
N Reverse repeat the last search
^ n command mode is down
o below the current line to build a new line
O above the current line to build a new line
^ o Unused
p pasted below the current line
( Annotation - should be pasted at the current position of the back )
P paste above the current line
( Annotation - should be at the current location in front of the paste )
^ p command mode is to move
q Unused
Q quit and start the ex
^ q Unused
r overwrite the current character
R has been covered in insert mode character
^ r redraw the screen in command mode below
s replacement
S replace the entire line
t to ...
T backwards to ...
^ t move to the next shift width (shifttab) at
u Undo the last action
U undo all changes to the Bank
^ u Move half screen
v Unused
V Unused
^ v Unused
w at the beginning of the next word
W at the beginning of the next word , ignoring punctuation
^ w command mode is not used, is to insert mode at the beginning of the previous word
x delete current character
X to delete the previous character
^ x Unused
y copy ...
Y copy entire row
^ y roll line on the screen
z reconfigure the current line around the screen
ZZ After saving exit
^ z unused
( Annotation - In command mode , ^ z suspend the implementation of the UNIX operating )

------ Solution ------------------------------------ --------
0 G jump to the last row
: set nu Display line numbers

edit / etc / vimrc file input into the command , such as the display line numbers , next time you open VIM will automatically perform
------ Solution ------ --------------------------------------
just saw you can go directly to the original G The last line

also sometimes press ctrl + s vim died, press the scroll-lock can be unlocked
------ Solution ------------- -------------------------------
cursor on the function , the uppercase K can immediately go to the man pages , digital + K can also be a way

lz can be found at vimer this keyword has a blog , a very powerful ~ ~ ~
------ Solution ----------------- ---------------------------
or symbols in the symbol { } , press {} =% within the current code typesetting !
------ Solution ---------------------------------------- ----
set autoindent "auto indent
set smartindent "auto indent
In the configuration file to add the above two lines of code can be entered automatically when zooming
------ Solution -------------------- ------------------------
vi commands too much, really need to sort out some of the most commonly used
----- - Solution --------------------------------------------
finishing the
------ Solution --------------------------------------- -----
in the configuration file, add the following line in the input note will automatically appear when the function description , individuals feel more practical.
ab note / / ======================================== =================== + Function: + Description: + Parameters: + Return: ; ================================================= ==========
------ Solution ------------------------------ --------------
I have a stupid electronic version of the tutorial, Procare , if necessary, Q I : 287089376
------ Solution ------ --------------------------------------


learn !
------ Solution ---------------------------------------- ----
F1
: help

------ Solution ------------------------------------ --------
content into the clipboard

------ Solution ------------------------------------ --------
good things look
------ Solution --------------------- -----------------------
come learn something all right ~ ~ ~
------ Solution ------ --------------------------------------
Haotie to learn
------ Solution ------------------------------------------- -
so complicated to learn about
------ Solution ------------------------ --------------------
see more Best of Vim Tips on OK.
http://www.rayninfo.co.uk/vimtips.html
- ----- Solution --------------------------------------------
http://www.rayninfo.co.uk/vimtips.html
------ Solution ---------------------- When asked by the master ----------------------


I always can not be installed under linux gui version of vim gvim, do not know what to install libraries
------ Solution -------------- ------------------------------
learning . . . . . . . . . . . . . . .
------ Solution ---------------------------------------- ----
http://www.rayninfo.co.uk/vimtips.html
------ Solution ------------------ --------------------------
preemptive prefecture
------ Solution -------- ------------------------------------
many masters , oh , learning
- ---- Solution -------------------------------------------- < br>

someone will do, installed several times, after all Zhuangwan Normal version without GUI
------ Solution ----------------- ---------------------------
VIM is very powerful, I still like to use the source insight, or code :: blocks, GUI interface with them cool.

------ Solution - -------------------------------------------
1 ` 23
456
------ Solution --------------------- -----------------------
X to delete the previous character
^ x Unused
y copy ...
Y copy entire row
^ y roll line on the screen
z reconfigure the current line around the screen
ZZ After saving exit
^ z unused
( Annotation - In command mode , ^ z suspend the implementation of the UNIX operating )
What a Siya
------ Solution -------------------------------- ------------
installing a TipOfTheDay in vim
day watching a few
cow was soon very soon despise the other editors
------ Solution ------------------- -------------------------
gg = G
------ Solution --------- -----------------------------------
xp -> swap two values ​​after the cursor location
dp->. . . .
------ Solution ---------------------------------------- ----
"ayy
"ap
/ \
: bufers
: buffer n


------ Solution ------------------------------------ --------
this ......
------ Solution -------------------------- ------------------
soon very cold
------ Solution ------------- -------------------------------
my favorite is gg = G, Oh , sorting code format
------ Solution ------------------------------------------- -
passing ~ ~ ~
------ Solution -------------------------------- ------------
good good. . .
------ Solution ---------------------------------------- ----
know eh ....
------ Solution -------------------------- ------------------
know eh ....
------ Solution ------------ --------------------------------
Kazakhstan , often with the first re p yy line . . .
------ Solution ---------------------------------------- ----
vim can automatically complete it ?
------ Solution ---------------------------------------- ----


enter first few letters of a function , you can press CTRL + P appears to begin with the string you have entered the list of functions .
------ Solution ---------------------------------------- ----
vi and vim do not know what oh ?
------ Solution ---------------------------------------- ----
I do not know what

------ Solution ------------------------------------ --------
view the file name.
Ctrl + G
: f
------ Solution ---------------------------------- ----------
v into Visual mode
Select the area you want to
: w filename
part of the file to another file in which to get .
: w >> filename
above that refers to append to filename
------ Solution ---------------------------- ----------------
w and b, move forward and backward a word
ago , when most do not know about using the up and down arrows .
------ Solution ---------------------------------------- ----
most general $ HOME / .vimrc file , this is my time to install the system must be configured with the most basic.
: set hlsearch
: set backspace = 2
: set autoindent
: set showmode
: syntax on
filetype on
filetype plugin on
filetype indent on
some of the above may be / etc / vimrc repeated in some configurations . No concern how vimrc file .
------ Solution ---------------------------------------- ----
easy to wait until someone replies to one . The original csdn can not reply to three times continuously . There is also a non- root user to open a file you want to edit how to save ?
: w! sudo tee%
------ Solution --------------------------- -----------------
Haotie ~ ~ ~
------ Solution --------------- -----------------------------

I just opposite you . GUI hurt the eyes . I like the black background.
------ Solution ---------------------------------------- ----
gg G $ A;
Each row followed by a semicolon , huh
------ Solution --------------------------- -----------------

H
M
L
were located above the middle and bottom of the screen .
------ Solution ---------------------------------------- ----

how to get the book ?
------ Solution ---------------------------------------- ----
x wq ZZ
Haha, soy sauce
------ Solution -------------------------------- ------------
passing , look
------ Solution --------------------- -----------------------
to some, I used


shift + ~ case conversion - Command Mode
shift + G tune to the specified line .
: w
: q
: wq

! v Open the last operation files.
table insufficiency and search
. . . . . . . .
------ Solution ---------------------------------------- ----
ctrl + r undo !
------ Solution ---------------------------------------- ----
line number gg
------ Solution ---------------------------- ----------------
very valuable and meaningful stickers, collection of
------ Solution ----------- ---------------------------------
"+ y {motion} copy the contents to the system clipboard
"+ p to paste the contents of the system clipboard
zz the cursor over the center of the screen
------ Solution --------- -----------------------------------
this should support ~ ~ ~
- ---- Solution -------------------------------------------- < br> set nohlsearch unhighlighting
------ Solution ------------------------------- -------------
Oh, picking up a few commands to go back , especially compared to that file , do not do not know

I said a few bars

The first is stolen
cursor moves to the code segment (xxxxxxxx) middle , press ci ( can delete the contents of brackets automatically enter insert mode , empathy with
ci "ci <( edit xml tag a class with ) such move the cursor to any one of the middle letter , press ci <(ci> is also possible ) , it will delete hello world! retention <> and automatically enter insert mode

second ,
ctrl-p techniques to learn , and I do not know it , say a ctrl-N, it will automatically finish your article, the word has been used

Also mention a digression , comes to see the code
Linux , you can run wine SI, with the eclipse, VI, kscope ( not used ) , etc. , SI as with Eclipse , you can jump to press ctrl element definition , do not grow old press ctrl-= ; :-) white on black scientists proven damage to the eyes than the big black and white , in short, if I use SI , it will use light green background, and then adjust the font was huge
------ Solution ------------------------------------------- -
Good materal!
------ Solution -------------------------------- ------------
buffer management
: e to open the new regulations made
: ls logo buffer list
: bp before a buffer
: bn next buffer
: b [buffer number ] identifies the number of buffer formulation
: b # represents just opened buffer
: bd buffer deleted


------ Solution ------------------------------------ --------
ctags use is commonplace , not really advanced :)

1. $ ctags-R * generate tag file
2. $ vi-t tag ( Please replace the tag you want to find a variable or function names )
3. Ctrl +] step into
4. Ctrl + T step out
: syntax on syntax highlighting display

The use vi useful when reading the code .

------ Solution ------------------------------------ --------
upstairs, I often use a folding
set foldmethod = indent " folding settings

------ Solution ------------------------------------ --------
Descending
:g/^/m0

descending from the second line
:g/^/m1

------ Solution ------------------------------------- -------
set nu display line numbers
------ Solution --------------------- -----------------------
: set ic string matching is case-insensitive when
: set noic string matching is case-sensitive when
------ Solution ----------------------- ---------------------
in the starting line mk, then move to the end of the line "ay 'k, then in the another file ( also available in the current file ) p look, you can achieve block copy .
knock skilled use can greatly reduce the amount of code .
------ For reference only -------------------------------------- -
  The reply on 2010-12-13 12:50:37 deleted by moderator

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-15 11:16:07

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-15 11:14:11

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-15 11:01:17

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-15 11:00:04

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-17 15:44:44

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-15 13:31:32

------ For reference only ---------------------------------- -----
  The reply was moderator deleted at 2010-12-15 17:28:25

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-16 13:50:44

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-17 17:03:46

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-17 09:05:11

------ For reference only ---------------------------------- -----
  This reply was moderator deleted at 2010-12-17 09:08:36

没有评论:

发表评论