Skip to content

Instantly share code, notes, and snippets.

@Taehun
Last active June 27, 2022 08:13
Show Gist options
  • Save Taehun/821b1733f94b7d80ada7 to your computer and use it in GitHub Desktop.
Save Taehun/821b1733f94b7d80ada7 to your computer and use it in GitHub Desktop.
vimrc
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
"=== For linux kernel ===
"set noexpandtab
"set tabstop=8
"set shiftwidth=8
"set softtabstop=8
set nobackup
set cindent
set autoindent smartindent
set incsearch
set guifont=Courier\ 11
set smarttab
syntax on
filetype plugin indent on
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set encoding=utf-8
set fileencodings=utf-8,cp949
endif
colorscheme elflord
set backspace=eol,start,indent
set history=1000
set hlsearch
set ignorecase
set showmatch
set tagbsearch
set number
" ============= file view =================
set laststatus=2
set statusline=%h%F%m%r%=[%l:%c(%p%%)]
" ============= key mapping ===============
map <F1> v]}zf
map <F2> zo
map <F3> :Tlist<cr><c-w><c-w>
map <PageUp> <c-u><c-u>
map <PageDown> <c-d><c-d>
" ============= file buffer move ===============
map ,1 :b!1<cr>
map ,2 :b!2<cr>
map ,3 :b!3<cr>
map ,4 :b!4<cr>
map ,5 :b!5<cr>
map ,6 :b!6<cr>
map ,7 :b!7<cr>
map ,8 :b!8<cr>
map ,9 :b!9<cr>
map ,0 :b!0<cr>
map ,w :b!w<cr>
" ============ ctags setup ==================
if filereadable("./tags")
set tags=./tags,../tags,../../tags,../../../tags,tags
endif
if version >= 500
func! Sts()
let st = expand("<cword>")
exe "sts ".st
endfunc
nmap ,st :call Sts()<cr>
func! Tj()
let st = expand("<cword>")
exe "tj ".st
endfunc
nmap ,tj :call Tj()<cr>
endif
" =========== cscope setup =================
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
if filereadable("./cscope.out")
cs add cscope.out
endif
set csverb
func! Css()
let css = expand("<cword>")
new
exe "cs find s ".css
if getline(1) == " "
exe "q!"
endif
endfunc
nmap ,css :call Css()<cr>
func! Csc()
let csc = expand("<cword>")
new
exe "cs find c ".csc
if getline(1) == " "
exe "q!"
endif
endfunc
nmap ,csc :call Csc()<cr>
"=========== man page setup =============
func! Man()
let sm = expand("<cword>")
exe "!man -S 2:3:4:5:6:7:8:9:tcl:n:k:p:o ".sm
endfunc
nmap ,ma :call Man()<cr><cr>
"========== dictionaly =================
func! Engdic()
let ske = expand("<cword>")
new
exec "r !lynx -nolist -verbose -dump http://kr.engdic.yahoo.com/result.html?p=".ske " | sed 's/\\[INLINE\\]//g' | tail +23"
set nomod wrap
noremap <buffer> q :bd<cr>:echo ' '<cr>
endfunc
nmap ,ed :call Engdic()<cr>gg
map <F3> <c-w><c-w>
map <F4> :Tlist<cr>
map <c-m> :q<CR>
vmap <Tab> >gv
vmap <S-Tab> <gv
imap <c-k> /** */<esc>hhha
imap <a-Space> <esc>
"=========== imap setup for c =============
imap #in #include <><esc>i
imap #de #define <esc>i
" Highlighting over text width
augroup vimrc_autocmds
autocmd BufEnter * highlight OverLength ctermbg=grey guibg=#592929
autocmd BufEnter * match OverLength /\%78v.*/
augroup END
"=========== Key mappings =============
cabbr E :e <C-R>=expand('%:p:h')<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment