(原創) Gvim 個人習慣常用設定

不定期更新這篇,因為查詢到好用的設定或者插件就會更新自己的設定。

  1 "set nocompatible
  2 let $LANG=‘zh_TW.UTF-8‘
  3 set langmenu=zh_tw.utf-8
  4 set encoding=utf-8
  5 source $VIMRUNTIME/vimrc_example.vim
  6 source $VIMRUNTIME/mswin.vim
  7 behave mswin
  8
  9 set diffexpr=MyDiff()
 10 function MyDiff()
 11   let opt = ‘-a --binary ‘
 12   if &diffopt =~ ‘icase‘ | let opt = opt . ‘-i ‘ | endif
 13   if &diffopt =~ ‘iwhite‘ | let opt = opt . ‘-b ‘ | endif
 14   let arg1 = v:fname_in
 15   if arg1 =~ ‘ ‘ | let arg1 = ‘"‘ . arg1 . ‘"‘ | endif
 16   let arg2 = v:fname_new
 17   if arg2 =~ ‘ ‘ | let arg2 = ‘"‘ . arg2 . ‘"‘ | endif
 18   let arg3 = v:fname_out
 19   if arg3 =~ ‘ ‘ | let arg3 = ‘"‘ . arg3 . ‘"‘ | endif
 20   let eq = ‘‘
 21   if $VIMRUNTIME =~ ‘ ‘
 22     if &sh =~ ‘\<cmd‘
 23       let cmd = ‘""‘ . $VIMRUNTIME . ‘\diff"‘
 24       let eq = ‘"‘
 25     else
 26       let cmd = substitute($VIMRUNTIME, ‘ ‘, ‘" ‘, ‘‘) . ‘\diff"‘
 27     endif
 28   else
 29     let cmd = $VIMRUNTIME . ‘\diff‘
 30   endif
 31   silent execute ‘!‘ . cmd . ‘ ‘ . opt . arg1 . ‘ ‘ . arg2 . ‘ > ‘ . arg3 . eq
 32 endfunction
 33
 34
 35 "-------------------------------------------
 36 " < Vundle >
 37 "-------------------------------------------
 38 filetype off
 39 set rtp+=$VIM/vimfiles/bundle/Vundle.vim
 40 call vundle#begin(‘$VIM/vimfiles/bundle/‘)
 41 Plugin ‘gmarik/Vundle.vim‘
 42 Plugin ‘L9‘
 43 Plugin ‘scrooloose/nerdtree‘
 44 Bundle ‘Valloric/YouCompleteMe‘
 45 Bundle ‘scrooloose/nerdcommenter‘
 46 Bundle ‘majutsushi/tagbar‘
 47 Bundle ‘ctrlpvim/ctrlp.vim‘
 48 Bundle ‘chazy/cscope_maps‘
 49 Bundle ‘vim-airline/vim-airline‘
 50 Bundle ‘tomasr/molokai‘
 51
 52 call vundle#end()
 53 filetype plugin indent on
 54
 55 "-------------------------------------------
 56 " < Cscope 配置 >
 57 "-------------------------------------------
 58 nnoremap <F6> :!cscope -Rbk <CR>
 59 nnoremap <F7> :cs add cscope.out
 60 set cscopetag
 61
 62 "-------------------------------------------
 63 " < YouCompleteMe 配置 >
 64 "-------------------------------------------
 65 let g:ycm_global_ycm_extra_conf =‘D:\Program Files\Vim\vimfiles\bundle\YouCompleteMe\third_party\ycmd\cpp\ycm\.ycm_extra_conf.py‘
 66 let g:ycm_complete_in_comments=1
 67 let g:ycm_seed_identifiers_with_syntax=1
 68
 69 nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>
 70 nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>
 71 nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
 72 nmap <F4> :YcmDiags<CR>
 73 set completeopt=longest,menu
 74
 75 let g:ycm_filetype_blacklist = {
 76             \ ‘tagbar‘ : 1,
 77             \ ‘qf‘ : 1,
 78             \ ‘notes‘ : 1,
 79             \ ‘markdown‘ : 1,
 80             \ ‘unite‘ : 1,
 81             \ ‘text‘ : 1,
 82             \ ‘vimwiki‘ : 1,
 83             \ ‘pandoc‘ : 1,
 84             \ ‘infolog‘ : 1,
 85             \ ‘mail‘ : 1,
 86             \ ‘mundo‘: 1,
 87             \ ‘fzf‘: 1,
 88             \ ‘ctrlp‘ : 1
 89             \}
 90
 91
 92 "-------------------------------------------
 93 " < airline >
 94 "-------------------------------------------
 95 "let g:airline#extensions#tabline#enabled = 1
 96
 97 "-------------------------------------------
 98 " < ctag >
 99 "-------------------------------------------
100 nnoremap <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
101 "nnoremap <F5> :!ctags --tag-relative=yes -f D:\Program Files\Vim --c++-kinds=+p --fields=+iaS --extra=+q -R *<CR>
102
103 "D:\Program Files\Vim\vimfiles\bundle\ctags
104 "nnoremap <F5> :!ctags -R -f D:\Program Files\Vim\tags\tags_self -R *<CR>
105 set autochdir
106 set tags=tags;
107 "set tags=./tags;../tags;../../tags;../../../tags;../../../../tags;../../../../../tags;../../../../../tags;
108 "set tags=./tags,tags;
109 "set tags=$Vim\tags\tags_self;
110
111 "-------------------------------------------
112 " < cscope >
113 "-------------------------------------------
114 nmap fa :cs find a <C-R>=expand("<cword>")<CR><CR>
115 nmap fc :cs find c <C-R>=expand("<cword>")<CR><CR>
116 nmap fd :cs find d <C-R>=expand("<cword>")<CR><CR>
117 nmap fe :cs find e <C-R>=expand("<cword>")<CR><CR>
118 nmap fg :cs find g <C-R>=expand("<cword>")<CR><CR>
119 nmap fi :cs find i <C-R>=expand("<cfile>")<CR><CR>
120 nmap fs :cs find s <C-R>=expand("<cword>")<CR><CR>
121 nmap ft :cs find t <C-R>=expand("<cword>")<CR><CR>
122 nmap ff :cs find f <C-R>=expand("<cfile>")<CR><CR>
123
124 "-------------------------------------------
125 " < CTRLP 配置 >
126 "-------------------------------------------
127 let g:ctrlp_map = ‘<c-p>‘
128 let g:ctrlp_cmd = ‘CtrlP‘
129 let g:ctrlp_working_path_mode = 1
130
131 "-------------------------------------------
132 " < NERDTree 配置 >
133 "-------------------------------------------
134 nmap <F2> :NERDTreeToggle  <CR>
135 autocmd VimEnter * NERDTree
136
137
138 "-------------------------------------------
139 " < TagBar 配置 >
140 "-------------------------------------------
141 map <F9> :TagbarToggle<CR>    "TagBar toggle
142 autocmd VimEnter * Tagbar
143 let g:tagbar_ctags_bin = ‘D:\Program Files\ctags58\ctags.exe‘
144
145 "-------------------------------------------
146 " < 不備份檔案設定 >
147 "-------------------------------------------
148 set nobackup
149 set noundofile
150 set noswapfile
151
152
153 "-------------------------------------------
154 " < 介面設定 >
155 "-------------------------------------------
156 set guifont=Consolas        "設定自型
157 set t_Co=256
158 set nu                        "設定行號
159 set incsearch                "搜尋關鍵字高亮度
160 set ai
161 set cursorline                "顯示cursorline
162 set tabstop=4
163 set shiftwidth=4
164 set ignorecase                "搜尋時忽略大小寫
165 syntax on                    "語法高亮度
166 "set bg=light
167 "colorscheme koehler
168 "colorscheme gruvbox
169 colorscheme molokai         "Git download
170 set laststatus=2            "set status line
171 set columns=180
172 set lines=50
173
174 "-------------------------------------------
175 " < 自定義快捷鍵 >
176 "-------------------------------------------
177 :nmap ,s :e $VIM/_vimrc
178 :imap ( ()<ESC>i
179 :imap { {<CR>}<ESC>O
180 :imap [ []<ESC>i
181 :imap aa     <C-N>
182 ":imap jk     <esc>
183 :nmap  qw    <C-Q>
184 :nmap jp    <C-W>
185
186
187 ":map     --> (normal/visual/operator pending)
188 ":nmap     --> (normal)
189 ":vmap     --> (visual)
190 ":omap     --> (operator pending)
191 ":imap     --> (insert)
192 ":cmap    --> (command line)
193 "Ctrl     --> <C-xxx>
194 "Alt    --> <M-xxx>
时间: 2024-08-12 18:52:15

(原創) Gvim 個人習慣常用設定的相关文章

改變人生的21種好習慣

當一個人生活枯燥的時候, 他忘了用心體會是一種習慣. 當一個人覺得人生乏味的時候, 他忘了培養幽默是一種習慣. 當一個人體力日差的時候, 他忘了運動建身是一種習慣. 當一個人工作疲憊的時候, 他忘了認真休息是一種習慣. 當一個人孤傲狂放的時候, 他忘了感恩惜福是一種習慣. 當一個人志得意滿的時候, 他忘了謙沖為懷是一種習慣. 當一個人錢不夠用的時候, 他忘了投資理財是一種習慣. 當一個人覺得工作低迷的時候, 他忘了激勵自己是一種習慣. 當一個人懷疑自己的時候, 他忘了建立自信是一種習慣. 當一個

個人資料管理的網頁系統

需求: 第一階段. 動態生成網頁,此網頁中顯示當前目錄下的文件結構,並可以瀏覽文本文檔以及內建圖片. 第一階段. 建立新的文本文檔,並用富文本的方式,可標記某一段文字顏色以及添加圖片,可以加載其他更多的文件類型,如excel, word, rtf, pdf 操作流程: 用java程式執行dos語句,生成文件目錄資料.整理目錄資料成樹形結構(此檔案留做備份,比對新的目錄有無變化). 用java寫出網頁 ============================== 利用批處理生成網頁 @echo o

懒人必备的移动端定宽网页适配方案

如今移动设备的分辨率纷繁复杂.以前仅仅是安卓机拥有各种各样的适配问题,如今 iPhone 也拥有了三种主流的分辨率,而未来的 iPhone 7 可能又会玩出什么新花样.如何以不变应万变,用简简单单的几行代码就能支持种类繁多的屏幕分辨率呢?今天就给大家介绍一种懒人必备的移动端定宽网页适配方法. 首先看看下面这行代码: <meta name="viewport" content="width=device-width, user-scalabel=no">

[转]好的類比工程師應該具有的素養 (純屬個人偏見 各位參考看看就好)

0.  謙虛為懷/不自滿驕傲/低調/少說多做/認真負責  待人處世態度 才是職場最重要的原則 而不是技術1.  必須了解負回授系統之穩定性與如何相位補償,各種電路負回授補償方式2.  必須會手算設計OP (noise, bandwidth, negative feedback etc.) 手算電路分析3.  必須學會IC fully custom layout technique (from PCB level system design combine with chip level floo

面對夢想道路上的困苦艱難坎坷,執著是最好的利刃,它會幫助壹個人劈開艱難,穿越困境,抵達鋪滿鮮花的夢想。

http://www.ebay.de/cln/6704143/-/188726588016/2015-03-15.html http://www.ebay.de/cln/6704143/-/188726590016/2015-03-15.html http://www.ebay.de/cln/6704143/-/188726596016/2015-03-15.html http://www.ebay.de/cln/6704143/-/188726599016/2015-03-15.html ht

大方而後個人太好人天津和水電費水電費

http://vlog.taihainet.com/play_l5hfhy9qbf4ejmra.html http://vlog.taihainet.com/play_zjfonwqav0uhcn34.html http://vlog.taihainet.com/play_z4tu008c4vxl12g5.html http://vlog.taihainet.com/play_3yx8zuewwixfncpa.html http://vlog.taihainet.com/play_okphdp3

WCF最简单的一次通信(有部分參考,多爲原創)

不廢話,直接上乾貨 1.先创建一个wcf服务库,是服务类库,远程的lib 2.全部按照默认设置,不修改.然后点发布,会出现一个wcf测试客户端,可以看有没有发布成功. 3.msdn的wcf教程还要求输出控制台命令,生成一些文件.如果简单使用其实不需要.现在创建一个控制台程序,作为客户端. 4.添加服务引用(类似webservice): 5.然后找到刚刚的wcf测试客户端,把服务器地址放上去.然后调用服务类库上的类,测试 切記:保持剛剛的 是開啓狀態:否則連接不到. 結果如下:   至此,最简单的

[個人紀錄] WindowsLiveWriter 插入代碼跳出錯誤

跳出找不到設定檔Can't load configruaration fromC:\Users\-\AppData\Roaming\Windows Live Writer\WindowsLiveWriter.SourceCode.config 只要繼續點確定,一樣可以進入插入代碼的視窗中 再點選Option選擇你的設定,再點OK(直接點也可以), 下次再打開plugin就不會再跳錯誤了

Debian常用設置

1. 更新軟件源 sudo cp /etc/apt/sources.list /etc/apt/sources.list_bak #備份 sudo vi /etc/apt/sources.list /etc/apt/sources.list 文件內容 # # deb cdrom:[Debian GNU/Linux 7 _Wheezy_ - Official Snapshot i386 LIVE/INSTALL Binary 20150114-04:45]/ wheezy main deb cdr