반응형
    
    
    
  1. wesleyche/srcexpl 이란?
wesleyche/srcexpl 플러그인은 Source Explorer의 플러그인으로써 별도의 창에 함수나 타입 정의 또는 선언을 표시하여 현재 선택된 키워드에 대한 컨텍스트를 제공하는 소스 코드 탐색기입니다. 이 플러그인은 IDE에서 사용할 수 있는 컨텍스트 창을 만들어 줍니다.
srcexpl플러그인은 아래와 같은 특징이 있습니다.
1. 함수, 매크로, 구조, 배열, 메서드, 클래스 및 변수를 비롯한 다양한 유형 및 ctag에서 지원하는 다양한 언어의 정의 및 선언을 표시합니다.
2. 마우스 또는 고유한 키 매핑을 사용하여 소스 탐색기 창에 표시된 컨텍스트로 이동합니다.
3. 마우스 컨텍스트 메뉴 또는 고유한 키 매핑을 사용하여 컨텍스트 위치에서 뒤로 이동합니다.
4. 키워드에 대한 정의가 여러 개 있는 경우 모든 정의를 자동으로 나열합니다.
2. .vimrc에 Plugin 추가
call vundle#begin()
    " let Vundle manage Vundle
    " required!
    Plugin 'VundleVim/Vundle.vim'
   "하단에 해당 함수의 정의를 보여 줌. 
    Plugin 'wesleyche/srcexpl'
call vundle#end()
vim Plugin 사용방법
3. 설정
"-----------------------------------------------------------------------"
" Source Explorer 환경설정
"-----------------------------------------------------------------------"
nmap <F8> :SrcExplToggle<CR>            " F8 key = SrcExpl TOggle
let g:SrcExpl_winHeight = 12            " SrcExpl 윈도우 높이 지정
let g:SrcExpl_refreshTime = 100         " refreshing time = 100ms
let g:SrcExpl_jumpKey = "<ENTER>"       " 해당 definition으로 jump
let g:SrcExpl_gobackKey = "<SPACE>"     " back
let g:SrcExpl_pluginList = [
        \ "__Tag_List__",
        \ "_NERD_tree_",
        \ "Source_Explorer"
        \ ]
" // The color schemes used by Source Explorer. There are five color schemes
" // supported for now - Red, Cyan, Green, Yellow and Magenta. Source Explorer
" // will pick up one of them randomly when initialization.
let g:SrcExpl_colorSchemeList = [
        \ "Cyan",
    \ ]
" // Enable/Disable the local definition searching, and note that this is not
" // guaranteed to work, the Source Explorer doesn't check the syntax for now.
" // It only searches for a match with the keyword according to command 'gd'
let g:SrcExpl_searchLocalDef = 1
" // Workaround for Vim bug @https://goo.gl/TLPK4K as any plugins using autocmd for
" // BufReadPre might have conflicts with Source Explorer. e.g. YCM, Syntastic etc.
let g:SrcExpl_nestedAutoCmd = 1
" // Do not let the Source Explorer update the tags file when opening
let g:SrcExpl_isUpdateTags = 0
" // Use 'Exuberant Ctags' with '--sort=foldcase -R .' or '-L cscope.files' to
" // create/update the tags file
let g:SrcExpl_updateTagsCmd = "ctags --sort=foldcase -R ."
" // Set "<F12>" key for updating the tags file artificially
let g:SrcExpl_updateTagsKey = "<F12>"
" // Set "<F3>" key for displaying the previous definition in the jump list
let g:SrcExpl_prevDefKey = "<S-K>"
" // Set "<F4>" key for displaying the next definition in the jump list
let g:SrcExpl_nextDefKey = "<S-J>"| 명령어 | 내용 설명 | 
| nmap <F8> :SrcExplToggle<CR> | F8 키를 누르면 Source Explorer 창이 켜지거나 닫힘. | 
| let g:SrcExpl_refreshTime = 100 | Source Explorer 창의 refresh Time이 100msec | 
| let g:SrcExpl_jumpKey = "<ENTER>" | Source Explorer 창에 출력되는 함수명에 커서를 두고 Enter를 치면 본 화면이 해당 함수화면으로 점프함. | 
| let g:SrcExpl_gobackKey = "<SPACE>" | 위 Enter로 점프한 화면에서 전 화면으로 복귀 함. | 
| let g:SrcExpl_pluginList = [ \ "__Tag_List__", \ "_NERD_tree_", \ "Source_Explorer" \ ] | SrcExpl와 충돌을 피하기 위해 자신을 제외한 어떤 플러그인이 버퍼를 사용학 있는지 알아야 함. ":buffers!" 명령을 사용하여 출력된 버퍼 이름을 SrcExpl_pluginList에 추가해 줘야 함. | 
| let g:SrcExpl_colorSchemeList = [ \ "Cyan", \ ] | Srcexpl에서 선택된 함수나 변수의 배경 색 등록 Cyan외 Green, Yellow, Magenta, Red등을 추가 등록 할 수 있으며 여러 색상 중 vim이 실행 될 때 랜덤으로 색상을 선택하게 된다. | 
| let g:SrcExpl_searchLocalDef = 1 | 해당 값이 '1'일 경우 현재 열려져 있는 파일에 정의된 함수/변수도 검색하여 찾아 보여주며, '0'일 경우는 검색하지 않음. | 
| let g:SrcExpl_nestedAutoCmd = 1 | ycm, syntasitc과 같이 BufReadPre에 autocmd를 사용하는 플러그인이 소스 탐색기와 충돌 할 수 있으므로 이에 대한 해결 방법으로 설정 | 
| let g:SrcExpl_updateTagsKey = "<F12>" | ctags 업데이트 키, 코드 수정 후 F12 키를 누르면 tags가 갱신되면서 수정 된 코드를 검색 할 수 있게 된다. | 
| let g:SrcExpl_prevDefKey = "<S-J>" | SrcExpl가 중복된 함수 또는 변수를 찾을 경우 파일 패스 리스트를 창 아래에 출력한다. 이 때 Shift + j 를 누르면 창을 옮기지 않고 리스트 항목의 커서를 위로 올릴 수 있다. | 
| let g:SrcExpl_nextDefKey = "<S-K>" | SrcExpl가 중복된 함수 또는 변수를 찾을 경우 파일 패스 리스트를 창 아래에 출력한다. 이 때 Shift + k 를 누르면 창을 옮기지 않고 리스트 항목의 커서를 아래로 내 수 있다. | 
4. 현재까지의 설정이 적용된 .vimrc 내용
"-----------------------------------------------------------------------"
" Vundle 환경설정
"------------------------------------------------------------------------"
filetype off                   " required!
set shell=/bin/bash
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
        " let Vundle manage Vundle
        " required!
        Plugin 'VundleVim/Vundle.vim'
        " vim 하단에 파일 정보 띄우기
        Plugin 'vim-airline/vim-airline'
        Plugin 'vim-airline/vim-airline-themes'
        Plugin 'morhetz/gruvbox'
        Plugin 'ctrlpvim/ctrlp.vim'
        Plugin 'tpope/vim-fugitive'
        Plugin 'wesleyche/srcexpl'
    " ...
call vundle#end()
filetype plugin indent on     " required!
        "
        " Brief help
        " :BundleList          - list configured bundles
        " :BundleInstall(!)    - install(update) bundles
        " :BundleSearch(!) foo - search(or refresh cache first) for foo
        " :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
        "
        " see :h vundle for more details or wiki for FAQ
        " NOTE: comments after Bundle command are not allowed..
"-----------------------------------------------------------------------"
"vim 환경설정
"-----------------------------------------------------------------------"
        " Vim 전용 기능 사용
        set nocompatible "Vim Using
        "파일 타입 설정
        set encoding=utf-8
        set fencs=utf-8,cp949,cp932,euc-jp,shift-jis,big5,ucs-2le,latin1
        " 명령어 기록 갯수
        set hi=1000
        " 백스페이스 사용
        set bs=indent,eol,start
        " 오른쪽 하단 커서 위치 항상 보이기
        set ru "same ruler
        " 줄번호 표시
        set nu
        " 줄 번호 표시 너비 설정
        set nuw=5
        " 탭 크기 설정
        set ts=4 "same tabstop
        set sw=4 "same shiftwidth
        set sts=0 "same softtabstop
        autocmd FileType make setlocal noexpandtab "Makefile은 tab 문법이기 때문에 스페이스 대체 안 함.
        " 탭 >> 공백 변환 사용안함
        "set noet
        " 자동 줄바꿈 안함
        "set nowrap
        set linebreak
        set showbreak=+++\
        " 들여쓰기 설정
        set autoindent
        set cindent
        " 스마트 셋팅
        set smartcase
        set smarttab
        set smartindent
        " magic 기능 사용
        set magic
        " 이동 동작시 줄의 시작으로 자동 이동
        set sol
        " 비쥬얼 모드 동작 설정
        set sel=exclusive
        " 괄호짝 찾기에서 <> 도 찾도록 추가
        set mps+=<:>
        " 검색어 강조
        set hls
        " 검색시 파일 끝에서 되돌리기 안함
        set nows
        " 스마트한 대소문자 구별 기능 사용
        set scs
        "대소문자 구분(구분 없이 할 때 i 옵션 또는 ignorecase)
        set noignorecase
        " 항상 status 라인을 표시
        set ls=2
        "파일 형식에 따른 신택스 하이라이팅 켜기
        sy enable
        "괄호 매치
        set showmatch
        "마우스 자동
        set mouse=a
        "클립보드 복사
        "set clipboard=unnamed "use OS clipboard
        set clipboard=unnamedplus "use OS clipboard
        " 키워드 입력시 점진적 검색
        set incsearch
        set spell
"----------------------------------------------------------------------"
" AirLine
"----------------------------------------------------------------------"
set laststatus=2
let g:airline#extensions#tabline#enabled = 1 "버퍼 목록 켜기
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
" 파일명만 출력
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_highlighting_cache = 1
let g:airline_powerline_fonts = 1
let g:airline_theme= 'minimalist'
"let g:airline_section_y = ''
"let g:airline_section_warning= '' "마지막 status창 사용 안함
" 버퍼 목록 켜기
" 이 옵션은 버퍼를 수정한 직후 버퍼를 감춰지도록 한다.
" 이 방법으로 버퍼를 사용하려면 거의 필수다.
set hidden
"----------------------------------------------------------------------"
" gruvbox 설정
"----------------------------------------------------------------------"
set background=dark
let g:gruvbox_contrast_dark = 'soft'
"let g:gruvbox_contrast_light = 'soft'
"let g:gruvbox_transparent_bg = '1'
let g:gruvbox_italic = 1
"let g:gruvbox_underline=1
"let g:gruvbox_undercurl=1
"let g:gruvbox_termcolors=16
"let g:gruvbox_number_column='aqua'
"let g:gruvbox_sign_column='aqua'
"let g:gruvbox_color_column='aqua'
" Force to use underline for spell check results
augroup SpellUnderline
  autocmd!
  autocmd ColorScheme *
    \ highlight SpellBad
    \   cterm=Underline
    \   ctermfg=NONE
    \   ctermbg=NONE
    \   term=Reverse
    \   gui=Undercurl
    \   guisp=Red
  autocmd ColorScheme *
    \ highlight SpellCap
    \   cterm=Underline
    \   ctermfg=NONE
    \   ctermbg=NONE
    \   term=Reverse
    \   gui=Undercurl
    \   guisp=Red
  autocmd ColorScheme *
    \ highlight SpellLocal
    \   cterm=Underline
    \   ctermfg=NONE
    \   ctermbg=NONE
    \   term=Reverse
    \   gui=Undercurl
    \   guisp=Red
  autocmd ColorScheme *
    \ highlight SpellRare
    \   cterm=Underline
    \   ctermfg=NONE
    \   ctermbg=NONE
    \   term=Reverse
    \   gui=Undercurl
    \   guisp=Red
  augroup END
set termguicolors
colorscheme gruvbox
"----------------------------------------------------------------------"
" ctrlp.vim 설정(파일 탐색 속도 향상)
"----------------------------------------------------------------------"
set wildignore+=*/tmp/*,*.so,*.a,*.swp,*.zip,*.obj  " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe             " Windows
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
  \ 'dir':  '\.git$\|public$\|log$\|tmp$\|vendor$',
  \ 'file': '\v\.(exe|so|dll|a)$',
  \ 'link': 'some_bad_symbolic_links'
\ }
let g:ctrlp_max_files = 10000
let g:ctrlp_max_depth = 30
let g:ctrlp_follow_symlinks = 1
"let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
"let g:ctrlp_use_readdir = 0
let g:ctrlp_root_markers = ['ctrlp-marker']
" <c-f>, <c-b> 모드 변환(MRU(Most Recently Used)내 검색, file 전체 검색, buffers내 검색)
" <c-d> path내 검색어가 포함되어 검색 또는 오직 파일내 검색어만 포함 검색
" <c-r> 정규 표현식 모드 전환(검색어와 완전히 일치한 파일만 보여 줌)
" <c-j>, <c-k> 검색결과내 커서 위아래 이동
" <c-t>, <c-v>, <c-x> 파일을 새로운 tab으로 열거나 창을 분활하여 파일을 염.
" <c-n>, <n-p> 검색 history의 next/previous 문자열 선택
" <c-z>, <c-o> 검색된 결과물에 <c-z>로 마크를 하고 <c-o>로 오픈(멀티마크 가능)
" <c-y> 검색입력어로 된 파일을 만든다. 파일 위치는 검색 폴더의 최상위 위치
" :help ctrlp-mappings 키 맵핑에 관한 설명
"-----------------------------------------------------------------------"
" Source Explorer 환경설정
"-----------------------------------------------------------------------"
nmap <F8> :SrcExplToggle<CR>            " F8 key = SrcExpl TOggle
let g:SrcExpl_winHeight = 12            " SrcExpl 윈도우 높이 지정
let g:SrcExpl_refreshTime = 100         " refreshing time = 100ms
let g:SrcExpl_jumpKey = "<ENTER>"       " 해당 definition으로 jump
let g:SrcExpl_gobackKey = "<SPACE>"     " back
let g:SrcExpl_pluginList = [
        \ "__Tag_List__",
        \ "_NERD_tree_",
        \ "Source_Explorer"
        \ ]
" // The color schemes used by Source Explorer. There are five color schemes
" // supported for now - Red, Cyan, Green, Yellow and Magenta. Source Explorer
" // will pick up one of them randomly when initialization.
let g:SrcExpl_colorSchemeList = [
        \ "Cyan",
    \ ]
" // Enable/Disable the local definition searching, and note that this is not
" // guaranteed to work, the Source Explorer doesn't check the syntax for now.
" // It only searches for a match with the keyword according to command 'gd'
let g:SrcExpl_searchLocalDef = 1
" // Workaround for Vim bug @https://goo.gl/TLPK4K as any plugins using autocmd for
" // BufReadPre might have conflicts with Source Explorer. e.g. YCM, Syntastic etc.
let g:SrcExpl_nestedAutoCmd = 1
" // Do not let the Source Explorer update the tags file when opening
let g:SrcExpl_isUpdateTags = 0
" // Use 'Exuberant Ctags' with '--sort=foldcase -R .' or '-L cscope.files' to
" // create/update the tags file
let g:SrcExpl_updateTagsCmd = "ctags --sort=foldcase -R ."
" // Set "<F12>" key for updating the tags file artificially
let g:SrcExpl_updateTagsKey = "<F12>"
" // Set "<F3>" key for displaying the previous definition in the jump list
let g:SrcExpl_prevDefKey = "<S-K>"
" // Set "<F4>" key for displaying the next definition in the jump list
let g:SrcExpl_nextDefKey = "<S-J>"
5. 현재까지의 설정이 적용된 vim 코드 뷰



반응형
    
    
    
  'Linux > VIM' 카테고리의 다른 글
| vim 괄호 자동으로 닫아주는 플러그인 (0) | 2023.03.19 | 
|---|---|
| VIM 코드 자동완성 플러그인 (0) | 2023.01.20 | 
| VIM Plugin tpope/vim-fugitive 설치 및 사용 방법 (0) | 2022.05.11 | 
| VIM Plugin ctrlp.vim 설치 및 사용 방법 (0) | 2022.05.10 | 
| vim Plugin morhetz/gruvbox 설치 및 사용 방법 (0) | 2022.05.06 | 
 
										
									 
										
									 
										
									 
										
									
댓글