set encoding=utf-8 scriptencoding utf-8 if empty($XDG_DATA_HOME) let s:data_home = $HOME . '/.local/share' else let s:data_home = $XDG_DATA_HOME endif let s:my_env = { \ 'backup_dir': s:data_home . '/vim/backup', \ 'swap_dir': s:data_home . '/vim/swap', \ 'undo_dir': s:data_home . '/vim/undo', \ 'viminfo': s:data_home . '/vim/viminfo', \ } for [s:k, s:v] in items(s:my_env) if s:k =~# '_dir$' && !isdirectory(s:v) call mkdir(s:v, 'p') endif endfor unlet s:k s:v s:data_home language messages C language time C syntax on filetype plugin indent on set nowrapscan set incsearch set ignorecase set smartcase set scrolloff=7 set wrap set linebreak set breakindent set breakindentopt+=sbr let &showbreak = '> ' set sidescrolloff=20 set display=lastline let &fillchars = 'vert: ,fold: ,diff: ' set list let &listchars = "eol: ,tab:> ,trail:^,extends:>,precedes:<" set concealcursor=cnv set synmaxcol=500 set hlsearch set t_Co=256 set colorcolumn=+1 set laststatus=2 set winminheight=0 set hidden set switchbuf=usetab set showtabline=1 set notitle set mouse= set shortmess+=a set shortmess+=s set shortmess+=I set shortmess+=c set showcmd set noshowmode set report=999 set confirm set belloff=all set clipboard=unnamed set undofile let &undodir = s:my_env.undo_dir set textwidth=0 set backspace=indent,eol,start set completeopt-=preview set pumheight=10 set noshowmatch set matchpairs+=<:> set nojoinspaces set nrformats-=octal set nrformats+=unsigned set tabstop=4 set shiftwidth=4 set smarttab set softtabstop=4 set expandtab set autoindent set smartindent set copyindent set preserveindent set foldlevelstart=0 set foldopen+=insert set foldmethod=marker set diffopt+=vertical set diffopt+=foldcolumn:3 set maxmapdepth=10 set notimeout set ttimeout set ttimeoutlen=100 set nofixendofline set fileformats=unix,dos set backup let &backupdir = s:my_env.backup_dir set autowrite set autoread let &directory = s:my_env.swap_dir . '//' set history=2000 set wildignore+=*.o,*.obj,*.lib set wildignorecase set wildmenu set shell=zsh set keywordprg= set fileencodings=utf-8,cp932,euc-jp set sessionoptions+=localoptions set sessionoptions+=resize set sessionoptions+=winpos let &viminfofile = s:my_env.viminfo augroup Vimrc autocmd! augroup END autocmd Vimrc VimResized * wincmd = autocmd Vimrc BufRead * \ if 0 < line("'\"") && line("'\"") <= line('$') && \ &filetype !~# 'commit' && &filetype !~# 'rebase' | \ execute "normal g`\"" | \ endif noremap gn v:searchforward ? 'gn' : 'gN' noremap gN v:searchforward ? 'gN' : 'gn' noremap n v:searchforward ? 'n' : 'N' noremap N v:searchforward ? 'N' : 'n' nnoremap & :%&& xnoremap & :%&& nnoremap " xnoremap " let @j = 'j.' let @k = 'k.' let @n = 'n.' nnoremap @N N. nnoremap @a 9999@@ nnoremap ` @@ inoremap inoremap repeat("\U\", col('.') - 1) inoremap repeat("\U\", col('$') - col('.')) inoremap U inoremap U inoremap u inoremap u cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap cnoremap inoremap cnoremap inoremap nnoremap c "_c xnoremap c "_c nnoremap C "_C xnoremap C "_C noremap g= = noremap ml gu noremap mu gU noremap gu noremap gU xnoremap u xnoremap U xnoremap x "_x nnoremap Y y$ xnoremap Y mode() ==# 'V' ? 'y' : 'Vy' nnoremap R gR nnoremap gR R nnoremap r gr nnoremap gr r nnoremap U noremap H ^ noremap L $ noremap M % noremap gw b noremap gW B noremap k gk noremap j gj noremap gk k noremap gj j nnoremap gff gF nnoremap tt :tabnew nnoremap tn :=(tabpagenr() + v:count1 - 1) % tabpagenr('$') + 1tabnext nnoremap tp :=(tabpagenr('$') * 10 + tabpagenr() - v:count1 - 1) % tabpagenr('$') + 1tabnext nnoremap tN :tabmove + nnoremap tP :tabmove - nnoremap tsh :leftabove vsplit nnoremap tsj :rightbelow split nnoremap tsk :leftabove split nnoremap tsl :rightbelow vsplit nnoremap tsH :topleft vsplit nnoremap tsJ :botright split nnoremap tsK :topleft split nnoremap tsL :botright vsplit nnoremap twh :leftabove vnew nnoremap twj :rightbelow new nnoremap twk :leftabove new nnoremap twl :rightbelow vnew nnoremap twH :topleft vnew nnoremap twJ :botright new nnoremap twK :topleft new nnoremap twL :botright vnew nnoremap th h nnoremap tj j nnoremap tk k nnoremap tl l nnoremap tH H nnoremap tJ J nnoremap tK K nnoremap tL L nnoremap tx x nnoremap tRH _ nnoremap tRW nnoremap tRR _ nnoremap t= = nnoremap tq :bdelete nnoremap tc c nnoremap to o nnoremap tO :tabonly nnoremap gh nnoremap gH nnoremap g nnoremap Q nnoremap gQ nnoremap ZZ nnoremap ZQ nnoremap :help onoremap gv :normal! gv nnoremap ; : nnoremap : ; xnoremap ; : xnoremap : ; nnoremap @; @: xnoremap @; @: cnoremap ; : inoremap ; : imap jk cmap jk nnoremap :nohlsearch nnoremap w :write inoreabbrev retrun return inoreabbrev reutrn return inoreabbrev tihs this set background=dark colorscheme desert let &statusline = ' %f %r %m %= %l/%L %{&fileencoding} %{&fileformat} %y '