Skip to content

Instantly share code, notes, and snippets.

@udonchan
Created May 14, 2011 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udonchan/971916 to your computer and use it in GitHub Desktop.
Save udonchan/971916 to your computer and use it in GitHub Desktop.
set fileencodings=utf8
set encoding=utf-8
set termencoding=utf-8
noremap <C-j> 3+
noremap <C-k> 3-
nnoremap Y y$
noremap # :call ToggleCommentSelection()<CR>
nnoremap R gR
nnoremap <Space>l :hide bn!<CR>
nnoremap <Space>h :hide bp!<CR>
nnoremap <Tab> <C-w>w
nnoremap <C-h> <C-w>W
vnoremap s y:%s/<C-R>"//g<Left><Left>
set hidden
set autoread
set isfname-==
set tags=+../../**/tags
set autoindent smartindent
set smarttab
set tabstop=4 softtabstop=4 shiftwidth=4
set cinoptions=t0,:0,g0,(0
set backspace=indent,eol,start
set formatoptions=tcqnmM
set listchars=tab:>-
set iskeyword+=-,!,?
set indentkeys-=0#
set virtualedit=block
set showmatch matchtime=1
set matchpairs+=<:>
set whichwrap+=h,l,<,>,[,],b,s
set nowrap
set ruler
set ruf=%45(%12f%=\ %m%{'['.(&fenc!=''?&fenc:&enc).']'}\ %l-%v\ %p%%\ [%02B]%)
set statusline=%f\ %m%=%{(&fenc!=''?&fenc:&enc).':'.&ff}%{(&list?'>':'')}\ %l-%v\ %p%%\ [%02B]
set showcmd
set cmdheight=1
set laststatus=2
set nonumber
set shortmess+=I
set nofoldenable
set vb t_vb=
set ignorecase
set smartcase
set incsearch
set nohlsearch
set keywordprg=man\ -a
set wildmenu
set history=50
set splitbelow
set splitright
set sessionoptions+=resize
set previewheight=5
augroup MyAutocmd
au!
au BufEnter * lcd %:p:h
au BufNewFile,BufReadPost vim let b:commentSymbol="\""
au BufNewFile,BufReadPost *.c,*.h,*.cpp,*.d,*.java let b:commentSymbol="//"
au BufNewFile,BufReadPost *.lua let b:commentSymbol="--"
au BufNewFile *.h call IncludeGuard()
au BufNewFile *.rb call append(0, "#!/usr/bin/env ruby")
au BufWritePost * if getline(1) =~ "^#!" | exe "silent !chmod +x %" | endif
au BufNewFile,BufReadPost \cmakefile,*.mak setlocal list noexpandtab
au BufNewFile,WinEnter * hi ZenkakuSpace guibg=NONE gui=underline guifg=#90e09f| match ZenkakuSpace / /
au FileType vim set sw=2 ts=2 sts=2 et
au FileType c,cpp call C_Setting()
au FileType ruby call Ruby_Setting()
autocmd Syntax * call MySyntax()
augroup END
function! MySyntax()
syn keyword Return return exit | hi Return ctermfg=red gui=bold guifg=red
syn keyword Break break | hi Break gui=none guifg=#0000ff
syn keyword Continue continue | hi Continue gui=none guifg=#007F7F
syn keyword Debug DEBUG debug dprintf | hi Debug ctermfg=None ctermbg=red gui=bold guifg=#ff00ff guibg=#ffffff
syn keyword Fallthrough fallthrough | hi Fallthrough gui=underline guifg=red
syn keyword cppPublic public | hi cppPublic guifg=#0000ff ctermfg=darkcyan
syn keyword cppPrivate protected private | hi cppPrivate guifg=#006600 ctermfg=darkred
syn keyword Virtual virtual | hi Virtual guifg=brown ctermfg=3
endfunction
function! C_Setting()
set isk-=!
setlocal ts=4 sts=4 sw=4 noet
set fo-=ro
nnoremap <buffer> p p=`]
set foldmethod=syntax
syn region myFold start="{" end="}" transparent fold
set foldnestmax=1
iab case case<CR><C-D>break;<Up>
iab default: default:<CR>break;<Up>
if filereadable("./Makefile")
setlocal makeprg=make
else
setlocal makeprg=gcc\ %
endif
endfunction
function! Ruby_Setting()
setlocal ts=2 sts=2 sw=2
comp ruby
nnoremap <buffer> <F5> :make %<CR>
iab <buffer> ei each_with_index
endfunction
function! ToggleCommentSelection() range
if exists('b:commentSymbol')
let cs = b:commentSymbol
else
let cs = "#"
endif
let cl = a:firstline
while (cl <= a:lastline)
let line = getline(cl)
if strpart(line, match(line, "[^ \t]"), strlen(cs)) == cs
let i = 0
while (i < strlen(cs))
normal! ^x
let i = i + 1
endwhile
else
execute "normal! I" . cs
endif
normal! j
let cl = cl + 1
endwhile
endfunction
set term=builtin_linux
set ttytype=builtin_linux
colorscheme torte
syntax on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment