Skip to content

Instantly share code, notes, and snippets.

@dais0n
Last active June 21, 2017 13:41
Show Gist options
  • Save dais0n/c95895c03602e2a33994ca3f2c7e118d to your computer and use it in GitHub Desktop.
Save dais0n/c95895c03602e2a33994ca3f2c7e118d to your computer and use it in GitHub Desktop.
minimum vimrc
"----------------
" init
"----------------
" reset augroup
augroup MyAutoCmd
autocmd!
augroup END
"----------------
" statusline
"----------------
" filename
set statusline=%F
" check change
set statusline+=%m
" check readonly
set statusline+=%r
" help page
set statusline+=%h
" preview
set statusline+=%w
" rightstatus
set statusline+=%=
" file encoding
set statusline+=[ENC=%{&fileencoding}]
" display rows
set statusline+=[LOW=%l/%L]
" Always display the statusline in all windows
set laststatus=2
" Always display the tabline, even if there is only one tab
set showtabline=2
set completeopt=menuone
"-----------------
" general
"-----------------
syntax enable
set encoding=utf-8
set nobackup
set modeline
set fileencoding=utf-8
set fileencodings=ucs-boms,utf-8,euc-jp,cp932
set fileformats=unix,dos,mac
set ambiwidth=double
colorscheme desert
" change tab to space
set expandtab
set tabstop=4
set softtabstop=4
set autoindent
set smartindent
set shiftwidth=4
filetype plugin indent on
augroup fileTypeIndent
autocmd!
autocmd BufNewFile,BufRead *.py setlocal tabstop=4 softtabstop=4 shiftwidth=4
autocmd BufNewFile,BufRead *.rb setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.sh setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.js setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.html setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.vue setlocal tabstop=2 softtabstop=2 shiftwidth=2
augroup END
set backspace=indent,eol,start
set whichwrap=b,s,h,l,<,>,[,],~
set showmatch
" complete commands
set wildmenu
" delete beepsound
set visualbell
set hlsearch
set ruler
set noswapfile
set title
set wildmenu wildmode=list:full
" search settings
set ignorecase
set incsearch
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
set number
set history=700
set showcmd
set clipboard=unnamed
set lazyredraw
set ttyfast
set showbreak=↪
set wrapscan
" change esc
"inoremap <C-j> <Esc>
"noremap <C-j> <Esc>
"vnoremap <C-j> <Esc>
" select endline by vv
vnoremap v $h
" color
set t_Co=256
highlight Normal ctermbg=none
" auto parentheses
inoremap {<Enter> {}<Left><CR><ESC><S-o>
filetype plugin indent on
inoremap [<Enter> []<Left><CR><ESC><S-o>
inoremap (<Enter> ()<Left><CR><ESC><S-o>
" zenkaku space
function! ZenkakuSpace()
highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=darkgray
endfunction
if has('syntax')
augroup ZenkakuSpace
autocmd!
autocmd ColorScheme * call ZenkakuSpace()
autocmd VimEnter,WinEnter,BufRead * let w:m1=matchadd('ZenkakuSpace', ' ')
augroup END
call ZenkakuSpace()
endif
" binary settings
augroup BinaryXXD
autocmd!
autocmd BufReadPre *.bin let &binary =1
autocmd BufReadPost * if &binary | silent %!xxd -g 1
autocmd BufReadPost * set ft=xxd | endif
autocmd BufWritePre * if &binary | %!xxd -r | endif
autocmd BufWritePost * if &binary | silent %!xxd -g 1
autocmd BufWritePost * set nomod | endif
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment