锘??xml version="1.0" encoding="utf-8" standalone="yes"?>毛片网站在线,亚洲缚视频在线观看,欧美成人一区在线http://www.aygfsteel.com/cuke/archive/2011/11/24/364758.html#364761H.CH.CThu, 24 Nov 2011 10:07:00 GMThttp://www.aygfsteel.com/cuke/archive/2011/11/24/364758.html#364761
鍔犲叆Buttongroup


瑙﹀彂緇勪歡鐨勭洃鍚?br> public void actionPerformed(ActionEvent e){
if(jrbBox.isSelected()){
System.out.println("浣犻夋嫨浜嗭細"+jrbBox.getText());
}
if(jrbGirl .isSelected()){
System.out.println("浣犻夋嫨浜嗭細"+jrbGirl .getText());
}

H.C 2011-11-24 18:07 鍙戣〃璇勮
]]>
re: ubuntu 涓枃涔辯爜http://www.aygfsteel.com/cuke/archive/2011/11/12/363565.html#363567H.CH.CSat, 12 Nov 2011 02:16:00 GMThttp://www.aygfsteel.com/cuke/archive/2011/11/12/363565.html#363567
錛?錛?etc/enviroment 鏄郴緇熺殑鐜鍙橀噺銆?br>
錛?錛?etc/profile錛?鏄墍鏈夌敤鎴風殑鐜鍙橀噺銆傚綋鐢ㄦ埛絎竴嬈$櫥褰曟椂,璇ユ枃浠惰鎵ц. 騫朵粠/etc/profile.d鐩綍鐨勯厤緗枃浠朵腑鎼滈泦shell鐨勮緗?br>
錛?錛?etc/bashrc: 涓烘瘡涓涓繍琛宐ash shell鐨勭敤鎴鋒墽琛屾鏂囦歡.褰揵ash shell琚墦寮鏃?璇ユ枃浠惰璇誨彇銆?br>
錛?錛墌/.bash_profile: 姣忎釜鐢ㄦ埛閮藉彲浣跨敤璇ユ枃浠惰緭鍏ヤ笓鐢ㄤ簬鑷繁浣跨敤鐨剆hell淇℃伅,褰撶敤鎴風櫥褰曟椂,璇ユ枃浠朵粎浠呮墽琛屼竴嬈?榛樿鎯呭喌涓?浠栬緗竴浜涚幆澧冨彉閲?鎵ц鐢ㄦ埛鐨?bashrc鏂囦歡銆?br>
錛?錛墌/.bashrc: 璇ユ枃浠跺寘鍚笓鐢ㄤ簬浣犵殑bash shell鐨刡ash淇℃伅,褰撶櫥褰曟椂浠ュ強姣忔鎵撳紑鏂扮殑shell鏃?璇ヨ鏂囦歡琚鍙栥?br>
錛?錛?~/.bash_logout:褰撴瘡嬈¢鍑虹郴緇?閫鍑篵ash shell)鏃?鎵ц璇ユ枃浠? 鍙﹀,/etc/profile涓瀹氱殑鍙橀噺(鍏ㄥ眬)鐨勫彲浠ヤ綔鐢ㄤ簬浠諱綍鐢ㄦ埛,鑰寏/.bashrc絳変腑璁懼畾鐨勫彉閲?灞閮?鍙兘緇ф壙 /etc/profile涓殑鍙橀噺,浠栦滑鏄濈埗瀛愨濆叧緋匯?br>
錛?錛墌/.bash_profile 鏄氦浜掑紡銆乴ogin 鏂瑰紡榪涘叆 bash 榪愯鐨剘/.bashrc 鏄氦浜掑紡 non-login 鏂瑰紡榪涘叆 bash 榪愯鐨勯氬父浜岃呰緗ぇ鑷寸浉鍚岋紝鎵浠ラ氬父鍓嶈呬細璋冪敤鍚庤呫?img src ="http://www.aygfsteel.com/cuke/aggbug/363567.html" width = "1" height = "1" />

H.C 2011-11-12 10:16 鍙戣〃璇勮
]]>
re: VIM for java IDEhttp://www.aygfsteel.com/cuke/archive/2011/11/11/362411.html#363539H.CH.CFri, 11 Nov 2011 08:25:00 GMThttp://www.aygfsteel.com/cuke/archive/2011/11/11/362411.html#363539
taglist闇瑕乧tags鏀寔

ctags.exe錛?a target="_new">http://ctags.sourceforge.net/

taglist鏄劇ずtag鍒楄〃

taglist錛?a target="_new">http://www.vim.org/scripts/script.php?script_id=273

鏄劇ずbuf鍒楄〃錛?br>
bufexplorer錛?a target="_new">http://www.vim.org/scripts/script.php?script_id=42

Nerd_Tree鏂囦歡嫻忚

Nerd_tree錛?a target="_new">http://www.vim.org/scripts/script.php?script_id=1658

鐣岄潰綆$悊鎻掍歡錛?br>
winmanager錛?a target="_new">http://www.vim.org/scripts/script.php?script_id=95



涓銆乧tags錛?br>
涓嬭澆瑙e帇鍚庢槸婧愮爜錛屾劅瑙夊氨閭d釜exe鏂囦歡鏈夌偣鐢ㄣ傜洿鎺ユ斁鍒頒竴涓洰褰曢噷錛孌:\ctags58銆?br>
璁劇疆涓涓嬬幆澧冨彉閲忋俻ath=D:\ctags58銆傝繖鏍峰彲浠ョ洿鎺ヨ繍琛岀洰褰曚笅闈㈢殑ctags.exe鏂囦歡銆傛垨鑰呯洿鎺ユ妸ctags.exe鏀懼叆windows鐨勭洰褰曢噷銆?br>
vimrc涓殑璁劇疆錛?br>view sourceprint?
1 "鐢熸垚涓涓猼ags鏂囦歡
2 nmap <F9> <Esc>:!ctags -R *<CR>



浜屻乼aglist璁劇疆錛?br>
涓嬭澆瑙e帇鍒扮浉搴旂殑vim鏂囦歡澶逛腑銆?br>
vimrc涓緗細
view sourceprint?
01 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
02
03 "璁劇疆Taglist
04
05 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
06
07 " 榪欓」蹇呴』璁懼畾錛屽惁鍒欏嚭閿?閰嶇疆taglist鐨刢tags璺緞
08
09 let Tlist_Ctags_Cmd = 'D:\ctags58\ctags.exe'
10
11
12
13 " 涓嶅悓鏃舵樉紺哄涓枃浠剁殑 tag 錛屽彧鏄劇ず褰撳墠鏂囦歡鐨?br>14
15 let Tlist_Show_One_File=1
16
17
18
19 " 濡傛灉 taglist 紿楀彛鏄渶鍚庝竴涓獥鍙o紝鍒欓鍑?vim
20
21 let Tlist_Exit_OnlyWindow=1
22
23
24
25 "璁╁綋鍓嶄笉琚紪杈戠殑鏂囦歡鐨勬柟娉曞垪琛ㄨ嚜鍔ㄦ姌鍙犺搗鏉?br>26
27 let Tlist_File_Fold_Auto_Close=1
28
29
30
31 "鎶妕aglist紿楀彛鏀懼湪灞忓箷鐨勫彸渚э紝緙虹渷鍦ㄥ乏渚?br>32
33 let Tlist_Use_Right_Window=1
34
35
36
37 "鏄劇ずtaglist鑿滃崟
38
39 let Tlist_Show_Menu=1
40
41
42
43 "鍚姩vim鑷姩鎵撳紑taglist
44
45 "let Tlist_Auto_Open=1

鍚姩鑷姩鎵撳紑榪欎釜閫夐」鏆傛椂涓嶈緗傚悗闈㈣璁﹚inmanager璋冪敤taglist銆?br>


涓夈乥ufexplorer錛?br>
涓嬭澆瑙e帇錛屾病鍟ヨ鐨勩?br>


鍥涖亀inmanager錛?br>
涓嬭澆瑙e帇錛寁imrc涓殑璁劇疆錛?br>view sourceprint?
01 """""""""""""""""""""""""""""""
02
03 "" winManager setting
04
05 """""""""""""""""""""""""""""""
06
07 "璁劇疆鐣岄潰鍒嗗壊
08
09 "let g:winManagerWindowLayout = "BufExplorer,FileExplorer|TagList"
10
11 let g:winManagerWindowLayout = "TagList|FileExplorer,BufExplorer"
12
13
14
15 "璁劇疆winmanager鐨勫搴︼紝榛樿涓?5
16
17 let g:winManagerWidth = 30
18
19
20
21 "瀹氫箟鎵撳紑鍏抽棴winmanager鎸夐敭
22
23 nmap <silent> <F8> :WMToggle<cr>



浠ヤ笂3涓彃浠跺畨瑁呰緗畬姣曞悗錛屽熀鏈殑鐣岄潰鍔熻兘灝卞彲浠ュ疄鐜頒簡銆傛寜F8鍙互鎵撳紑/鍏抽棴鐣岄潰銆傚悓鏃舵樉紺簍aglist鍜宖ileexplorer銆傚湪fileexplorer紿楀彛涓寜<c-n>鍙互鍒囨崲鍒癰ufexplorer紿楀彛銆?br>
涓婅堪璁劇疆濂藉悗錛屾湁3涓棶棰橈細

1 鎴戞兂璁╂彃浠舵樉紺哄湪鍙充晶錛屼絾鏄痺inmanager閲岄潰娌℃湁姝ら夐」

2 榪涘叆vim鏃跺欎笉鑳借嚜鍔ㄦ墦寮winmanager錛寃inmanager涓嶅儚taglist鏀寔璇ュ姛鑳?br>
3 閫鍑烘椂涓嶄細鍍忓彧鏈塼aglist鏃跺欓偅鏍鳳紝閫鍑哄綋鍓嶆枃浠跺氨浼氶鍑簐im浜?br>
緇忚繃澶氭淇敼浠g爜緇堜簬瀹炲湪浜嗕笂榪?涓姛鑳姐?br>


浜斻佸皢鎻掍歡鏄劇ず鍦ㄥ彸渚?br>
鎵撳紑winmanager.vim錛屽湪function! <SID>StartWindowsManager()鍑芥暟涓慨鏀癸細

灝嗭細wincmd H 淇敼涓簑incmd L錛?br>view sourceprint?
1 " for now assume that the explorer windows always stay on the left.
2
3 " TODO: make this optional later
4
5 " make the explorers window always stay on the right ---by chenyong
6
7 " wincmd H
8
9 wincmd L



鍏佽繘鍏im鑷姩鎵撳紑winmanager

榪欎釜鍔熻兘浣滀負鍙夊姛鑳斤紝鎴戜滑鍙互鍦╲imrc涓緗細
view sourceprint?
1 "鍦ㄨ繘鍏im鏃惰嚜鍔ㄦ墦寮winmanager
2
3 let g:AutoOpenWinManager = 1

灝卞彲浠ヨwinmanager鑷姩鎵撳紑銆?br>
鍦╳inmanager.vim涓慨鏀癸細

view sourceprint?
1 "set auto open Winmanager
2
3 if g:AutoOpenWinManager
4
5 autocmd VimEnter * nested call s:StartWindowsManager()|1wincmd w
6
7 endif



涓冦侀鍑虹紦鍐插尯鏃訛紝鑷姩閫鍑簐im

榪欎釜鍔熻兘鏄弬鑰冧簡taglist鐨勮嚜鍔ㄩ鍑哄姛鑳斤紝鍦╰aglist.vim涓慨鏀圭殑銆?br>
鍑芥暟錛歠unction! s:Tlist_Window_Exit_Only_Window()涓殑winbunr(2)鏀逛負winbunr(3)錛屽嵆鍙墿2涓獥鍙f椂鍏抽棴錛岃冭檻鍒?涓獥鍙h偗瀹氭槸鍚屾椂瀛樺湪錛屾墍浠ヨ繖鏍瘋繕鏄彲琛岀殑錛?br>view sourceprint?
01 function! s:Tlist_Window_Exit_Only_Window()
02
03 " Before quitting Vim, delete the taglist buffer so that
04
05 " the '0 mark is correctly set to the previous buffer.
06
07 if v:version < 700
08
09 if winbufnr(3) == -1
10
11 bdelete
12
13 quit
14
15 endif
16
17 else
18
19 if winbufnr(3) == -1
20
21 if tabpagenr('$') == 1
22
23 " Only one tag page is present
24
25 bdelete
26
27 quit
28
29 else
30
31 " More than one tab page is present. Close only the current
32
33 " tab page
34
35 close
36
37 endif
38
39 endif
40
41 endif
42
43 endfunction

鍚屾椂鍦╲imrc涓渶瑕佽緗細
view sourceprint?
1 let Tlist_Exit_OnlyWindow=1


winmanager鑷甫鐨刦ileexplorer榪欎釜鎻掍歡瀹炲湪鏄瘮杈冨樊銆傛渶閲嶈鐨勪竴鐐規槸fileexplorer涓嶈兘鑷姩鏇存柊錛屽鏋滈氳繃鍏朵粬鐨勯斿緞淇敼浜嗘枃浠跺す涓殑鍐呭錛宖ileexplorer鏄笉浼氭樉紺虹殑銆傜浉瀵硅岃█Nerd_Tree 鍔熻兘灝辨瘮杈冨己澶т簡銆備笅闈㈣鎶奛erd_Tree鍔犲叆winmanager銆?br>
鍥涖丯erd_tree錛?br>
涓嬭澆瑙e帇錛屾墦寮NERD_tree.vim錛屾寜鐓inmanager鐨勮鏄庯紝鍦ㄦ渶鍚庡姞鍏ヤ笅闈唬鐮侊細
view sourceprint?
01 "Used by winmanager {{{1
02
03 let g:NERDTree_title = "[NERDTree]"
04
05 function! NERDTree_Start()
06
07 exe 'NERDTree'
08
09 endfunction
10
11
12
13 function! NERDTree_IsValid()
14
15 return 1
16
17 endfunction

鍚屾椂鎶婂湪vimrc涓細
view sourceprint?
1 let g:winManagerWindowLayout='NERDTree|TagList,BufExplorer'

鍘熸潵鐨勮緗敞閲婃帀銆傚姞濂藉悗錛屽彂鐜版瘡嬈℃墦寮winmanager閮戒細鍑虹幇涓涓┖鐧界殑buffer銆傝瘯楠屼簡濂藉嬈★紝浣嗘槸Nerd_tree璋冪敤鐨勫嚱鏁板氨鏄細鎵撳紑涓涓柊紿楀彛銆傚洜涓哄姝わ紝灝哹ufExplorer鍜孨ERD_Tree鏀懼湪涓璧蜂細鏄劇ず涓嶆甯搞侼ERD_Tree鏀懼湪涓嬮潰鐨勭獥鍙d篃浼氬嚭閿欙紝瀹炲湪姣旇緝閮侀椃銆傘傘傘傜湅浜嗕笅NERD_Tree鐨勪唬鐮侊紝娌$湅鎳傦紝鍙ソ鍐嶆鏀箇inmanager鐨勪唬鐮佷簡銆?br>
鎵撳紑winmanager.vim錛屾壘鍒板嚱鏁癴unction! <SID>ToggleWindowsManager()錛屽姞鍏ヤ袱琛岋紝淇敼鍚庢暣涓嚱鏁板涓嬶細




view sourceprint?
01 " toggle showing the explorer plugins.
02 function! <SID>ToggleWindowsManager()
03 if IsWinManagerVisible()
04 call s:CloseWindowsManager()
05 else
06 call s:StartWindowsManager()
07 " NERD_tree need this. 鎵撳紑鏃朵細鏈変竴涓┖鐧界獥鍙o紝瑕佹妸浠栧叧闂?br>08 exe '1wincmd w'
09 exe 'q'
10 end
11 endfunction



鍔犱釜娉ㄩ噴錛屼互鍏嶄互鍚庡繕鎺変簡錛屽鏋滀笉鎯崇敤nerd_Tree浜嗭紝榪?鍙ヨ瘽榪樺緱鍒犳帀銆?br>


鍙﹀鎵撳紑鏃剁殑鍛戒護鍜屽叧闂椂鐨勫懡浠や篃寰楀悓鏃朵慨鏀逛簡錛岃瘯楠屼簡寰堝嬈★細

taglist.vim涓紝鎵懼埌涓嬮潰鐨勪唬鐮侊細


view sourceprint?
1 " Exit Vim itself if only the taglist window is present (optional)
2 " if g:Tlist_Exit_OnlyWindow
3 " autocmd BufEnter __Tag_List__ nested
4 " \ call s:Tlist_Window_Exit_Only_Window()
5 " endif



灝嗚繖孌典唬鐮佷慨鏀逛負錛?br>

view sourceprint?
01 " Exit Vim itself if only the taglist window is present (optional)
02 let s:NERDTreeBufName = 'NERD_tree_'
03 if g:Tlist_Exit_OnlyWindow
04 augroup Exit_onlywindow
05 "褰撹繘鍏erd_Tree鐨刡uffer鏃朵篃媯嫻嬫槸鍚﹂渶瑕侀鍑?br>06 exec "autocmd BufEnter ". s:NERDTreeBufName .
07 \"* call s:Tlist_Window_Exit_Only_Window()"
08 autocmd BufEnter __Tag_List__ nested
09 \ call s:Tlist_Window_Exit_Only_Window()
10 augroup end
11 endif



winmanager涓細鍒氭墠娣誨姞鐨勮嚜鍔ㄦ墽琛屽懡浠よ鏀逛負錛?br>

view sourceprint?
1 "set auto open Winmanager
2 if g:AutoOpenWinManager
3 " autocmd VimEnter * nested call s:StartWindowsManager()|1wincmd w
4 autocmd VimEnter * nested call s:StartWindowsManager()|1wincmd w|q
5 endif

榪欐牱鎵鏈夌殑鍔熻兘灝卞疄鐜頒簡銆傚湪taglist紿楀彛浣跨敤ctrl+n鍙互杞崲鍒癰ufexplorer紿楀彛銆?img src ="http://www.aygfsteel.com/cuke/aggbug/363539.html" width = "1" height = "1" />

H.C 2011-11-11 16:25 鍙戣〃璇勮
]]>
re: VIM for java IDEhttp://www.aygfsteel.com/cuke/archive/2011/11/09/362411.html#363350H.CH.CWed, 09 Nov 2011 13:52:00 GMThttp://www.aygfsteel.com/cuke/archive/2011/11/09/362411.html#363350" Maintainer: amix the lucky stiff
" http://amix.dk - amix@amix.dk
"
" Version: 3.6 - 25/08/10 14:40:30
"
" Blog_post:
" http://amix.dk/blog/post/19486#The-ultimate-vim-configuration-vimrc
" Syntax_highlighted:
" http://amix.dk/vim/vimrc.html
" Raw_version:
" http://amix.dk/vim/vimrc.txt
"
" How_to_Install_on_Unix:
" $ mkdir ~/.vim_runtime
" $ svn co svn://orangoo.com/vim ~/.vim_runtime
" $ cat ~/.vim_runtime/install.sh
" $ sh ~/.vim_runtime/install.sh <system>
" <sytem> can be `mac`, `linux` or `windows`
"
" How_to_Upgrade:
" $ svn update ~/.vim_runtime
"
" Sections:
" -> General
" -> VIM user interface
" -> Colors and Fonts
" -> Files and backups
" -> Text, tab and indent related
" -> Visual mode related
" -> Command mode related
" -> Moving around, tabs and buffers
" -> Statusline
" -> Parenthesis/bracket expanding
" -> General Abbrevs
" -> Editing mappings
"
" -> Cope
" -> Minibuffer plugin
" -> Omni complete functions
" -> Python section
" -> JavaScript section
"
"
" Plugins_Included:
" > minibufexpl.vim - http://www.vim.org/scripts/script.php?script_id=159
" Makes it easy to get an overview of buffers:
" info -> :e ~/.vim_runtime/plugin/minibufexpl.vim
"
" > bufexplorer - http://www.vim.org/scripts/script.php?script_id=42
" Makes it easy to switch between buffers:
" info -> :help bufExplorer
"
" > yankring.vim - http://www.vim.org/scripts/script.php?script_id=1234
" Emacs's killring, useful when using the clipboard:
" info -> :help yankring
"
" > surround.vim - http://www.vim.org/scripts/script.php?script_id=1697
" Makes it easy to work with surrounding text:
" info -> :help surround
"
" > snipMate.vim - http://www.vim.org/scripts/script.php?script_id=2540
" Snippets for many languages (similar to TextMate's):
" info -> :help snipMate
"
" > mru.vim - http://www.vim.org/scripts/script.php?script_id=521
" Plugin to manage Most Recently Used (MRU) files:
" info -> :e ~/.vim_runtime/plugin/mru.vim
"
" > Command-T - http://www.vim.org/scripts/script.php?script_id=3025
" Command-T plug-in provides an extremely fast, intuitive mechanism for opening filesa:
" info -> :help CommandT
" screencast and web-help -> http://amix.dk/blog/post/19501
"
"
" Revisions:
" > 3.6: Added lots of stuff (colors, Command-T, Vim 7.3 persistent undo etc.)
" > 3.5: Paste mode is now shown in status line if you are in paste mode
" > 3.4: Added mru.vim
" > 3.3: Added syntax highlighting for Mako mako.vim
" > 3.2: Turned on python_highlight_all for better syntax
" highlighting for Python
" > 3.1: Added revisions ;) and bufexplorer.vim
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
set history=700

" Enable filetype plugin
filetype plugin on
filetype indent on

" Set to auto read when a file is changed from the outside
set autoread

" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
let g:mapleader = ","

" Fast saving
nmap <leader>w :w!<cr>

" Fast editing of the .vimrc
map <leader>e :e! ~/.vim_runtime/vimrc<cr>

" When vimrc is edited, reload it
autocmd! bufwritepost vimrc source ~/.vim_runtime/vimrc


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set 7 lines to the curors - when moving vertical..
set so=7

set wildmenu "Turn on WiLd menu

set ruler "Always show current position

set cmdheight=2 "The commandbar height

set hid "Change buffer - without saving

" Set backspace config
set backspace=eol,start,indent
set whichwrap+=<,>,h,l

set ignorecase "Ignore case when searching
set smartcase

set hlsearch "Highlight search things

set incsearch "Make search act like search in modern browsers
set nolazyredraw "Don't redraw while executing macros

set magic "Set magic on, for regular expressions

set showmatch "Show matching bracets when text indicator is over them
set mat=2 "How many tenths of a second to blink

" No sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax enable "Enable syntax hl

" Set font according to system
if MySys() == "mac"
set gfn=Menlo:h14
set shell=/bin/bash
elseif MySys() == "windows"
set gfn=Bitstream\ Vera\ Sans\ Mono:h10
elseif MySys() == "linux"
set gfn=Monospace\ 10
set shell=/bin/bash
endif

if has("gui_running")
set guioptions-=T
set t_Co=256
set background=dark
colorscheme peaksea
set nonu
else
colorscheme zellner
set background=dark

set nonu
endif

set encoding=utf8
try
lang en_US
catch
endtry

set ffs=unix,dos,mac "Default file types


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git anyway...
set nobackup
set nowb
set noswapfile

"Persistent undo
try
if MySys() == "windows"
set undodir=C:\Windows\Temp
else
set undodir=~/.vim_runtime/undodir
endif

set undofile
catch
endtry


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set expandtab
set shiftwidth=4
set tabstop=4
set smarttab

set lbr
set tw=500

set ai "Auto indent
set si "Smart indet
set wrap "Wrap lines


""""""""""""""""""""""""""""""
" => Visual mode related
""""""""""""""""""""""""""""""
" Really useful!
" In visual mode when you press * or # to search for the current selection
vnoremap <silent> * :call VisualSearch('f')<CR>
vnoremap <silent> # :call VisualSearch('b')<CR>

" When you press gv you vimgrep after the selected text
vnoremap <silent> gv :call VisualSearch('gv')<CR>
map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>


function! CmdLine(str)
exe "menu Foo.Bar :" . a:str
emenu Foo.Bar
unmenu Foo
endfunction

" From an idea by Michael Naumann
function! VisualSearch(direction) range
let l:saved_reg = @"
execute "normal! vgvy"

