GVIM 포터블 설치
Downloads -> GVim_Portable_7.1.0.zip 다운로드 후 압축 해제
Downloads -> GVim_Portable_7.1.0.zip 다운로드 후 압축 해제 내가 가지고 있는 것은 포터블 7.3 버전인데 이걸 어디서 받았는지 도저히 기억이 안나네요ㅋㅋ 그래서 7.1 사이트 링크 합니다.
GVIM 셋팅은 인터넷에서 하나씩 검색하면서 셋팅을 하는데에 많은 도움을 받았기 때문에 저도 처음 셋팅 하는 분에게는 도움을 드리고자 이렇게 VIM 환경셋팅을 정리해봅니다. 아직 부족한게 좀 있지만 초보분들에게는 이정도만 해도 사용하는데 어려움이 없을듯 합니다. 진행을 해보면서 문서가 이해가 안되는 부분이나 부족한 부분이 있으면 댓글 남겨 주시면 바로 수정 수정 하면서 좋은 문서로 만들어 가보려 합니다.
참고로 AutoComplPop을 사용하여 단어자동완성을 사용하는데 SuperTab 으로 이동을 합니다. 그런데 SnipMate 플러그인을 설치하게 되면 탭 이동이 안되고 일반적인 탭기능인 띄어쓰기가 동작하는데 이 충돌에 대해서 해결법을 가지고 계신분을 댓글 남겨 주세요 ㅜㅜ
● 현재 까지 GVIM 셋팅한 화면을 캡쳐
vundle mswin.vim
source $VIMRUNTIME/vimrc/mswin.vim |
" Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: Bram Moolenaar <Bram@vim.org> " Last change: 2006 Apr 02 " bail out if this isn't wanted (mrsvim.vim uses this). if exists("g:skip_loading_mswin") && g:skip_loading_mswin finish endif " set the 'cpoptions' to its Vim default if 1 " only do this when compiled with expression evaluation let s:save_cpo = &cpoptions endif set cpo&vim " set 'selection', 'selectmode', 'mousemodel' and 'keymodel' for MS-Windows behave mswin " backspace and cursor keys wrap to previous/next line set backspace=indent,eol,start whichwrap+=<,>,[,] " backspace in Visual mode deletes selection vnoremap <BS> d " CTRL-X and SHIFT-Del are Cut vnoremap <C-X> "+x vnoremap <S-Del> "+x " CTRL-C and CTRL-Insert are Copy vnoremap <C-C> "+y vnoremap <C-Insert> "+y " CTRL-V and SHIFT-Insert are Paste map <C-V> "+gP map <S-Insert> "+gP cmap <C-V> <C-R>+ cmap <S-Insert> <C-R>+ " Pasting blockwise and linewise selections is not possible in Insert and " Visual mode without the +virtualedit feature. They are pasted as if they " were characterwise instead. " Uses the paste.vim autoload script. exe 'inoremap <script> <C-V>' paste#paste_cmd['i'] exe 'vnoremap <script> <C-V>' paste#paste_cmd['v'] imap <S-Insert> <C-V> vmap <S-Insert> <C-V> " Use CTRL-Q to do what CTRL-V used to do noremap <C-Q> <C-V> " Use CTRL-S for saving, also in Insert mode noremap <C-S> :update<CR> vnoremap <C-S> <C-C>:update<CR> inoremap <C-S> <C-O>:update<CR> " For CTRL-V to work autoselect must be off. " On Unix we have two selections, autoselect can be used. if !has("unix") set guioptions-=a endif " CTRL-Z is Undo; not in cmdline though noremap <C-Z> u inoremap <C-Z> <C-O>u " CTRL-Y is Redo (although not repeat); not in cmdline though noremap <C-Y> <C-R> inoremap <C-Y> <C-O><C-R> " Alt-Space is System menu if has("gui") noremap <M-Space> :simalt ~<CR> inoremap <M-Space> <C-O>:simalt ~<CR> cnoremap <M-Space> <C-C>:simalt ~<CR> endif " CTRL-A is Select all noremap <C-A> gggH<C-O>G inoremap <C-A> <C-O>gg<C-O>gH<C-O>G cnoremap <C-A> <C-C>gggH<C-O>G onoremap <C-A> <C-C>gggH<C-O>G snoremap <C-A> <C-C>gggH<C-O>G xnoremap <C-A> <C-C>ggVG " CTRL-Tab is Next window noremap <C-Tab> <C-W>w inoremap <C-Tab> <C-O><C-W>w cnoremap <C-Tab> <C-C><C-W>w onoremap <C-Tab> <C-C><C-W>w " CTRL-F4 is Close window noremap <C-F4> < C-W>c inoremap <C-F4> <C-O><C-W>c cnoremap <C-F4> <C-C><C-W>c onoremap <C-F4> <C-C><C-W>c " restore 'cpoptions' set cpo& if 1 let &cpoptions = s:save_cpo unlet s:save_cpo endif |
GVIM Vundle 설정
홈페이지 : https://github.com/gmarik/vundle
윈도우에서 Vundle 설치 : Windows users see Vundle for Windows
Vundle이 설치 되어야 이후에 플러그인등을 설치 하는데에 굉장히 쉽고 효과적임.
아래 설정 하는부분에서 가장 중요한 부분이 call vundle#rc('$VIMRUNTIME/.vim/') 요거당. 기본적으로 홈페이지에는 파라미터 값이 없는데 이렇게 되면 기본적으로 다운로드 받는 위치가 home 디렉토리 %USERPROFILE$ 아래에 설치 하게 된다. 이렇게 되면 추후에 vim 을 USB 나 PC를 재설치 할때 홈디렉토리 있는 플러그인들을 같이 가지고 와야 하는데 아래 처럼 설정을 하게 되면 VIM이 깔려있는 디렉토리아래에 설치가 되기때문에 추후에 COPY하게 되면 그냥 VIM 폴더만 가지고 오면 어느곳에서 실행 시키더라도 내가 만든 환경을 그대로 가지고 올 수 있다.
set nocompatible " be iMproved filetype off " required! set rtp+=$VIMRUNTIME/.vim/bundle/vundle/ call vundle#rc('$VIMRUNTIME/.vim/') " let Vundle manage Vundle " required! Bundle 'gmarik/vundle' " My Bundles here: " " original repos on github " vim-scripts repos Bundle 'L9' Bundle 'FuzzyFinder' Bundle 'SuperTab' Bundle 'SuperTab-continued.' Bundle 'The-NERD-tree' Bundle 'The-NERD-Commenter' Bundle 'OmniCppComplete' Bundle 'bufexplorer.zip' Bundle 'taglist.vim' Bundle 'AutoComplPop' Bundle 'a.vim' "Bundle 'superSnipMate' filetype plugin indent on " required! |
위와 같이 셋팅 하고 GVIM 을 실행하고 빔의 명령모드에서 아래와 같이 입력후 탭을 눌렀을 때
:Bundle |
" My Bundles Bundle 'gmarik/vundle' Bundle 'L9' Bundle 'FuzzyFinder' Bundle 'SuperTab' Bundle 'SuperTab-continued.' Bundle 'The-NERD-tree' Bundle 'The-NERD-Commenter' Bundle 'OmniCppComplete' Bundle 'bufexplorer.zip' Bundle 'taglist.vim' Bundle 'AutoComplPop' Bundle 'a.vim' |
GVIM Plugin
Downloads -> GVim_Portable_7.1.0.zip 다운로드 후 압축 해제
Bundle 'gmarik/vundle' "Vundle 관리자" |
Bundle ' The-NERD-tree' "파일들을 트리형식으로 보여줌." |
● 함수 목록
Bundle ' taglist.vim ' "함수,변수,클래스 등을 보여줌." |
Bundle 'L9' Bundle 'OmniCppComplete' Bundle 'FuzzyFinder' "L9 라이브러리를 사용해서 전체 파일에서 원하는 파일 바로 열기 |
루트 폴더 아래 폴더 전체를 검색해서 파일들을 보여주는 기능.
퍼지파인더 아래와 같이 설정
" Fuzzy Finder let g:fuf_modesDisable = [] let g:fuf_mrufile_maxItem = 400 let g:fuf_mrucmd_maxItem = 400 let g:fuf_file_exclude = '\v\~$|\.(o|exe|dll|bak|swp|class|pyc|orig)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])' map <leader>ff :FufFile **/ map <leader>fb :FufBuffer nnoremap <silent> sj :FufBuffer<CR> nnoremap <silent> sk :FufFileWithCurrentBufferDir<CR> nnoremap <silent> sK :FufFileWithFullCwd<CR> nnoremap <silent> s<C-k> :FufFile<CR> nnoremap <silent> sl :FufCoverageFileChange<CR> nnoremap <silent> sL :FufCoverageFileChange<CR> nnoremap <silent> s<C-l> :FufCoverageFileRegister<CR> nnoremap <silent> sd :FufDirWithCurrentBufferDir<CR> nnoremap <silent> sD :FufDirWithFullCwd<CR> nnoremap <silent> s<C-d> :FufDir<CR> nnoremap <silent> sn :FufMruFile<CR> nnoremap <silent> sN :FufMruFileInCwd<CR> nnoremap <silent> sm :FufMruCmd<CR> nnoremap <silent> su :FufBookmarkFile<CR> nnoremap <silent> s<C-u> :FufBookmarkFileAdd<CR> vnoremap <silent> s<C-u> :FufBookmarkFileAddAsSelectedText<CR> noremap <silent> si :FufBookmarkDir<CR> nnoremap <silent> s<C-i> :FufBookmarkDirAdd<CR> nnoremap <silent> st :FufTag<CR> nnoremap <silent> sT :FufTag!<CR> nnoremap <silent> s<C-]> :FufTagWithCursorWord!<CR> nnoremap <silent> s, :FufBufferTag<CR> nnoremap <silent> s< :FufBufferTag!<CR> vnoremap <silent> s, :FufBufferTagWithSelectedText!<CR> vnoremap <silent> s< :FufBufferTagWithSelectedText<CR> nnoremap <silent> s} :FufBufferTagWithCursorWord!<CR> nnoremap <silent> s. :FufBufferTagAll<CR> nnoremap <silent> s> :FufBufferTagAll!<CR> vnoremap <silent> s. :FufBufferTagAllWithSelectedText!<CR> vnoremap <silent> s> :FufBufferTagAllWithSelectedText<CR> nnoremap <silent> s] :FufBufferTagAllWithCursorWord!<CR> nnoremap <silent> sg :FufTaggedFile<CR> nnoremap <silent> sG :FufTaggedFile!<CR> nnoremap <silent> so :FufJumpList<CR> nnoremap <silent> sp :FufChangeList<CR> nnoremap <silent> sq :FufQuickfix<CR> nnoremap <silent> sy :FufLine<CR> nnoremap <silent> sh :FufHelp<CR> nnoremap <silent> se :FufEditDataFile<CR> nnoremap <silent> sr :FufRenewCache<CR> " OmniCppComplete plug-in set nocp filetype plugin on autocmd CursorMovedI * if pumvisible() == 0|pclose|endif autocmd InsertLeave * if pumvisible() == 0|pclose|endif let OmniCpp_GlobalScopeSearch = 1 let OmniCpp_NamespaceSearch = 1 let OmniCpp_DisplayMode = 0 let OmniCpp_ShowScopeInAbbr = 0 let OmniCpp_ShowPrototypeInAbbr = 0 let OmniCpp_ShowAccess = 1 let OmniCpp_DefaultNamespaces = [] let OmniCpp_MayCompleteDot = 1 let OmniCpp_MayCompleteArrow = 1 let OmniCpp_MayCompleteScope = 0 let OmniCpp_SelectFirstItem = 0 let OmniCpp_LocalSearchDecl = 0 let NERDCreateDefaultMappings=1 let NERDComMappings=1 |
Bundle 'AutoComplPop' "단어 자동완성 |
Bundle 'SuperTab' Bundle 'SuperTab-continued.' "FuzzyFinder 및 단어 자동완성에서 탭으로 다음것을 선택하는 기능 |
Bundle 'a.vim' "소스의 헤더 전환 |
Bundle 'The-NERD-Commenter' "주석 기능 |
Bundle ' bufexplorer.zip ' "파일의 history |
open 파일들의 history를 가지고 있기때문에 열었던 파일에 대해서는 빠르게 접근이 가능함.
vim 기본설정
set autoindent set smartindent set nu " line number
" 검색 기능 설정 set hls "검색어 강조기능 set magic " magic 기능 사용 (search 패턴에 특수문자 사용 "set showcmd " Show (partial) command in status line set showmatch " Show matching brackets. set ignorecase " Do case insensitive matching set smartcase " Do smart case matching set incsearch " Incremental search "set autowrite " Automatically save before commands like :next and :make set hidden " Hide buffers when they are abandoned set mouse=a " Enable mouse usage (all modes)
set expandtab "탭 문자를 공백 문자로 변환 set tabstop=4 set shiftwidth=4 set softtabstop=4 autocmd FileType make setlocal noexpandtab "Makefile 수정 중에는 TAB 사용
set clipboard=unnamed " 클립보드 사용 "set paste "set fenc=utf-8 set fencs=utf-8,euc-kr,cp949,cp932,euc-jp,shift-jis,big5,latin1,ucs-2le set nobackup set noswapfile |
vim 컬러스킴
vim script 다운로드 사이트
http://www.vim.org/scripts/script_search_results.php?order_by=creation_date&direction=descending
molokai | color schem | 4764 | 32158 |
유저들이 가장 많이 사용하는 컬러로 다운을 받는다. ㅎ
..\vim73\colors 폴더로 Copy
colorscheme molokai |
vim 영문폰트 및 한글폰트
시작 -> 실행 -> regedit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink
if has("gui_running") set guifont=Courier_New:h9 endif |
vim 함수색상
function! EnhanceCppSyntax()
syn match cCustomParen "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(" contains=cCustomParen
syn match cppCustomScope "::"
syn match cppCustomClass "\w\+\s*::" contains=cCustomScope
hi def link cCustomFunc Function
hi def link cCustomClass Function
endfunction
autocmd Syntax cpp call EnhanceCppSyntax()
autocmd Syntax c call EnhanceCppSyntax()
vim 북마크
지역 설정 - m(a~z)
전역 설정 - m(A~Z)
북마크 리스트 - :marks
백업 파일 no 생성
set nobackup
set noswapfile
vim 사이즈
vim 함수색상
function! EnhanceCppSyntax() syn match cCustomParen "(" contains=cParen contains=cCppParen syn match cCustomFunc "\w\+\s*(" contains=cCustomParen syn match cppCustomScope "::" syn match cppCustomClass "\w\+\s*::" contains=cCustomScope hi def link cCustomFunc Function hi def link cCustomClass Function endfunction autocmd Syntax cpp call EnhanceCppSyntax() autocmd Syntax c call EnhanceCppSyntax() |
vim 북마크
지역 설정 - m(a~z)
전역 설정 - m(A~Z)
북마크 리스트 - :marks
백업 파일 no 생성
set nobackup
set noswapfile
백업 파일 no 생성
set nobackup set noswapfile |
vim 사이즈
set lines=70 set columns=200 winpos 300 0 |
vim 커서라인
set cursorline set CursorLine guifg=NONE guibg=NONE gui=underline |
vim 폴딩
noremap zf v]}zf |
zf 로 폴팅을 하고 zo 로 언폴딩을 함.
vim Open new tab
여러개의 파일을 오픈 하게 되면 한 창에서 계속 오픈되는데 아래 명령어를 사용하면 새로운 탭에서 열수 있다.
gvim.exe --remote-tab-silent |
vim 검색시 하이라이트
if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif |
vim 키 맵핑
" key mapping vmap <Tab> >gv vmap <S-Tab> <gv "Tag "map <C-[> <C-t> "move map <c-k> <C-w><C-k> map <c-j> <C-w><C-j> map <c-h> <C-w><C-h> map <c-l> <C-w><C-l> "==== Function Key Mapping "vim7.0 TAB map <F2> :tabnew<CR> map <F3> :tabn<CR> map <F4> :tabclose<CR> " map <c-1> :norm i//<CR> " map <c-2> :norm xx<CR> " save and make " nmap <F5> :w<CR>:make<CR> "BufExplorer ( file history ) map <F9> :BufExplorer<CR> "taglist and tree map <F10> :Tlist<CR> "full screen map <F11> <C-w><C-w> " NERDTreeToogle( File navigation ) map <F12> :NERDTreeToggle<CR> "noremap <C-w> <C-v> |
vim cscope 설정
source $VIMRUNTIME/vimrc/vimrc_cscope_maps |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " CSCOPE settings for vim """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " " This file contains some boilerplate settings for vim's cscope interface, " plus some keyboard mappings that I've found useful. " " USAGE: " -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a " 'plugin' directory in some other directory that is in your " 'runtimepath'. " " -- vim 5: Stick this file somewhere and 'source cscope.vim' it from " your ~/.vimrc file (or cut and paste it into your .vimrc). " " NOTE: " These key maps use multiple keystrokes (2 or 3 keys). If you find that vim " keeps timing you out before you can complete them, try changing your timeout " settings, as explained below. " " Happy cscoping, " " Jason Duell jduell@alumni.princeton.edu 2002/3/7 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " This tests to see if vim was configured with the '--enable-cscope' option " when it was compiled. If it wasn't, time to recompile vim... if has("cscope") """"""""""""" Standard cscope/vim boilerplate " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' set cscopetag " check cscope for definition of a symbol before checking ctags: set to 1 " if you want the reverse search order. set csto=0 " add any cscope database in current directory if has("cscope") "cs add /usr/src/linux-headers-2.6.32-24-generic/cscope.out if filereadable("./cscope.out") cs add ./cscope.out . -C elseif filereadable("../cscope.out") cs add ../cscope.out . -C elseif filereadable("../../cscope.out") cs add ../../cscope.out . -C elseif filereadable("../../../cscope.out") cs add ../../../cscope.out . -C elseif filereadable("../../../../cscope.out") cs add ../../../../cscope.out . -C endif if $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif
" show msg when any other cscope db added set cscopeverbose """"""""""""" My cscope/vim key mappings " " The following maps all invoke one of the following cscope search types: " " 's' symbol: find all references to the token under cursor " 'g' global: find global definition(s) of the token under cursor " 'c' calls: find all calls to the function name under cursor " 't' text: find all instances of the text under cursor " 'e' egrep: egrep search for the word under cursor " 'f' file: open the filename under cursor " 'i' includes: find files that include the filename under cursor " 'd' called: find functions that function under cursor calls " " Below are three sets of the maps: one set that just jumps to your " search result, one that splits the existing vim window horizontally and " diplays your search result in the new window, and one that does the same " thing, but does a vertical split instead (vim 6 only). " " I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's " unlikely that you need their default mappings (CTRL-\'s default use is " as part of CTRL-\ CTRL-N typemap, which basically just does the same " thing as hitting 'escape': CTRL-@ doesn't seem to have any default use). " If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all " of these maps to use other keys. One likely candidate is 'CTRL-_' " (which also maps to CTRL-/, which is easier to type). By default it is " used to switch between Hebrew and English keyboard mode. " " All of the maps involving the <cfile> macro use '^<cfile>$': this is so " that searches over '#include <time.h>" return only references to " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all " files that contain 'time.h' as part of their name). " To do the first type of search, hit 'CTRL-\', followed by one of the " cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope " search will be displayed in the current window. You can use CTRL-T to " go back to where you were before the search. " nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR> " Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type " makes the vim window split horizontally, with search result displayed in " the new window. " " (Note: earlier versions of vim may not have the :scs command, but it " can be simulated roughly via: " nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR> " Hitting CTRL-space *twice* before the search type does a vertical " split instead of a horizontal one (vim 6 and up only) " " (Note: you may wish to put a 'set splitright' in your .vimrc " if you prefer the new window on the right instead of the left nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-@><C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-@><C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-@><C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-@><C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-@><C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR> nmap <C-@><C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
""""""""""""" key map timeouts " " By default Vim will only wait 1 second for each keystroke in a mapping. " You may find that too short with the above typemaps. If so, you should " either turn off mapping timeouts via 'notimeout'. " "set notimeout " " Or, you can keep timeouts, by uncommenting the timeoutlen line below, " with your own personal favorite value (in milliseconds): " "set timeoutlen=4000 " " Either way, since mapping timeout settings by default also set the " timeouts for multicharacter 'keys codes' (like <F1>), you should also " set ttimeout and ttimeoutlen: otherwise, you will experience strange " delays as vim waits for a keystroke after you hit ESC (it will be " waiting to see if the ESC is actually part of a key code like <F1>). " "set ttimeout " " personally, I find a tenth of a second to work well for key code " timeouts. If you experience problems and have a slow terminal or network " connection, set it higher. If you don't set ttimeoutlen, the value for " timeoutlent (default: 1000 = 1 second, which is sluggish) is used. " "set ttimeoutlen=100 endif |
'Hello Android' 카테고리의 다른 글
삼성 커널 빌드 (0) | 2012.10.15 |
---|---|
zImage에서 initramfs 추출 (0) | 2012.10.11 |
[우분투] 환경설정 (0) | 2012.08.07 |
[안드로이드] Sample 빌드 에러 (0) | 2012.07.31 |
[이클립스] 파일 이동 (0) | 2012.07.30 |