아래 스크립트는 NerdTree, SourceExplorer, TagList가 설치되어 있다고 가정하고 작성되었다.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""" Temporarty directory setting
"let $TMPDIR = $HOME."/tmp"
" Sets how many lines of history VIM has to remember
set history=1000
" Set to auto read when a file is changed from the outside
set autoread
" Set to auto write on opening an other file.
set autowrite
" Use mouse or not
let s:mouse_state=1
set mouse=a
command! TM call ToggleMouse()
function! ToggleMouse()
if s:mouse_state
set mouse=c
else
set mouse=a
endif
let s:mouse_state=!s:mouse_state
endfunction
nmap <F12> :call ToggleMouse()<CR>
set laststatus=2
set statusline=\ %<%l:%v\ [%P]%=%a\ %h%m%r\ %F\
colorscheme darkblue
highlight Cursor guifg=white guibg=black
highlight iCursor guifg=white guibg=steelblue
set guicursor=a:block-blinkon1
au InsertEnter * hi StatusLine term=reverse ctermfg=0 ctermbg=5 gui=undercurl guisp=Magenta
au InsertLeave * hi StatusLine term=reverse ctermfg=0 ctermbg=2 gui=bold,reverse
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Always show current position
set ruler
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Show matching brackets when text indicator is over them
set showmatch
" line number
set number
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" syntax highlight
syntax enable
" color scheme
set background=dark
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" auto indent's tab size
set shiftwidth=4
" 1 tab == 4 spaces
set tabstop=4
" c style auto indent
set cindent
" #if has to be first on the line
set smartindent
" Auto Indent
set autoindent
" terminal mouse (mouse use beyond 277 columns)
set ttymouse=sgr
" Syntax Highlighting
if has("syntax")
syntax on
endif
" set default status line color
hi StatusLine term=reverse ctermfg=0 ctermbg=2 gui=bold,reverse
" line number color
highlight LineNr term=bold cterm=bold ctermfg=242 ctermbg=0
" error message color
highlight ErrorMsg ctermfg=0 ctermbg=13 guifg=Black guibg=#FFB3FF
" Don't want to go next when highligt word
" nnoremap * *``
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Coding
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" fold functions by syntax.
" open a folded function using 'zo'
" clase a function using 'zc'
set foldlevel=1
set foldmethod=indent
set foldnestmax=1
""""""""""""""""" grep """"""""""""""""""""""
map <leader>g :silent cgetexpr system('grep -rn -I --exclude=tags --exclude=cscope.out <C-R>=expand("<cword>") <CR> . ')<CR>:copen<CR>
""""""""""""""""" open new tab with current file """"""""""""""""""""""
map <leader>t :tab split<CR>
"""""""""""""""""""""" cTags """"""""""""""
set complete+=t
set tagbsearch
"set tags+=~/97_ToolChain/tizen6.0_cross_toolchain_vd_target_armv7l_host_x86-64/tags
nmap ts :ts <C-R>=expand("<cword>")<CR><CR>
""""""""""""""" Vundle Script 추가 """"""""""""
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/plugin/NERD_tree.vim
set rtp+=~/.vim/autoload/pathogen.vim
set runtimepath+=~/.vim/plugin
set runtimepath+=~/.vim/plugin/nerdtree_plugin
set runtimepath+=~/.vim/plugin/TagHighlight
""""""""""""""""""" TagList 환경설정 """""""""""""""""""""""""""""
filetype on
nmap <F9> :TlistToggle<CR>
let Tlist_Ctags_Cmd = "/usr/bin/ctags" "ctags 프로그램 위치
let Tlist_Inc_Winwidth = 0 "window width change off
let Tlist_Exit_OnlyWindow = 1 "tag/file 선택 왁료시 taglist
let Tlist_Auto_Open = 0 "window close off
let Tlist_Use_Right_Window = 1 "vim 시작시 window open = off
""""""""""""""""" NERD Tree """""""""""""
let NERDTreeWinPos = "left"
nmap <F7> :NERDTreeToggle<CR>
""""""""""""""""""" Source Explorer 환경설정 """""""""""""""""""""""""""
nmap <F8> :SrcExplToggle<CR>
nmap <C-Left> <C-W>h
nmap <C-Down> <C-W>j
nmap <C-Up> <C-W>k
nmap <C-Right> <C-W>l
let g:SrcExpl_winHeight = 8
let g:SrcExpl_refreshTime = 100
let g:SrcExpl_jumpKey = "<ENTER>"
let g:SrcExpl_gobackKey = "<SPACE>"
let g:SrcExpl_isUpdateTags = 0
""""""""""""" Cscope """""""""""""""""""""
if filereadable("./cscope.out")
cs add cscope.out
endif
nmap csc :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap css :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap csg :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap cst :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap tn :tn<CR>
nmap tp :tp<CR>
command -nargs=1 -bar CSC :cs find c <args>
cnoreabbrev csc CSC
command -nargs=1 -bar CSS :cs find s <args>
cnoreabbrev css CSS
command -nargs=1 -bar CSG :cs find g <args>
cnoreabbrev csg CSG
command -nargs=1 -bar CSF :cs find f <args>
cnoreabbrev csf CSF
command -nargs=1 -bar CST :cs find t <args>
cnoreabbrev cst CST'Linux > vim' 카테고리의 다른 글
| [vim] C언어 #ifdef (0) | 2024.02.03 |
|---|---|
| [vim] mark 설치 (형광펜 기능) (0) | 2024.02.03 |
| vim-highlighter 설치 (0) | 2024.02.03 |
| NERDTree, TagList, SourceExplorer 설치 (0) | 2024.02.03 |
| mkcscope.sh & mkctags.sh (0) | 2024.02.03 |