程式設計師的VIM配置

2021-07-08 14:56:55 字數 1634 閱讀 7492

後端神器:vim

讓手速跟上思維!

" $author: xulidong $

" $mail: [email protected] $

" $date: 2015-12-04 $

" $url: $

" 特殊鍵

" esc

" ctrl+a

" 上方向鍵

" ctrl+滑鼠左鍵

" shift+f11

" tab

" set backspace=2" 相當於set backspace=indent,eol,start,解決mac中delete失效問題

" 語法高亮

syntax enable

syntax on

set nocompatible " 關閉vi鍵盤相容模式

set nobackup " 關閉備份

set number " 顯示行號

set expandtab " 自動將tab展開為空格

set smarttab " 行首自動加入tab

set tabstop=4 " 1個tab佔4個空格

set shiftwidth=4 " 每層縮排空格數

set cindent " c/c++風格縮排

set autoindent " 自動對齊

set smartindent " 只能對齊

set showmatch " 括號高亮

set hlsearch " 搜尋高亮

set incsearch " 搜尋時逐字高亮

set formatoptions+=ro " 注釋中換行自動插入注釋起始符號

set noerrorbells " 關閉滴滴聲

" ctrl + a 全選

noremap ggvg

" ctrl + c 複製

noremap y

" ctr + x 剪下

noremap d

" ctr + z 撤銷"

noremap u

" ctrl + f 搜尋游標所在的字串

noremap *n

function! closepair(char)

if getline('.')[col('.') - 1] == a:char

return "\"

else

return a:char

endif

endfunction

" 左括號自動補全

:inoremap ( ()i

:inoremap ) =closepair(')')" 大括號自動補全換行

:inoremap o

:inoremap } =closepair('}')" 自動補全方括號

:inoremap [ i

:inoremap ] =closepair(']')" 引號自動補全

:inoremap " ""i

:inoremap ' ''i

autocmd filetype make setlocal noexpandtab " makefile 不用空格替換tab

檔案託管:

vim與程式設計師

所有的 unix like 系統都會內建 vi 文書編輯器,其他的文書編輯器則不一定會存在。但是目前我們使用比較多的是 vim 編輯器。vim 具有程式編輯的能力,可以主動的以字型顏色辨別語法的正確性,方便程式設計。vim是從 vi 發展出來的乙個文字編輯器。補完 編譯及錯誤跳轉等方便程式設計的功能...

vim與程式設計師

所有的 unix like 系統都會內建 vi 文書編輯器,其他的文書編輯器則不一定會存在。但是目前我們使用比較多的是 vim 編輯器。vim 具有程式編輯的能力,可以主動的以字型顏色辨別語法的正確性,方便程式設計。vim是從 vi 發展出來的乙個文字編輯器。補完 編譯及錯誤跳轉等方便程式設計的功能...

vim與程式設計師

所有的 unix like 系統都會內建 vi 文書編輯器,其他的文書編輯器則不一定會存在。但是目前我們使用比較多的是 vim 編輯器。vim 具有程式編輯的能力,可以主動的以字型顏色辨別語法的正確性,方便程式設計。vim是從 vi 發展出來的乙個文字編輯器。補完 編譯及錯誤跳轉等方便程式設計的功能...