我用的/etc/vimrc
" 映射非數(shù)字/字母鍵, 如:ctrl,shift, alt, home,end,功能鍵F1~F12, 要把這些鍵用尖括號括起來!如:
map <F3> :NERDTree<CR>
(pending 懸而未決的, 擱起的, 甩起的... the case/matter is still pending in court)
vim的operator pending操作符待決/懸掛 模式, 是指在操作符如dw的d, 和其操作的對象 按鍵w 之間存在的短暫時(shí)間.
vim的map有多種狀態(tài)下的映射(共5種):nmap, vmap, omap, imap, cmap. 注意每種命令所對應(yīng)的模式,
?
| Command 命令 | Normal ??常規(guī)模式?? | Visual 可視化模式 | Operator Pending 運(yùn)算符模式 | Insert Only 插入模式 | Command Line 命令行模式 |
| :map | y | y | y | ? | ? |
| :nmap | y | ? | ? | ? | ? |
| :vmap | ? | y | ? | ? | ? |
| :omap | ? | ? | y | ? | ? |
| :map! | ? | ? | ? | y | y |
| :imap | ? | ? | ? | y | ? |
| :cmap | ? | ? | ? | ? | y |
?
注意,map作用的是normal, visual,operator這三種模式, 其中 map! 作用的是插入insert和commandline命令行模式.
winpos 50 50 其中的winpos是一個(gè)命令, 不是參數(shù),不要用set.
要實(shí)現(xiàn)某個(gè)插件的切換功能, 試試:?? :????Toggle<cr> 就是看有沒有自動的切換那個(gè)功能?
?------------------------------?? /etc/vimrc? ---------------------------------------
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
?? set fileencodings=ucs-bom,utf-8,latin1
?? "這個(gè)是自定義將文件寫入存儲介質(zhì)時(shí)的字符集這里設(shè)為gb2312
?? " fileencodings=gb2312,gbk
endif
set nocompatible
set guioptions-=T
"set guioptions-=m
set guifont=Monospace\ 12
colorscheme murphy
set shiftwidth=4
set softtabstop=4
set lines=40 columns=110
winpos 230 40
set nobackup
set noswapfile
" 設(shè)置文件修改時(shí)自動載入, 自動保存
set autoread
set autowrite
set cursorline
set magic
set syntax=on
set incsearch
set hlsearch
"搜索時(shí),忽略大小寫
set ignorecase ?
"按F3實(shí)現(xiàn)NERDTree的自動切換
map <F3> :NERDTreeToggle<CR>
map <C-A> ggvGy
" vi中的所有字符都沒有特殊含義!vim要與vi兼容, 但是在表示vim中一些特殊含義的時(shí)候, 就得
" 要把這些特殊符合,從兼容集cpoptions中去掉!
set cpoptions-=<
" 從cpoptions中去掉C, 啟用行繼續(xù)符 \, 解決“E10:..."問題
set cpoptions-=C
set cpoptions-=u??? "去掉和vi兼容的撤銷undo u命令?
"統(tǒng)一的,用一個(gè)命令來解決vim和vi的兼容性問題
"那就是, 不要讓vim去兼容,去管vi的, 完全使用vim的操作方式, 不管vi的,
"也就不用一個(gè)一個(gè)地來設(shè)置cpoptions了
"set nocompatible
"在insert mode下也可以 快速移動到行尾和行首"
inoremap <c-h> <esc>I
inoremap <c-l> <esc>A
inoremap? jk <esc>
inoremap jj <esc>ji
inoremap kk <esc>ki
inoremap hh <esc>ha
inoremap ll <esc>la
inoremap nn <esc>ji
set nu
" 自動匹配括號, 引號
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap ' ''<ESC>i
" allow backspacing over everything in insert mode
set bs=indent,eol,start?? ??? ?
" always set autoindenting on
set ai?? ??? ??? ?
set viminfo='20,\"50?? ?" read/write a .viminfo file, don't store more
?? ??? ??? ?" than 50 lines of registers
set history=100
set ruler
" Only do this part when compiled with support for autocommands
if has("autocmd")
? augroup redhat
? autocmd!
? " In text files, always limit the width of text to 78 characters
? autocmd BufRead *.txt set tw=78
? " When editing a file, always jump to the last cursor position
? autocmd BufReadPost *
? \ if line("'\"") > 0 && line ("'\"") <= line("$") |
? \?? exe "normal! g'\"" |
? \ endif
? " don't write swapfile on most commonly used directories for NFS mounts or USB sticks
? autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
? " start with spec file template
? autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
? augroup END
endif
if has("cscope") && filereadable("/usr/bin/cscope")
?? set csprg=/usr/bin/cscope
?? set csto=0
?? set cst
?? set nocsverb
?? " add any database in current directory
?? if filereadable("cscope.out")
????? cs add cscope.out
?? " else add database pointed to by environment
?? elseif $CSCOPE_DB != ""
????? cs add $CSCOPE_DB
?? endif
?? set csverb
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
? syntax on
? set hlsearch
endif
filetype plugin on
if &term=="xterm"
???? set t_Co=8
???? set t_Sb=[4%dm
???? set t_Sf=[3%dm
endif
" Don't wake up system with blinking cursor:
" http://www.linuxpowertop.org/known.php
let &guicursor = &guicursor . ",a:blinkon0"
" 設(shè)置不生成備份和交換文件,這個(gè)要放在最后
" 同樣的設(shè)置,后面的設(shè)置(可能從$runtime/...中引入其他配置)會覆蓋前面的設(shè)置
" 如這里,當(dāng)后面設(shè)置set backup, 將會覆蓋前面的set nobackup
" 從而一直找不到生成backup文件的原因!!
" 將系統(tǒng)剪切板設(shè)置為默認(rèn)的 “未命名”寄存器,便于粘貼
set clipboard=unnamed
cd ~
" 如果需要想對特定的文件類型使用特定的字體,則可以將下面的語句加入到vimrc文件中去:
" autocmd BufEnter? *. txt set guifont = Arial \ 12
set mouse=a
let g:winManagerWindowLayout='FileExplorer|TagList'
map wm? :WMToggle<CR>
?
--------------------------- ~/.vimrc? 實(shí)現(xiàn)Vundle的自動化管理----------------------------
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'taglist.vim'
Plugin 'OmniCppComplete'
Plugin 'AutoComplPop'
Plugin 'c.vim'
Plugin 'supertab'
Plugin 'scrooloose/nerdtree'
Plugin 'winmanager'
Plugin 'minibufexplorerpp'
Plugin 'snipMate'
Plugin 'Lokaltog/vim-powerline'
call vundle#end()
filetype plugin indent on
?
總結(jié)
以上是生活随笔為你收集整理的我用的/etc/vimrc的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: APNS 推送
- 下一篇: Ubuntu Server 安装部署 C