Vim as the default editor for CRONTAB-E in Linxu

Source: Internet
Author: User

Setting Commands is simple

The code is as follows Copy Code

echo "Export Editor=/usr/bin/vim" >>.BASHRC

Then reopen the terminal, input crontab-e, found that the default vim has been used.

Linux under the VIM command detailed

: QX starts recording macros and stores the results in register X
Q Exit Record mode
@x play the Macro command recorded in the X register
To explain a little bit, when you enter in normal mode: QX, all your edits to the text will be recorded, then enter Q again to exit the recording mode.
Type, and then enter @x to repeat the command just recorded, this command can be followed by numbers, indicating how many times to repeat, such as @x20, you can repeat 20 times. This is useful in batch processing of text.
Edit multiple files at the same time
In the vim many plug-ins, has a call Minibuffer plug-in, is the following said the tab page function, may support simultaneously edits several files.
Label command

: Tabe fn Edit the file fn in a new tab page
GT Switch to next tab page
GT Switch to previous tab page
: TABR Switch to First label page
: tabl switch to the Last tab page
: TABM [n] Moves the current tab to the Nth tab
Yes, as you might imagine, a tab with Eclipse, UE, and so on, is an idea!
Window command
ctrl+w s horizontal Split window
Ctrl+w W Toggle Window
Ctrl+w Q exits the current window (this command does not affect other windows because there are multiple files at the same time)
Ctrl+w v Vertical Split window
Other
Vim does not make actual modifications to the file until it is saved, but is loaded into the buffer, and edits to the file are actually edited to the buffer, until: W will be deposited into the physical file.

: E file loads file into a new buffer
: Bn jumps to the next buffer
: BD Delete buffer (close file)
: SP fn Splits the window and loads FN into a new window
Exit editor

: W writes the buffer to the file, which saves the modification
: Wq Save changes and exit
: x Save changes and exit
: Q Exits, if the buffer has been modified, you will be prompted
: q! Force exit, Discard changes
Find replacement
/pattern search back for string pattern
? pattern forward Search string pattern
N Next match (if yes/search, then down next,? Search is next up)
N prev Match (IBID.)
:%s/old/new/g searches the entire file and replaces all old with new
:%S/OLD/NEW/GC searches the entire file, replaces all old with new, and each time you confirm whether to replace
Copy and paste
DD deletes the cursor in the row
DW Delete one word (word)
X Delete Current character
X Delete previous character
D Delete to end of line
YY copy a row, which can be followed by a number, identifying multiple rows, such as 6yy, to copy 6 rows starting from the current line
YW copy a word
y$ Copy to end of line
P Pastes the contents of the pasteboard below the current line
P Pastes the contents of the pasteboard onto the top of the current line
]p has indented paste, Vim automatically adjusts the indentation of the Code
"A" put the content into/into a register, you can support the multi-paste Board
Attached: For example, a commonly used register is the system register, the name is +, so paste from the system paste into the vim in the command for "+p, note here the + does not represent the operator, 21 registers."
Move cursor
Moving the cursor in VIM is a big difference from other editors, but once you learn it, you can move through the text quickly.

H,j,k,l, down, left, right.
Ctrl-f on a page
Ctrl-b down a page
% jumps to the parentheses that match the current bracket, such as currently in {, then jumps to the place where it matches
W jumps to the next word, divided by punctuation or word
W jumps to the next word first, and the long jump, as end-of-line is considered a word
e jumps to the end of the next word
E jump to the end of the next word, long jump
B Jump to the previous word
B jump to the previous word, long jump
0 jump to the beginning of the line, whether or not indented, is to jump to the No. 0 character
^ The first character to jump to the beginning of a line
$ skip to end of line
GG jumps to the first line of the file
GD jumps to the declaration of the variable where the current cursor is located
N G jump to Nth line, such as 0G, is equivalent to gg,100g is the 100th line
FX finds x characters in current line and jumps to
; Repeat the previous F command without having to repeat the input FX
TX is similar to FX, but only jumps to the previous character of X
FX is in the opposite direction to FX.
), (jump to top/Next statement
* Find the word at the cursor and look down
# Find the word at the cursor, look up
`. Jump to last edit location
Moving on the screen

H move the cursor to the topmost line on the current screen
M moves the cursor to the middle line on the current screen
L move the cursor to the bottom line on the current screen
Bookmark
Ma saves the current position as label a
' A jump to label a
Edit
R replaces a character
J joins the next and current lines as one line
CC Deletes the current line and enters edit mode
CW Deletes the current word and enters edit mode
C $ erases content from current position to end of line and enters edit mode
s deletes the current character and enters edit mode
S deletes the cursor line and enters edit mode
XP swaps the current character and the next character
U undo
Ctrl+r Redo.
. Repeat previous Edit command
~ Toggle case, current character
G~IW Toggles the case of the current word
GUIW the current word into uppercase
GUIW the current word into lowercase
>> move the current line one unit to the right
<< move the current line one unit to the left (a tab character)
= = Auto Indent when forward

The

Insert mode
i     into insert mode from the current cursor
i     into insert mode, with the cursor at the beginning of the line
a      Append mode, placing the cursor after the current cursor
a     append mode, placing the cursor at end of line
o     the new row under the current line, and into insert mode
o     A new line above the current line and enters insert mode
esc     exit insert mode
Visual Mode
Markup text
v     into visual mode, single character mode
v     into visual mode, row mode
ctrl+v      into visual mode, column mode, similar to UE column mode
o     jump cursor to the other endpoint of the selected block
u     to capitalize the contents of the selected block
o     jump cursor to another endpoint of the block
aw     Select a word
ab     Select all the contents in parentheses, including the parentheses themselves
ab     all contents of {} brackets
ib     Check the contents in parentheses without parentheses
IB      select content in {}, excluding {}

Action on Tags
>     block right-move
<     block left
y     Copy Block
d     Delete block
~     The case of content in a toggle block

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.