생물정보학/Linux

vi 에디터 글자색 변경하기

케이든 2013. 1. 29. 13:42

 

리눅스에서 사용되는 vi 에디터의  글자색을 바꿔보자

 

/etc/vimrc 파일에는 모든 사용자에게 지정되는 vi 설정이 들어있고
이파일을 사용자 루트디렉토리에 .vimrc로 복사하고 원하는 설정으로 바꾸어 주면 된다 !

:hi 를 치면 설정된 색들이 나오고

이중에 맘에 안드는 놈들 골라서 변경해 주면 된다

hi Comment term=bold cterm=bold ctermfg=4
hi Search term=reverse cterm=reverse ctermfg=1

주석하고 검색결과가 잘 안보여서 바꿨다 !

다른것들도 마찬가지로 바꿀 수 있음.


.vimrc 파일 아래쪽 4줄이 수정 한 것


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
1 if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
2 set fileencodings=utf-8,latin1
3 endif
4
5 set nocompatible " Use Vim defaults (much better!)
6 set bs=2 " allow backspacing over everything in insert mode
7 "set ai " always set autoindenting on
8 "set backup " keep a backup file
9 set viminfo='20,\"50 " read/write a .viminfo file, don't store more
10 " than 50 lines of registers
11 set history=50 " keep 50 lines of command line history
12 set ruler " show the cursor position all the time
13
14 " only do this part when compiled with support for autocommands
15 if has("autocmd")
16 " In text files, always limit the width of text to 78 characters
17 autocmd BufRead *.txt set tw=78
18 " When editing a file, always jump to the last cursor position
19 autocmd BufReadPost *
20 \ if line("'\"") > 0 && line ("'\"") <= line("$") |
21 \ exe "normal! g'\"" |
22 \ endif
23 endif
24
25 if has("cscope")
26 set csprg=/usr/bin/cscope
27 set csto=0
28 set cst
29 set nocsverb
30 " add any database in current directory
31 if filereadable("cscope.out")
32 cs add cscope.out
33 " else add database pointed to by environment
34 elseif $CSCOPE_DB != ""
35 cs add $CSCOPE_DB
36 endif
37 set csverb
38 endif
39
40 " Switch syntax highlighting on, when the terminal has colors
41 " Also switch on highlighting the last used search pattern.
42 if &t_Co > 2 || has("gui_running")
43 syntax on
44 set hlsearch
45 endif
46
47 if &term=="xterm"
48 set t_Co=8
49 set t_Sb=^[[4%dm
50 set t_Sf=^[[3%dm
51 endif
52 set nu
53 set sw=4 ts=4
54 hi Comment term=bold cterm=bold ctermfg=4
55 hi Search term=reverse cterm=reverse ctermfg=1

 

 

또한 다른 방법으로는~


색을 직접 바꾸는 것 보다..
일단

:set bg=dark
:set bg=light

둘 중 하나로 바꿔보세요..

 

그냥 .vimrc에다 한줄 추가하면 될런지...?

 

네 그러면 됩니다.