Skip to content

Instantly share code, notes, and snippets.

@tribela
Created October 22, 2013 20:07
Show Gist options
  • Save tribela/7107233 to your computer and use it in GitHub Desktop.
Save tribela/7107233 to your computer and use it in GitHub Desktop.
vimrc config
"color desert
colo slate
se nu
se ru
se sw=4
se sts=4
se ts=4
se ai
se cin
set smartindent
syntax on
set noeol
set nobackup
set hlsearch
set incsearch " 순간검색
set ignorecase
set smartcase " 대문자로 검색하면 구분 함
set noea "창을 나눌 때 똑같이 만들지 않음.
"set mouse=a "마우스 사용 가능
set autoread "외부에서 변경시 자동 읽기
set ve=onemore "줄 끝까지 커서 이동 가능
au filetype python set cc=80
"Scroll before edge
set scrolloff=10
set fencs=utf-8,cp949,euc-kr
filetype plugin indent on
set tags+=./tags
map <F3> :Tlist<cr><C-W><C-W>
map <C-S> :w<cr>
imap <C-s> <esc>:w<cr>i
map <C-J> <C-W>-
map <C-K> <C-W>+
map <C-H> <C-W><
map <C-L> <C-W>>
imap <C-J> <esc><C-W>-i
imap <C-K> <esc><C-W>+i
imap <C-H> <esc><C-W><i
imap <C-L> <esc><C-W>>i
"Up and Down for wrapped lines
nnoremap j gj
nnoremap k gk
"Jump to start and end of line
noremap H ^
noremap L $
"Shortcut esc
inoremap lkj <esc>
"Force saving root permimssion file
cmap w!! %!sudo tee > /dev/null %
"Clear search highlights
noremap <silent><leader>/ :nohls<cr>
"insert one charactor
nmap <space> i_<esc>r
"indent all of files
nmap <leader>g mzgg=G'z
"Open, close, enter pairs
"noremap! "" ""<left>
"noremap! '' ''<left>
"But not these.
"noremap! '', '',
"noremap! '') '')
"noremap! ''; '';
"for python
inoremap """ """"""<left><left><left><cr>
noremap! (( ()<left>
noremap! (<cr> (<cr>)<c-o>O
noremap! (; ();<esc>hi
noremap! (<cr>; (<cr>);<c-o>O
noremap! ('; ('');<esc>hhi
noremap! ("; ("");<esc>hhi
noremap! (' ('')<esc>hi
noremap! (" ("")<esc>hi
noremap! {{ {}<left>
noremap! {<cr> {<cr>}<c-o>O
noremap! {; {};<esc>hi
noremap! {<cr>; {<cr>};<c-o>O
noremap! {'; {''};<esc>hhi
noremap! {"; {""};<esc>hhi
noremap! {' {''}<esc>hi
noremap! {" {""}<esc>hi
noremap! [[ []<left>
noremap! [<cr> [<cr>]<c-o>O
noremap! [; [];<esc>hi
noremap! [<cr>; [<cr>];<c-o>O
noremap! ['; [''];<esc>hhi
noremap! ["; [""];<esc>hhi
noremap! [' ['']<esc>hi
noremap! [" [""]<esc>hi
"map! <C-M> <esc>[{v]}zf
if filereadable('Makefile')
au Filetype c set makeprg=make
else
au FileType c set makeprg=gcc\ -o\ %<\ %
endif
au FileType python set makeprg=python\ -i\ %
"autocmd BufWinEnter *.c,*.php,*.html,*.py,*.js silent! !ctags <afile>
"autocmd BufWinLeave *.c,*.php,*.html,*.py,*.js silent! !rm tags
"set tags+=/tmp/tag
"cscope
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
set csverb
" set cursor to the last worked line
set viewoptions=cursor
au BufWinLeave *.c,*.cc,*.h,*.html,*.php,Makefile,*.py,*.sh mkview
au BufWinEnter *.c,*.cc,*.h,*.html,*.php,Makefile,*.py,*.sh loadview
" ---
filetype plugin on
"set tags+=/usr/include/tags
" for gvim
if has("gui_running")
set lines=60 columns=180
set guifont=source\ code\ pro\ semibold:h12
endif
function! SuperTab()
if (strpart(getline('.'),col('.')-2,1)=~'^\W\?$')
return "\<Tab>"
else
return "\<C-n>"
endif
endfunction
inoremap <Tab> <C-r>=SuperTab()<cr>
function! Closer(arg)
"Next character from cursor
let l:current = strpart(getline('.'), col('.')-1, 1)
if(a:arg == l:current)
return "\<right>"
else
return a:arg
endif
endfunction
inoremap " <C-r>=Closer('"')<cr>
inoremap ' <C-r>=Closer("'")<cr>
inoremap ) <C-r>=Closer(')')<cr>
inoremap ] <C-r>=Closer(']')<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment