Common commands for rails development in VIM

Source: Internet
Author: User

1. Window/Tab

Switch directory tree: Ctrl + O or nerdtreetoggle

: B number jumps to the upper Tab

Reload Directory: nerdtree

Multi-Window Splitting:

(Reference: http://hi.baidu.com/dtzw/blog/item/64a6f3f2fc10721eb07ec590.html)

: New is a new horizontal split window by default.

: Split Horizontal Split Window

: Vsplit Vertical Split Window

Jump: Ctrl + H/J/k/L or Ctrl + direction key

 

Multiple Tabs:

: Tabnew [++ opt option] [+ cmd] Create a new tab for the specified file
: Tabc close the current tab
: Tabo: Close all other tabs.
: Tabs view all open tabs
: Previous TABP
: The last one of tabn
In standard mode: T and GT can be directly switched between tabs.
More =>: Help table

 

2. Edit

= Format the current row

N = format the N rows after the current row

Execute = g in the file header to format all

Reload: 1) e!

2) Place the cursor on the file node and press R

: CO 12: copy the current row to the location of row 12.

Press the 'key twice (the one above the tab key switches to the Last edited position)

 

3. File Operations

: M pop-up operation list, which can be added, modified, moved, or deleted.

: Rcontroller jump to the corresponding Controller

: Rmodel jump to the corresponding model

 

4.View the definition of a function

Sudo apt-Get install ctags

Ctags-R * creates a tags file. This command will generate a "tags" file in the current directory. When you run VI in the current directory, it will automatically load this tags file. After editing, you can delete the folder.

Tag func/Ta func will jump to the func Function Definition

Tag/^ XXX regular search

CTRL +] Jump to the definition of the function under the current cursor

CTRL + t return the previous position

Terminal shortcut

1. window operations

Shift + Ctrl + T: Create a tab

Shift + Ctrl + W: Close the tab

CTRL + Pageup: Previous Tab

CTRL + Pagedown: Next Tab

Shift + Ctrl + Pageup: tab left shift

Shift + Ctrl + Pagedown: Right Shift of the tab

Alt + 1: Switch to Tab 1

Alt + 2: Switch to Tab 2

Alt + 3: Switch to tab 3

Shift + Ctrl + N: New window

Shift + Ctrl + Q: Close the terminal

2. Copy/paste in the terminal:

Shift + Ctrl + C: Copy

Shift + Ctrl + V: Paste

3. Terminal size change:

F11: Full Screen

CTRL + plus: Zoom in

CTRL + minus: Decrease

CTRL + 0: original size

4. Display command history list in history
← (CTRL + p) display the previous command
Hide (CTRL + n) display the next command
! Num: The num command in the History list.
!! Run the previous command
!? String? Execute the latest command containing string strings
CTRL + R enter several characters and start to search for the command containing the character up. Continue to press Ctrl + R to search for the previous matched command.
CTRL + S is similar to Ctrl + R, only forward Retrieval
Alt + <first item in the History List
Alt +> last item in the History List

 

5. Edit
CTRL + a move to the beginning of the current row
CTRL + e move to the end of the current row
CTRL + l clear screen
CTRL + y paste the deleted character
CTRL + V Insert special characters, such as Ctrl + V + TAB to add the Tab character key
CTRL + C Delete the entire row
CTRL + (x u) press Ctrl and then press X and u to cancel the previous operation.
CTRL + S suspend the Current Shell
CTRL + q restart the suspended Shell

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.