vi에서 make실행할때 에러난 파일이 자동으로 열립니다.
글쓴이: gurugio / 작성시간: 화, 2008/08/12 - 4:26오후
예를 들어서 main.cpp 파일을 편집하다가 :make 했을 때
ex.cpp 파일에서 에러가 났으면 자동으로 ex.cpp 파일이 열립니다.
그런데 매번 다시 main.cpp 파일로 돌아와야하는게 번거롭습니다.
자동으로 ex.cpp 파일이 열리지 않게하는 방법이 있을까요?
제 vimrc 파일을 올립니다.
"/usr/share/vim/vim71/vimrc_example.vim 파일 복사한것
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2006 Nov 16
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" In many terminal emulators the mouse works just fine, thus enable it.
"set mouse=a
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
"============== 기본 환경 설정 =============
set tabstop=4
set shiftwidth=4
set number
color elflord
" stdc 라이브러리 헤더 파일 위치
" C-p 를 누르면 자동으로 함수 이름 완성됨
set path=.,/usr/include,/home/gurugio/work/linux-2.6.21-s3c6400_rel3_nfs/include
set ruler
set showmatch
set ai
set showmode
set nowrap
"========== cscope를 사용하기 전에 미리 설정 사항 =============
set csto=0
set cst
set nocsverb
"============ ctags 설정 ========================
" ctags 태그 위치
" 커널과 다른 디렉토리에서 작업할 때도 태그 검색 가능
set tags=./tags,../tags,../../tags,../../../tags,/home/gurugio/work/mv320/linux-2.6.21-mv320/tags ",/qt4/qt-arm/tags
"============ taglist plugin 설정 ================
"Tlist 설정
let Tlist_WinWidth = 20 " 태그 창 너비
let Tlist_Process_File_Always = 0
let Tlist_Enable_Fold_Column = 0
let Tlist_Display_Tag_Scope = 0
let Tlist_Sort_Type = "name"
let Tlist_GainFocus_On_ToggleOpen = 0 " 창 열려도 커서 안옮김
let Tlist_Use_Right_Window = 1 "오른쪽에 창 열기
let Tlist_Display_Prototype = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_File_Fold_Auto_Close = 0
"============== winmanager plugin 설정 ==================
" 아래 3줄은 winmanager 홈피에서 권장한 설정
let g:winManagerWidth=30 " How wide should it be( pixels)
let g:winManagerWindowLayout = 'FileExplorer,TagsExplorer|BufExplorer' " What windows should it
let g:persistentBehaviour = 0
" TAB 새창으로 열기
" c PWD를 현재 디렉토리로 변경
" C PWD로 이동
" R rename, D delete
"=========================== 키 맵핑 ========================
"======= 기본적으로 대부분의 맵핑은 ,로 시작하게 한다
"======= 창 이동과 관련된 맵핑은 C-w 로 시작한다.
"============================================================
" 폴딩 접기/펴기
nmap ,zf v]}zf
nmap ,zo zo
" IDE 개발 환경 시작
nmap ,id :WMToggle<cr>
"창 높이 조절
map <c-j> <c-w>+
map <c-k> <c-w>-
"창 너비 조절
map <c-h> <c-w>>
map <c-l> <c-w><
"go first explorer window
map <c-w><c-f> :FirstExplorerWindow<cr>
"go bottom explorer window
map <c-w><c-b> :BottomExplorerWindow<cr>
" ,st 는 가로 창을 나누고 선택된 태그를 연다.
func! Sts()
let st = expand("<cword>")
exe "sts ".st
endfunc
nmap ,st :call Sts()<cr>
" 세로 창 열고 태그 열기
func! Vts()
let vt = expand("<cword>")
exe "vs"
exe "ts ".vt
endfunc
nmap ,vt :call Vts()<cr>
" cscope 데이터베이스 파일 읽기
" 현재 디렉토리에 cscope.out 파일이 있어야 cscope가 실행됨
if filereadable("./cscope.out")
cs add cscope.out
endif
set csverb
" ,css 명령은 :cs find s <symbol> 과 같은 역할을 함 (심볼 찾기)
func! Css()
let css = expand("<cword>")
new
exe "cs find s ".css
if getline(1) == ""
exe "q!"
endif
endfunc
nmap ,css :call Css()<cr>
" 라이브러리의 man 페이지 열기
func! Man()
let sm = expand("<cword>")
exe "!man -S 2:3:4:5:6:7:8:9:tcl:n:l:p:o ".sm
endfunc
nmap ,ma :call Man()<cr><cr>
" make 실행한 후 결과 메시지를 새 창에 열어서 보여주기
func! Make()
exe "make"
exe "cw"
endfunc
nmap ,mk :w<cr> :sp<cr> :call Make()<cr>
func! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col-1]!~'\k'
return "\<TAB>"
else
if pumvisible()
return "\<C-P>"
else
return "\<C-N>\<C-P>"
end
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <expr> <CR> pumvisible() ? "<C-Y><CR>" : "<CR>"Forums:


댓글 달기