let l:pattern = escape(@", '\\/.*$^~[]')
let l:pattern = substitute(l:pattern, "\n$", "", "")

if a:direction == 'b'
execute "normal ?" . l:pattern . "^M"
elseif a:direction == 'gv'
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.')
elseif a:direction == 'f'
execute "normal /" . l:pattern . "^M"
endif

let @/ = l:pattern
let @" = l:saved_reg
endfunction



"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Command mode related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Smart mappings on the command line
cno $h e ~/
cno $d e ~/Desktop/
cno $j e ./
cno $c e <C-\>eCurrentFileDir("e")<cr>

" $q is super useful when browsing on the command line
cno $q <C-\>eDeleteTillSlash()<cr>

" Bash like keys for the command line
cnoremap <C-A> <Home>
cnoremap <C-E> <End>
cnoremap <C-K> <C-U>

cnoremap <C-P> <Up>
cnoremap <C-N> <Down>

" Useful on some European keyboards
map ½ $
imap ½ $
vmap ½ $
cmap ½ $


func! Cwd()
let cwd = getcwd()
return "e " . cwd
endfunc

func! DeleteTillSlash()
let g:cmd = getcmdline()
if MySys() == "linux" || MySys() == "mac"
let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*", "\\1", "")
else
let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\]\\).*", "\\1", "")
endif
if g:cmd == g:cmd_edited
if MySys() == "linux" || MySys() == "mac"
let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*/", "\\1", "")
else
let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\\]\\).*\[\\\\\]", "\\1", "")
endif
endif
return g:cmd_edited
endfunc

func! CurrentFileDir(cmd)
return a:cmd . " " . expand("%:p:h") . "/"
endfunc


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around, tabs and buffers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map space to / (search) and c-space to ? (backgwards search)
map <space> /
map <c-space> ?
map <silent> <leader><cr> :noh<cr>

" Smart way to move btw. windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l

" Close the current buffer
map <leader>bd :Bclose<cr>

" Close all the buffers
map <leader>ba :1,300 bd!<cr>

" Use the arrows to something usefull
map <right> :bn<cr>
map <left> :bp<cr>

" Tab configuration
map <leader>tn :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove

" When pressing <leader>cd switch to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>


command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")

if buflisted(l:alternateBufNum)
buffer #
else
bnext
endif

if bufnr("%") == l:currentBufNum
new
endif

if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
endfunction

" Specify the behavior when switching between buffers
try
set switchbuf=usetab
set stal=2
catch
endtry


""""""""""""""""""""""""""""""
" => Statusline
""""""""""""""""""""""""""""""
" Always hide the statusline
set laststatus=2

" Format the statusline
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c


function! CurDir()
let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")
return curdir
endfunction

function! HasPaste()
if &paste
return 'PASTE MODE '
else
return ''
endif
endfunction


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Parenthesis/bracket expanding
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
vnoremap $1 <esc>`>a)<esc>`<i(<esc>
vnoremap $2 <esc>`>a]<esc>`<i[<esc>
vnoremap $3 <esc>`>a}<esc>`<i{<esc>
vnoremap $$ <esc>`>a"<esc>`<i"<esc>
vnoremap $q <esc>`>a'<esc>`<i'<esc>
vnoremap $e <esc>`>a"<esc>`<i"<esc>

" Map auto complete of (, ", ', [
inoremap $1 ()<esc>i
inoremap $2 []<esc>i
inoremap $3 {}<esc>i
inoremap $4 {<esc>o}<esc>O
inoremap $q ''<esc>i
inoremap $e ""<esc>i
inoremap $t <><esc>i


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General Abbrevs
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Editing mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Remap VIM 0
map 0 ^

"Move a line of text using ALT+[jk] or Comamnd+[jk] on mac
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z

if MySys() == "mac"
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
endif

"Delete trailing white space, useful for Python ;)
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()

set guitablabel=%t


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Cope
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Do :help cope if you are unsure what cope is. It's super useful!
map <leader>cc :botright cope<cr>
map <leader>n :cn<cr>
map <leader>p :cp<cr>


""""""""""""""""""""""""""""""
" => bufExplorer plugin
""""""""""""""""""""""""""""""
let g:bufExplorerDefaultHelp=0
let g:bufExplorerShowRelativePath=1
map <leader>o :BufExplorer<cr>


""""""""""""""""""""""""""""""
" => Minibuffer plugin
""""""""""""""""""""""""""""""
let g:miniBufExplModSelTarget = 1
let g:miniBufExplorerMoreThanOne = 2
let g:miniBufExplModSelTarget = 0
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplVSplit = 25
let g:miniBufExplSplitBelow=1

let g:bufExplorerSortBy = "name"

autocmd BufRead,BufNew :call UMiniBufExplorer

map <leader>u :TMiniBufExplorer<cr>


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Omni complete functions
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd FileType css set omnifunc=csscomplete#CompleteCSS


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Spell checking
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Pressing ,ss will toggle and untoggle spell checking
map <leader>ss :setlocal spell!<cr>

"Shortcuts using <leader>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=


""""""""""""""""""""""""""""""
" => Python section
""""""""""""""""""""""""""""""
let python_highlight_all = 1
au FileType python syn keyword pythonDecorator True None False self

au BufNewFile,BufRead *.jinja set syntax=htmljinja
au BufNewFile,BufRead *.mako set ft=mako

au FileType python inoremap <buffer> $r return
au FileType python inoremap <buffer> $i import
au FileType python inoremap <buffer> $p print
au FileType python inoremap <buffer> $f #--- PH ----------------------------------------------<esc>FP2xi
au FileType python map <buffer> <leader>1 /class
au FileType python map <buffer> <leader>2 /def
au FileType python map <buffer> <leader>C ?class
au FileType python map <buffer> <leader>D ?def


""""""""""""""""""""""""""""""
" => JavaScript section
"""""""""""""""""""""""""""""""
au FileType javascript call JavaScriptFold()
au FileType javascript setl fen
au FileType javascript setl nocindent

au FileType javascript imap <c-t> AJS.log();<esc>hi
au FileType javascript imap <c-a> alert();<esc>hi

au FileType javascript inoremap <buffer> $r return
au FileType javascript inoremap <buffer> $f //--- PH ----------------------------------------------<esc>FP2xi

function! JavaScriptFold()
setl foldmethod=syntax
setl foldlevelstart=1
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend

function! FoldText()
return substitute(getline(v:foldstart), '{.*', '{...}', '')
endfunction
setl foldtext=FoldText()
endfunction


""""""""""""""""""""""""""""""
" => MRU plugin
""""""""""""""""""""""""""""""
let MRU_Max_Entries = 400
map <leader>f :MRU<CR>


""""""""""""""""""""""""""""""
" => Command-T
""""""""""""""""""""""""""""""
let g:CommandTMaxHeight = 15
set wildignore+=*.o,*.obj,.git,*.pyc
noremap <leader>j :CommandT<cr>
noremap <leader>y :CommandTFlush<cr>


""""""""""""""""""""""""""""""
" => Vim grep
""""""""""""""""""""""""""""""
let Grep_Skip_Dirs = 'RCS CVS SCCS .svn generated'
set grepprg=/bin/grep\ -nH



"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => MISC
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm

"Quickly open a buffer for scripbble
map <leader>q :e ~/buffer<cr>
au BufRead,BufNewFile ~/buffer iab <buffer> xh1 ===========================================

map <leader>pp :setlocal paste!<cr>

map <leader>bb :cd ..<cr>


H.C 2011-11-09 21:52 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 开鲁县| 张掖市| 石嘴山市| 望都县| 嘉祥县| 锡林郭勒盟| 金坛市| 开化县| 林芝县| 高邑县| 保德县| 满洲里市| 嫩江县| 娄烦县| 昌黎县| 原平市| 出国| 和政县| 丘北县| 定陶县| 门头沟区| 大邑县| 磐安县| 弥渡县| 泗阳县| 乐至县| 手游| 光泽县| 永登县| 莲花县| 襄樊市| 本溪| 青阳县| 剑阁县| 门源| 沽源县| 离岛区| 屏东县| 汾阳市| 青铜峡市| 天气|