Skip to main content

dotvimrc


scriptencoding=utf-8

set mouse=a


set tags=./tags,../tags,../../tags,../../../tags,tags


function! Komment()
if getline(".") =~ '\/\*'
let hls=@/
s/^\/\*//
s/*\/$//
let @/=hls
else
let hls=@/
s/^/\/*/
s/$/*\//
let @/=hls
endif
endfunction


function! C_comment()
let hls=@/
s/^/\/\//
let @/=hls
endfunction


function! C2_comment()
let hls=@/
s/^/"/
let @/=hls
endfunction

function! C3_comment()
let hls=@/
s/^/#/
let @/=hls
endfunction

function! HTML_comment()
let hls=@/
s/^//
let @/=hls
endfunction

function! UNcomment()
let hls=@/

if getline(".") =~ '\/\/'
s/^\/\/// "for c
elseif getline(".") =~ '\"'
s/^"//
elseif getline(".") =~ '#'
s/^#//
elseif getline(".") =~ '#$'
s/^#$/$/
endif

let @/=hls
endfunction

map ,/ :call C_comment()
map ,\ :call Komment()
map ," :call C2_comment()
map ,# :call C3_comment()
map ,< :call HTML_comment()

map ,c :call UNcomment()


colorscheme torte
set nu
set hlsearch

set nocompatible
set backspace=2
set autoindent
set cindent
set smartindent
set textwidth=90
set nowrapscan
set nobackup
set novisualbell
set nojoinspaces
set ruler
set tabstop=4
set shiftwidth=4
set keywordprg=man\ -a
set showcmd
set showmatch
set ignorecase
set incsearch
set autowrite
"set linespace=2
set linespace=1
set title
set keywordprg=wdic
"set statusline=\ %<%l:%v\ [%P]%=%a\ %h%m%r\ %F\

set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P
set expandtab
set wildmenu 
set laststatus=2 
set matchpairs+=<:>
syntax on


" for programming
set formatoptions=qro
set showmatch
set foldmethod=marker foldmarker={{{,}}}


" dictionary
autocmd FileType perl :set dictionary=$HOME/vim71/runtime/syntax/perl.vim
autocmd FileType cgi :set dictionary=$HOME/vim71/runtime/syntax/perl.vim
autocmd FileType c :set dictionary=$HOME/vim71/runtime/syntax/c.vim
autocmd FileType sh :set dictionary=$HOME/vim71/runtime/syntax/shell.vim
autocmd FileType html :set dictionary=$HOME/vim71/runtime/syntax/html.vim
autocmd FileType php :set dictionary=$HOME/vim71/runtime/syntax/php.vim
autocmd FileType sql :set dictionary=$HOME/vim71/runtime/syntax/sql.vim




if has("gui_running")
"set gfn=Fixedsys\ Excelsior\ 2.00\ 14
"set gfn=MiscFixed\ Semi-Condensed\ 10
"set gfw=Hangang\ Bold\ 10
"set gfw=Osaka\ 12
"set gfn=Terminal:h10:cSHIFTJIS
"set gfn=Osaka-等:h11:cSHIFTJIS
"set gfw=Osaka-等:h11:cSHIFTJIS
"set gfn=Fixedsys_Excelsior_2.00:h12:cANSI
"set gfn=Terminal:h10:cSHIFTJIS
"set gfn=Osaka-等:h11:cSHIFTJIS
"set gfw=Osaka-等:h11:cSHIFTJIS
set guifont=BDF_UM+:h9:cSHIFTJIS
set columns=120
set lines=50
" instead in /etc/vim/gvimrc
else
set guifont=BDF_M+:h7.5:cSHIFTJIS
endif



highlight SpecialKey cterm=underline ctermfg=darkgrey
"highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=white
highlight ZenkakuSpace guibg=DarkRed
"highlight ZenkakuSpace guibg=gray40
"match ZenkakuSpace / /
"認識さ#65533;覆ぅ院璽垢�△�au BufNew,BufRead * match ZenkakuSpace / /



highlight NOTE1 cterm=bold ctermfg=Magenta guibg=Yellow guifg=Magenta
"match NOTE1 /NOTE/
au BufNew,BufRead * match NOTE1 /NOTE/

highlight TODO1 cterm=bold ctermfg=Magenta guibg=Blue guifg=Yellow
au BufNew,BufRead * match TODO1 /TODO/


autocmd BufRead *.mxml set filetype=mxml syntax=mxml

au! FileType xml,sgml,entity,xslt,svg,xhtml,xsl,xsd
\ if !exists("b:match_words") |
\ let b:match_ignorecase=0 | let b:match_words =
\ '<:>,' .
\ '<\@<=!--:-->,'.
\ '<\@<=?\k\+:?>,'.
\ '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,'.
\ '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>'
\ | endif

au BufNewFile,BufRead *.html let g:snip_start_tag = "@"
au BufNewFile,BufRead *.html let g:snip_end_tag = "@"




" Jeff's cscope settings
if has("cscope")
" set csprg=/usr/bin/cscope
set csprg=~/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb

" Using 'CTRL-\' then a search type makes the vim window
" "shell-out", with search results displayed on the bottom

nmap s :cs find s =expand("")
nmap g :cs find g =expand("")
nmap c :cs find c =expand("")
nmap t :cs find t =expand("")
nmap e :cs find e =expand("")
nmap f :cs find f =expand("")
nmap i :cs find i ^=expand("")$
nmap d :cs find d =expand("")

" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
" the new window.

nmap s :scs find s =expand("")
nmap g :scs find g =expand("")
nmap c :scs find c =expand("")
nmap t :scs find t =expand("")
nmap e :scs find e =expand("")
nmap f :scs find f =expand("")
nmap i :scs find i ^=expand("")$
nmap d :scs find d =expand("")

" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one

nmap s :vert scs find s =expand("")
nmap g :vert scs find g =expand("")
nmap c :vert scs find c =expand("")
nmap t :vert scs find t =expand("")
nmap e :vert scs find e =expand("")
nmap i :vert scs find i ^=expand("")$
nmap d :vert scs find d =expand("")
endif



set list
"set listchars=tab:$_,trail:-,nbsp:%,extends:>,precedes:<
set listchars=tab:»·,eol:¬,trail:.,nbsp:.,extends:#,precedes:<


set encoding=utf-8
set fileencoding=utf-8


# highlighting

if has("syntax")
syntax on

function! ActivateIndicator()
"全角スペース
syntax match InvisibleJISX0208Space " " display containedin=ALL
highlight InvisibleJISX0208Space term=underline ctermbg=DarkRed guibg=DarkRed

"行末のスペースとタブ
syntax match InvisibleTrailedSpace "[ \t]\+$" display containedin=ALL
highlight InvisibleTrailedSpace term=underline ctermbg=DarkMagenta guibg=Orange

syntax match NOTE1 "NOTE" display containedin=ALL
highlight NOTE1 cterm=bold ctermfg=Magenta guibg=Magenta guifg=black

syntax match TODO1 "TODO" display containedin=ALL
highlight TODO1 cterm=bold ctermfg=Magenta guibg=Blue guifg=Yellow

syntax match suninno1 "suninno" display containedin=ALL
highlight suninno1 cterm=bold ctermfg=Magenta guibg=Yellow guifg=Green

"SpecialKeyを表示
highlight SpecialKey ctermbg=DarkGray guibg=DarkGray
endf


augroup invisible
autocmd! invisible
autocmd BufNew,BufRead * call ActivateIndicator()
augroup END
endif



if has("win32")
set shell=c:\WINDOWS\system32\cmd
set shellcmdflag=/c
endif


}}





set encoding=utf-8
set fileencoding=utf-8

" 文字コードの自動認識

if &encoding !=# 'utf-8'

set encoding=japan

set fileencoding=japan

endif

if has('iconv')

let s:enc_euc = 'euc-jp'

let s:enc_jis = 'iso-2022-jp'

" iconvがeucJP-msに対応しているかをチェック

if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb"

let s:enc_euc = 'eucjp-ms'

let s:enc_jis = 'iso-2022-jp-3'

" iconvがJISX0213に対応しているかをチェック

elseif iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb"

let s:enc_euc = 'euc-jisx0213'

let s:enc_jis = 'iso-2022-jp-3'

endif

" fileencodingsを構築

if &encoding ==# 'utf-8'

let s:fileencodings_default = &fileencodings

let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932'

let &fileencodings = &fileencodings .','. s:fileencodings_default

unlet s:fileencodings_default

else

let &fileencodings = &fileencodings .','. s:enc_jis

set fileencodings+=utf-8,ucs-2le,ucs-2

if &encoding =~# '^\(euc-jp\|euc-jisx0213\|eucjp-ms\)$'

set fileencodings+=cp932

set fileencodings-=euc-jp

set fileencodings-=euc-jisx0213

set fileencodings-=eucjp-ms

let &encoding = s:enc_euc

let &fileencoding = s:enc_euc

else

let &fileencodings = &fileencodings .','. s:enc_euc

endif

endif

" 定数を処分

unlet s:enc_euc

unlet s:enc_jis

endif

" UTF-8の□や○でカーソル位置がずれないようにする

if exists("&ambiwidth")

set ambiwidth=double

endif

" 改行コードの自動認識

set fileformats=unix,dos,mac



* english menu [#id924905]
" メッセージの英語表示
if has("win32")
lang en
endif


" メニューの英語表示

source $VIMRUNTIME/delmenu.vim
set langmenu=none
source $VIMRUNTIME/menu.vim

Comments

Popular posts from this blog

사자성어(가)

奇想天外(기상천외) 보통 사람이 쉽게 짐작할 수 없을 정도로 엉뚱하고 기발한 생각 技成眼昏(기성안혼) 재주를 다 배우니 눈이 어두워짐. 늙어서 재주가 쓸모 없게 됨 起承轉結(기승전결) 한시의 詩 作에서, 절구체의 전형적인 구성법을 지칭 제1구를 기구, 제2구를 승구, 제3구를 절구, 제4구를 결구 문장 구성에 있어서의 4단계, 서론, 설명, 증명, 결론 寄與補裨(기여보비) 이바지하여 돕고 부족함을 보태어 줌. 杞人之優(기인지우) 杞나라 사람의 군걱정이란 뜻. 곧 쓸데없는 걱정이나 무익한 근심을 말함.(=杞憂) 旣張之舞(기장지무) 이미 벌린 춤. 이미 시작한 일을 중간에서 그만 둘 수 없다 騎虎難下(기호난하) 이미 시작된 일을 중도에서 그만 둘 수 없음을 비유한 말 騎虎之勢(기호지세) = 기호난하 奇貨可居(기화가거) 진기한 물건을 사 두었다가 때를 기다리면 큰 이익을 볼 수 있다 吉祥善事(길상선사) 매우 기쁘고 좋은 일 吉凶禍福(길흉화복) 길한 일, 흉한 일, 언짢은 일, 복된 일 寄與補裨(기여보비) 이바지하여 돕고 부족함을 보태어 줌. 杞人之優(기인지우) 杞나라 사람의 군걱정이란 뜻. 곧 쓸데없는 걱정이나 무익한 근심을 말함.(=杞憂)  B A B A B A B A B A B A B A

nginx로 다중 포트 설정 및 다중 react app 설정

nginx에 다중 포트 설정하기 react로 여러 webapp를 개발하고, 동일한 서버에 실행시킬 필요가 있다. 이때 간단히 nginx에서 다중포트로 여러 webapp를 동일한 서버에서 실행시킬 수 있다. /etc/nginx/sites-available/에 default 파일이 있다. 보통 port 80로 설정되어 있다. 이 파일을 복사해서 sub로 명명한다.   아래와 같이 포트 8080으로 정하고, react app를 build한 디렉터리를 root <dir>로 지정하고, $> sudo service nginx restart 하면 된다. $>sudo systemctl status nginx.service 로 nginx 상태 확인이 가능하면, $> netstat -ano | grep 8080 으로 8080 포트가 살아있는 또는 외부PC에서  $>telnet ip 8080으로 telnet 접속이 되는지 확인하면 된다. 종종 Nginx 500 Interval Server Error가 발생하는데, 이는 1) root <dir>에서 <dir> 주소가 정확하지 않거나, 2) 파일 권한이 없거나이다. chmod 755 <dir>하면 대부분 해결될 것이다. 그럼 오늘도 유익한 하루 되시길..   

gnome screen

screen nano editor에서 빠져나오기 C+x가 screen prefix 일 경우, nano 에디터에서 빠쪄나오기 어렵다. 이때는 C+t, C+z하면 background 처리한 후, kill 명령어로 nano 실행 프로세스를 죽여야 한다.     그리고 crontab -e를 실행할 때, export VISUAL=vim; crontab -e로 실행해라.     screen session title를 변경 원할 경우 C+x, shift+a 하면 각 창 제목을 변경할 수 있다.     user's manual http://www.delorie.com/gnu/docs/screen/screen_toc.html - Run a new screen session # screen - Reattach to a previously detatched session # screen -R - Create a new window. # '''prefix''' c - Kill the current window - after confirmation # '''prefix''' k - 현재 창의 창 번호를 변경하는 방법 예 창번호 3에서 1로 변경할 경우, 먼저 창 3으로 이동한 상태에서 # '''prefix''' :number 1 [enter]하면 창번호3이 1로 변경됨.  - Switch to the other window # '''prefix''' space - Detach & Attach screen を起動した状態で、 # Ctrl-z d or Ctrl-z ^D とすると、screenを起動する前のシェルに戻ります。screenはバックグランドで動いています。これを「Detachedデタッチ」と言います。 Attachedとは「再開」 デタッチしたセッションを確認...