vi常用命令總結

2021-10-31 22:05:28 字數 2123 閱讀 5111

輸入模式命令

輸入命令作用

在游標後輸入文字

在當前行末尾輸入文字

在游標前輸入文字

在當前行開始輸入文字

在當前行後輸入新一行

在當前行前輸入新一行

游標移動命令

游標移動

命令作用

0 移動到游標所在列的最前面 [home]

$ 移動到游標所在列的最後面 [end]

[ctrl][d] 向下半頁 [pagedown]

[ctrl][f] 向下一頁

[ctrl][u] 向上半頁

[ctrl][b] 向上一頁 [pageup]

h 移動到視窗的第一列

m 移動到視窗的中間列

l 移動到視窗的最後列

b 移動到下個字的第乙個字母

w 移動到上個字的第乙個字母

e 移動到下個字的最後乙個字母

^ 移動到游標所在列的第乙個非空白字元

n- 減號移動到上一列的第乙個非空白字元前面加上數字可以指定移動到以上 n 列

n+ 加號移動到下一列的第乙個非空白字元前面加上數字可以指定移動到以下 n 列

ng 直接用數字 n 加上大寫 g 移動到第 n 列

) 游標所在位置到下個句子的第乙個字母

( 游標所在位置到該句子的第乙個字母

} 游標所在位置到該段落的最後乙個字母

前面部分的從 m 次至 n 次出現,m n 為數值

\/&insert something here/g

2.把c++語言裡 //注釋修改為格式

:%s1\*\//g

3.在建儲存過程的sql文字裡,在每個create procedure procname()

前加上drop procedure procname裡輸入的是乙個空格和tab鍵。

:%s/^[ ]*[cc][rr][ee][aa][tt][ee][ ]*[pp][rr][oo][cc][ee][dd][uu][rr][ee][

drop procedure \1;ctrl_vctrl_mcreate procedure \1/g

巨集命令首先,巨集的實質是將命令儲存在暫存器中,如下是錯誤的

qa"ayw

q暫存器a衝突,巨集挺有用的

vi的配置檔案

另一方面,使用者可以在主目錄中建立.exrc環境檔案,用set打入

選項,每次呼叫vi時,就會讀入.exrc中的指令與設定。下面是

.exrc環境檔案的例項:

set wrapmarging=8

set showmode

set autoindent

set number

vim配置檔案:

set nobackup

set directory=$vim/swp "there stores all vim swap files

set ignorecase smartcase "\c to force vim to search case sensibly.

set linebreak "let vim don't split a word when linewrap, note: line doesn't be split really

if has('multi_byte_ime')

highlight cursor guibg=green guifg=none

highlight cursorim guibg=purple guifg=none

endif

set autoindent

set smartindent

set tabstop=4 "treat as four spaces, stores instead of spaces

set shiftwidth=4 "be used only when "<<" command is pressed

"turn off ime when insert mode and search mode

set iminsert=0

set imsearch=-1

Linux常用命令總結

liunx幫助命令 help pwd help s pwd 只顯示命令的格式資訊 touch help man ls info ls liunx檔案和目錄操作命令 ls ls l ll 列目錄命令 cd root,cd 目錄更改命令 mkdir directory1 directory2 建立目錄 ...

VF常用命令總結

1 create project 專案檔名 功能 建立專案檔案,同時開啟專案管理器。2 create 表檔名 功能 開啟表設計器,建立資料表。3 use 表檔名 exclusive shared 功能 開啟指定的資料表檔案 注 use 關閉當前資料表檔案 4 list disply structur...

MySql常用命令總結

mysql常用操作基本操作,以下都是mysql5.0下測試通過首先說明下,記住在每個命令結束時加上 分號 1.匯出整個資料庫 mysqldump u 使用者名稱 p default character set latin1 資料庫名 匯出的檔名 資料庫預設編碼是latin1 mysqldump u ...